(Again, this is really a language question. Sorry for the hopefully digestible use of internal symbols.)
Pugs currently has two numeric types: VInt - Arbitary sized integer VNum - Double-precision point number with NaN and Inf support. Division is done like this: pugs> ? 1 / 3 # VInt / VInt 0.3333333333333333 # VNum S02 wants it to be a VRat instead: * Perl 6 will intrinsically support big integers and rationals through its system of type declarations. Int automatically supports promotion to arbitrary precision. Rat supports arbitrary precision rational arithmetic... However, there is no mention in Apocalypses about Rat, and no other details in the Synopses either. It also seems that the builtin "Types" listed in S06 is missing at least "complex", "Complex" and "Rat". Without further information, my current approach is to adhere as close as possible to Scheme's Number Tower, as documented here: http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-9.html#%_sec_6.2 If my choice of emulating the Scheme number tower differs from Perl6's numeric semantics, please do let me know. By a OO point of view, it means that the multimethod of :infix</>, when taking two Int objects, will yield a Rat object. Furthermore, the tower's shape will look like this: class Int is Rat { ... } class Rat is Num { ... } class Num is Complex { ... } It is however not clear how a NaN of type Rat needs to behave in integer context: pugs> (0/0 .. 1/0) That is, do we need to preserve NaN and Inf at the "Int" (arbitary precision inteeger) level? Thanks, /Autrijus/
pgpGxGbTd6GN4.pgp
Description: PGP signature