2017-10-21 23:40:19 +00:00
|
|
|
/* Conformance Test 19.3.0.1: Verification of ceil, floor, fmod functions */
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
2022-10-17 22:50:42 +00:00
|
|
|
int printf(const char *, ...);
|
|
|
|
|
|
|
|
int main (void)
|
2017-10-21 23:40:19 +00:00
|
|
|
{
|
|
|
|
double d1;
|
|
|
|
|
|
|
|
d1 = ceil (-3.26);
|
|
|
|
if (fabs(d1 - (-3.0)) > 0.00001)
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
d1 = floor (-3.26);
|
|
|
|
if (fabs(d1 - (-4.0)) > 0.00001)
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
d1 = fmod (-4.4, 2.0);
|
|
|
|
if (fabs(d1 - (-0.4)) > 0.00001)
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
d1 = fmod (-4.4, 0.0);
|
|
|
|
if (fabs(d1 - (-4.4)) > 0.00001)
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
|
|
|
|
printf ("Passed Conformance Test 19.3.0.1\n");
|
2022-10-17 22:50:42 +00:00
|
|
|
return 0;
|
2017-10-21 23:40:19 +00:00
|
|
|
|
|
|
|
Fail:
|
|
|
|
printf ("Failed Conformance Test 19.3.0.1\n");
|
|
|
|
}
|