[9fans] Re: debugging help asked for - Plan9

This is a discussion on [9fans] Re: debugging help asked for - Plan9 ; I said: > Possibly gcc/linux reacts differently to division by zero? In this particular case, you can get the same result as gcc/linux by doing these two things: - at the beginning of main() in PATHd8.c, add this line setfcr(getfcr()&~(FPINVAL|FPZDIV)); ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: [9fans] Re: debugging help asked for

  1. [9fans] Re: debugging help asked for

    I said:

    > Possibly gcc/linux reacts differently to division by zero?


    In this particular case, you can get the same result as
    gcc/linux by doing these two things:

    - at the beginning of main() in PATHd8.c, add this line
    setfcr(getfcr()&~(FPINVAL|FPZDIV));

    - in /sys/src/libc/port/log.c function log(), replace this:

    if(arg <= 0)
    return NaN();

    with this:

    if(arg <= 0 || isNaN(arg))
    return NaN();

    -- Richard


  2. Re: [9fans] Re: debugging help asked for

    I said:

    > In this particular case, you can get the same result as
    > gcc/linux by doing these two things:


    Of course, the result will probably then be wrong in both
    Plan 9 and linux because you're still dividing by zero ...


  3. Re: [9fans] Re: debugging help asked for

    On 5/21/07, Richard Miller <9fans@hamnavoe.com> wrote:
    > I said:
    >
    > > In this particular case, you can get the same result as
    > > gcc/linux by doing these two things:

    >
    > Of course, the result will probably then be wrong in both
    > Plan 9 and linux because you're still dividing by zero ...


    makes me feel warm and toasty inside ... are B787s modeled on linux?
    probably :-)

    ron

  4. Re: [9fans] Re: debugging help asked for

    Ron says (ironically I hope):
    > makes me feel warm and toasty inside


    On a more serious note, why is the default in gcc/linux to switch off
    floating point divide-by-zero exceptions? Ron, are your "computational
    scientist" colleagues really more comfortable when the intermediate
    results of their calculataions are full of INFs and NANs? Wouldn't
    they rather be told when they're doing something mathematically invalid?


  5. Re: [9fans] Re: debugging help asked for

    On 5/22/07, Richard Miller <9fans@hamnavoe.com> wrote:
    > Ron says (ironically I hope):
    > > makes me feel warm and toasty inside

    >
    > On a more serious note, why is the default in gcc/linux to switch off
    > floating point divide-by-zero exceptions?


    Must make TLB reloads work better.

    >Ron, are your "computational
    > scientist" colleagues really more comfortable when the intermediate
    > results of their calculataions are full of INFs and NANs? Wouldn't
    > they rather be told when they're doing something mathematically invalid?


    What they don't know must not have hurt them.

    Did the wing always bend quite that way? It seems a little -- wait ---

+ Reply to Thread