[racket-dev] .1 evaluates to 0.0 [was Re: plot doesn't plot (inexact->exact: no exact representation for +nan.0)]

From: Marijn (hkBst at gentoo.org)
Date: Thu Dec 29 04:34:53 EST 2011

Hash: SHA1

On 29-12-11 09:55, Laurent wrote:
>> you're certainly on the right track. I tried starting drracket in
>> this way:
>> LC_ALL="en_US.UTF-8" drracket &
> Same here: LC_ALL="en_US.UTF-8" gracket
> Welcome to Racket v5.2.0.6. This is a simple window for evaluating
> Racket expressions. Quit now and run DrRacket to get a better
> window. The current input port always returns eof.
>> .3
> 0.3
> Great!
> *However*, this did not work with: LC_ALL="fr_FR.UTF-8" gracket

Because the french locale uses comma (,) as the decimal separator like
my dutch one and unlike the english one which uses dot (.). So when
the locale-aware C number reading function gets to it and sees (.) it
fails to recognize is as a valid number character. Now that I've
thought about it more the weird behavior where it starts working
correctly after having seen a number bigger than 1.0 smells like an
unmatched push/pop locale pair. Might this then not also cause quite a
big locale stack to be allocated? Finally I wanted to ask if it was
possible that the automated tests are run with a non-english or random

Matthew, I still wanted to remark that I find it strange that plain
racket did not exhibit the same locale-dependence. Do you have an
explanation for that? Does it read some >=1.0 float causing the locale
stack to become ``seeded'' (due to postulated unmatched push/pop).

BTW Perhaps coccinelle (http://coccinelle.lip6.fr/) can help identify
(and automatically fix) the unmatched uses of the locale stack.

Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


Posted on the dev mailing list.