Hello,
On OpenBSD-5.7/amd64 (under qemu/kvm), I'm getting incorrect results
when using ceill(3). For values between 0 and 1, the returned value
is 0, while I'd expected it to be 1. Using ceil(3) does return 1 as
expected. Is this my incorrect usage or a bug?
any advice/comment will be appreciated.
To reproduce:
$ cat 1.c
#include <math.h>
#include <stdio.h>
int main()
{
long double d;
printf("d ceill(d) ceil(d)\n");
for (d = 0.3; d <= 3.8; d+=0.5)
printf("%-4Lg %-8Lg %-5g\n",
d, ceill(d), ceil((double)d));
return 0;
}
$ gcc -g -O0 -Wall -Wextra -o 1 1.c -lm
$ ./1
d ceill(d) ceil(d)
0.3 0 1 <----
0.8 0 1 <----
1.3 2 2
1.8 2 2
2.3 3 3
2.8 3 3
3.3 4 4
Thanks,
- assaf