0/0 => "nan", not "NaN". Also, empty hsc2hs dir and "invalid predicate `-wholename'"

Ian Lynagh igloo at earth.li
Wed Mar 21 21:13:58 EDT 2007


Hi all,

hugs thinks that

    show (0/0 :: Double)

is "nan", but it will only read "NaN". I'd suggest changing the
behaviour of show rather than that of read, so as to match GHC:

Prelude> show (0/0 :: Double)
"NaN"
Prelude> read "nan" :: Double
*** Exception: Prelude.read: no parse
Prelude> read "NaN" :: Double
NaN

The result of the show seeme to come from sprintf in doubleToString
(src/machdep.c); this C program also prints "nan":

    #include <stdio.h>
    int main(void) {
        char b[100];
        sprintf(b, "%e", (double) 0/0);
        printf("%s\n", b);
        return 0;
    }


While building CVS/darcs hugs I got

    darcs get --partial http://darcs.haskell.org/hsc2hs
    Directory '/home/ian/code/hugs/hugs98/hsc2hs' already exists, creating repository as '/home/ian/code/hugs/hugs98/hsc2hs_0'

I think due to an empty CVS directory; I had to jiggle them around for
it to build later on.

I also got

    /usr/bin/find: invalid predicate `-wholename'

thrice. Replacing -wholename with -path in libraries/tools/make_bootlib
let the build go through, but I'm not sure if this is either (a) correct
or (b) a superset of the portability of -wholename.


Thanks
Ian



More information about the Hugs-Bugs mailing list