Re: floor() broken on EV4?
prescott@phys.ufl.edu writes:
> In tracking down issues with ganglia/rrdtool, I found that floor()
> is not working properly in testing on my Avanti - it always seems to
> return zero:
>
> cpp@imladris:~$ cat junk.c
> #include <stdio.h>
> #include <math.h>
>
> int main()
> {
> double x = 1.1;
>
> printf("floor(%f) = %f\n", x, floor(x));
>
> return(0);
> }
> cpp@imladris:~$ gcc junk.c -o junk -lm
> cpp@imladris:~$ ./junk
> floor(1.100000) = 0.000000
>
> The same code on EV56 produces the expected result.
>
> Anyone have any ideas or recommendations?
The EV4 FPU cannot round to minus infinity, as glibc's floor wants to
do, so the kernel emulates this. So it's almost certainly a kernel
bug. Can you show the output of this program:
#include <stdio.h>
int main() {
union { double x; unsigned long i; } u;
asm ("cvttq/svm %1,%0" : "=f"(u.x) : "f"(1.1));
printf("%016lx\n", u.i);
u.i = 1;
asm ("cvtqt/m %0,%0" : "=f"(u.x) : "f"(u.x));
printf("%e\n", u.x);
return 0;
}
?
BTW, are you really still working with these machines? I was planning
on suggesting to drop EV4 support for lenny, because I couldn't really
imagine anybody still using them with a current Debian system...
--
Falk
Reply to: