[racket] Value Formatting ~r Routine and Non-Rational +nan.0

From: Ray Racine (ray.racine at gmail.com)
Date: Mon Mar 4 13:26:58 EST 2013

Currently  the `~r' format routine, which accepts rationals, barfs on
+nan.0 and siblings, which are not rationals.  My current use case is
simply displaying sub-ranges of vectors of flonums.  It is not a problem to
check for +nan.0 and explicitly display it. I was just wanted to toss it
out as a don't know what is the "right thing" for the `~r' format routine
to do here.

> (define: x : Flonum +nan.0)
> (define: y : Flonum 3.145962)
> (~r y)
- : String
> (~r x)
~r: contract violation
 expected: rational?
 given: +nan.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130304/d3fe1ffa/attachment.html>

Posted on the users mailing list.