0/0 => "nan", not "NaN". Also, empty hsc2hs dir and "invalid predicate `-wholename'"
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
On Thursday 22 March 2007 02:13, Ian Lynagh wrote:
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 [...]
What's even worse: I've just seen that neither Hugs nor nhc98 implement isNaN, isInfinte, isDenormalized, isNegativeZero and isIEEE. :-( GHC does it via some bit-fiddling in StgPrimFloat.c, but it is unclear to me why the stuff from <math.h> (isnan() etc.) is not simply used instead. Does anybody remember? These macros are C99, I think, but do we really support older C standards?
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 think the right way to solve this is having a "update -Pd" line in ~/.cvsrc. I fail to understand why this behaviour is not the default...
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.
We had reports about this earlier IIRC, and for the GNU 'find' -wholename seems to be identical to -path, so I think this could be changed. Cheers, S.
Sven Panne <sven.panne@aedion.de> wrote:
What's even worse: I've just seen that neither Hugs nor nhc98 implement isNaN, isInfinte, isDenormalized, isNegativeZero and isIEEE. :-( GHC does it via some bit-fiddling in StgPrimFloat.c, but it is unclear to me why the stuff from <math.h> (isnan() etc.) is not simply used instead. Does anybody remember? These macros are C99, I think, but do we really support older C standards?
If I recall correctly, at the time nhc's numeric code was first written in 1994, the C99 standard was not widely available. :-) Regards, Malcolm
participants (3)
-
Ian Lynagh -
Malcolm Wallace -
Sven Panne