<div dir="ltr">While +nan.0 is not a Rational, it is a perfectly valid Number so it sort of tickled the question as to whether the intent of '~r' is as a Number formatting procedure or as a Rational formatting procedure. Was just double (no pun intended) checking intent. I could see it going either way.<div>
<br></div><div>Thanks,</div><div><br>Ray</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Mar 4, 2013 at 2:24 PM, Ryan Culpepper <span dir="ltr"><<a href="mailto:ryanc@ccs.neu.edu" target="_blank">ryanc@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The contract for '~r' deliberately excludes +nan.0, +inf.0, etc---that's why it's 'rational?' and not 'real?'. The point of '~r' is to provide numeric formatting options, none of which apply to +nan.0, etc.<br>
<br>
Ryan<div><div class="h5"><br>
<br>
<br>
On 03/04/2013 01:26 PM, Ray Racine wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Currently the `~r' format routine, which accepts rationals, barfs on<br>
+nan.0 and siblings, which are not rationals. My current use case is<br>
simply displaying sub-ranges of vectors of flonums. It is not a problem<br>
to check for +nan.0 and explicitly display it. I was just wanted to toss<br>
it out as a don't know what is the "right thing" for the `~r' format<br>
routine to do here.<br>
<br>
> (define: x : Flonum +nan.0)<br>
> (define: y : Flonum 3.145962)<br>
> (~r y)<br>
- : String<br>
"3.145962"<br>
> (~r x)<br>
~r: contract violation<br>
expected: rational?<br>
given: +nan.0<br>
...<br>
<br>
<br>
<br></div></div>
____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/<u></u>users</a><br>
<br>
</blockquote>
<br>
</blockquote></div><br></div>