[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Questions on Scheme treatment of numbers
I have been browsing through the R3 report on Scheme, and have
become curious about some aspects of Scheme's treatment of numbers ...
(1) The syntax given for external representations of numbers
appears to require that exponents -- if present -- be in
radix 10, even when the rest of the number has been
explicitly declared to be in binary, octal or hex. My
first reaction was that this is probably an oversight:
Have I overlooked any obvious advantage or misread the
BNF?
(2) I think there is an abiguity in parsing hexadecimal
numbers: E. g., is #x1e2 to be interpreted as one times
sixteen to the power two (= 256), or as 1 * 256 + 14 * 16
+ 2 (= 482). (If so, it is probably best to prefer the
latter interpretation: a user who intends the former
can always provide a "+" sign (#x1e+2).)
(3) It looks as if there is no object foo for which
(number? foo) is #t but (complex? foo) is #f.
This might be a good hook for recognizing IEEE
floating-point INFs, or for other similar overflow
conditions. Any thoughts?
-- Jay Freeman