[racket] TR: predicate for a Float ?

From: John Clements (clements at brinckerhoff.org)
Date: Fri Jan 6 11:39:38 EST 2012

On Jan 5, 2012, at 5:30 PM, Sam Tobin-Hochstadt wrote:

> On Fri, Jan 6, 2012 at 1:00 AM, John Clements <clements at brinckerhoff.org> wrote:
>> 
>> Examining the difference between Inexact-Real and Float yields this:
>> 
>>> (:type Float)
>> (U Float-Positive-Zero Float-Negative-Zero Float-Nan Positive-Float Negative-Float)
>>> (:type Inexact-Real)
>> (U Float-Positive-Zero Float-Negative-Zero Float-Nan Positive-Float Negative-Float Single-Flonum-Positive-Zero Single-Flonum-Negative-Zero Single-Flonum-Nan Positive-Single-Flonum Negative-Single-Flonum)
>> 
>> ...which actually made me laugh out loud.  Is there a predicate I can use instead of 'inexact-real?' that checks whether a number belongs to the type Float?
> 
> You can use `flonum?' as the predicate for `Float', which excludes
> single-precision floats.  But why do you want to exclude them?

I have no desire to exclude them. After inspecting the expansion of various types such as Real, I concluded that Float was the term for a floating-point representation, but clearly I was mistaken. I have to say, the numeric tower in TR is ... impressive.  :)

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4624 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20120106/22832fb0/attachment.p7s>

Posted on the users mailing list.