lkml.org 
[lkml]   [1998]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: floating-point abuse in 2.1.113
    Date
    >>> -                       v.rangelow=(int)(87.9*16);
    >>> - v.rangehigh=(int)(107.8*16);
    >>> + v.rangelow=(879*16)/10;
    >>> + v.rangehigh=(1078*16)/10;
    >>
    >> How can that be a problem? Shouldn't the multiplication and cast
    >> be evaluated at compile time, leaving only an int?
    >
    > The problem is the "." in 88.9, etc. This means "float".

    Yes, of course. You have a literal float multiplied by a literal int.
    The compiler should promote the int and multiply. After that, the compiler
    should convert the result to an int, eliminating the cast. Then the compiler
    should store that int value in the object file. Why not?

    If this has anything to do with IEEE rounding modes, gross!
    In that case, gcc needs a -flinux-kernel option. Maybe one of the
    existing flags will make gcc optimize away the floating point math.
    How about -ffast-math?

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html

    \
     
     \ /
      Last update: 2005-03-22 13:43    [W:3.185 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site