[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: floor() broken on EV4?



On Feb 11 2007, Falk Hueffner wrote:
> 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.
<snip>

Or pilot error :-(  I finally got a chance to look more into this, 
and I see that I have gaffed.  I did not have the math-emu module 
loaded.  Once loaded, floor() (and other stuff) works fine.

Maybe everyone except me knew to have math-emu loaded?  I was 
kind of surprised it was not built-in.  Is this intended?  

Cheers,
Craig

Here's the Kconfig help for MATHEMU:

    This option is required for IEEE compliant floating point arithmetic
    on the Alpha. The only time you would ever not say Y is to say M in  
    order to debug the code. Say Y unless you know what you are doing.





Reply to: