@@ -13,8 +13,8 @@ Synopsis 2: Bits and Pieces
13
13
14
14
Created: 10 Aug 2004
15
15
16
- Last Modified: 18 Jun 2011
17
- Version: 234
16
+ Last Modified: 6 Jul 2011
17
+ Version: 235
18
18
19
19
This document summarizes Apocalypse 2, which covers small-scale
20
20
lexical items and typological issues. (These Synopses also contain
@@ -3256,6 +3256,22 @@ and maybe a trailing Units type for an implied scaling. Leading and
3256
3256
trailing whitespace is ignored. Note also that leading C<0> by itself
3257
3257
I<never> implies octal in Perl 6.
3258
3258
3259
+ In all these cases, the type produced will be the narrowest of Int,
3260
+ Rat, or Num that can accurately represent the number. If no type can
3261
+ represent it exactly, it should be returned as either a Rat or a Num,
3262
+ whichever is more accurate. (Rat64 will tend to be more accurate
3263
+ for numbers of normal or large magnitude, while Num64 may be more
3264
+ accurate for numbers of very small magnitude, since the Rat's size
3265
+ mismatch of numerator and denominator will eventually cost more
3266
+ accuracy than the Num's exponent overhead. As a limiting case,
3267
+ a Rat64 cannot represent any number smaller than :10<1*2**-64>.)
3268
+
3269
+ A consequence of the preceding is that you cannot make a FatRat using
3270
+ colon notation. You must rely on constructors and constant folding:
3271
+
3272
+ (FatRat.new(1,1) * 2 ** -128)
3273
+ FatRat.new(1, 2 ** 128) # same thing
3274
+
3259
3275
Any of the adverbial forms may be used as a function:
3260
3276
3261
3277
:2($x) # "bin2num"
0 commit comments