- comparing floating point numbers in C for unit testing
- float x;
- x = atof("17.99");
- CU_ASSERT(abs(x - atof("17.99")) < epsilon);
- r = atof("17.99");
- CU_ASSERT(0 == memcmp(&x, &r, sizeof(float));
- float r, x;
- r = atof("17.99");
- CU_ASSERT(0 == memcmp(&x, &r, sizeof(float));
- r = atof("17.99");
- CU_ASSERT(x == r);
- CU_ASSERT(x == atof("17.99"));
- CU_ASSERT(x == (float)atof("17.99"));