[racket-dev] plot doesn't plot (inexact->exact: no exact representation for +nan.0)

From: Marijn (hkBst at gentoo.org)
Date: Tue Dec 13 09:36:55 EST 2011

Hash: SHA1

On 07-12-11 19:46, Neil Toronto wrote:
> I just pushed a change that should keep it from raising an error.
> Can you get the latest and try it? If there's no error, will you
> please send me (personally, not the list) a screenshot of the
> result?

The error is gone now, and I will send you a screenshot privately.
Interestingly, after playing with it for a while, suddenly when I run
it the plot produced has a different viewing angle and dragging it is
actually working. Unfortunately I cannot yet reliably reproduce this.
So maybe this is some initialisation problem? The way I test, I start
up a fresh drracket, load up the file and run it.

> Could you also try this?
> #lang racket (require plot racket/flonum unstable/flonum) (plot
> (function sqrt 0 (* 40 +min.0))) (plot (function (compose flsqrt
> exact->inexact) 0 (* 40 +min.0)))
> Both plots should be identical and look like staircases.

This works and I get the two identical staircases. Further selecting
an area to zoom in to and back out works as well. On a closer
inspection I notice that some of the vertical parts of the stairs are
slanted after zooming in (will send screenshots privately).

> The thing is, the error shouldn't be happening at all. As far as I
> can tell, it happens because at least one surface normal of a
> polygon that makes up the plot has a +nan.0 in it.
> That *could* happen if your machine's floating-point processor is
> pretty b0rked - for example, if it returned +nan.0 for square roots
> of very small numbers. (Or possibly Racket on your machine, for
> some reason, computes things like that wrongly.) Have you had
> floating-point problems with anything else?

Not that I have noticed. Also the numeric tests seem to complete
without any errors.

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


Posted on the dev mailing list.