<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 &#39;~r&#39; 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">&lt;<a href="mailto:ryanc@ccs.neu.edu" target="_blank">ryanc@ccs.neu.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The contract for &#39;~r&#39; deliberately excludes +nan.0, +inf.0, etc---that&#39;s why it&#39;s &#39;rational?&#39; and not &#39;real?&#39;. The point of &#39;~r&#39; 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&#39; 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&#39;t know what is the &quot;right thing&quot; for the `~r&#39; format<br>
routine to do here.<br>
<br>
 &gt; (define: x : Flonum +nan.0)<br>
 &gt; (define: y : Flonum 3.145962)<br>
 &gt; (~r y)<br>
- : String<br>
&quot;3.145962&quot;<br>
 &gt; (~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>