[racket] Hexadecimal flonum input syntax confusing

From: William Cushing (william.cushing at gmail.com)
Date: Mon Nov 11 22:04:17 EST 2013

Allowing lower case for hex flonum literals is extremely confusing in the
context of the rest of the permitted syntax.

Consider:

> (list #b10s1 #b10l1 #b10d1 #b10e1 #b10f1)
'(4.0f0 4.0 4.0 4.0 4.0f0)
> (list #o10s1 #o10l1 #o10d1 #o10e1 #o10f1)
'(64.0f0 64.0 64.0 64.0 64.0f0)
> (list #d10s1 #d10l1 #d10d1 #d10e1 #d10f1)
'(100.0f0 100.0 100.0 100.0 100.0f0)

Up to here everything is gravy.  But then:

> (list #x10s1 #x10l1 #x10d1 #x10e1 #x10f1)
'(256.0f0 256.0 4305 4321 4337)

I wasted like an hour or so trying to figure out what was going on with the
last 3 cases before it finally hit me that "d", "e", and "f" are, of
course, valid hexadecimal digits, so can't be used for exponent markers.

It would be useful, I think, to add a note to the doc:

http://docs.racket-lang.org/reference/reader.html#%28part._parse-extflonum%29

"#x2e5

 reads equal to

741 (because "e" is a hex digit, and 741=2*16^2+15*16^1+5*16^0)"

-Will
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20131111/c4283c64/attachment.html>

Posted on the users mailing list.