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

From: Laurent (laurent.orseau at gmail.com)
Date: Wed Dec 28 08:03:31 EST 2011

On Wed, Dec 28, 2011 at 13:18, Matthew Flatt <mflatt at cs.utah.edu> wrote:

> Thanks for all the new info! I don't think that it's a bytcode problem.
> I start to wonder if it's in number parsing...
>
> On line 1102 of "src/racket/src/numstr.c", there's a call to STRTOD().
> Does it change anything if you wrap that call with calls to
> scheme_push_c_numeric_locale() and scheme_pop_c_numeric_locale(loc)?:
>
>    {
>      GC_CAN_IGNORE char *loc;
>      loc = scheme_push_c_numeric_locale();
>      d = STRTOD(ffl_buf, &ptr);
>      scheme_pop_c_numeric_locale(loc);
>    }
>

It works!
Though: I downloaded the nightly Unix sources, and did:
mkdir build
cd build
../configure
make

But no drracket executable appears (did I do something wrong?).
So I did:
gracket/gracket3m

and it took a full minute with 100% CPU to start (same for simply racket3m).
Then
Welcome to Racket v5.2.0.7.
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
>


In case this does not completely solve the issue, here is another
minimalistic interesting interaction in the buggy 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.0
> 3.3
3.0
> .3
0.3

So it seems that it's the fact that using a >= 1 floating point number make
the bug go away.


Anyway, I hope this does solves the issue!
Thank you very much,

Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20111228/542488fa/attachment.html>

Posted on the dev mailing list.