1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* * Rule: FLP00-C * Source: wiki * Status: PASS - Epsilon-based floating-point comparison */ #include <math.h> #include <float.h> int check_result(float a, float b) { float c = a / b; float diff = fabsf(c - (a / b)); if (diff <= FLT_EPSILON) { return 1; } return 0; }