diff --git a/doc/Language/numerics.pod6 b/doc/Language/numerics.pod6 index de03f241d..c960e51cc 100644 --- a/doc/Language/numerics.pod6 +++ b/doc/Language/numerics.pod6 @@ -60,8 +60,8 @@ to have the extra precision. The L type offers L decimal numbers, sometimes called "doubles" in other languages. -A L literal is written with the exponent separated using letter C. Keep -in mind that letter C B even if the exponent is zero, as +A L literal is written with the exponent separated using the letter C. Keep +in mind that the letter C B even if the exponent is zero, as otherwise you'll get a L rational literal instead: =begin code @@ -69,7 +69,7 @@ say 42e0.^name; # OUTPUT: «Num␤» say 42.0.^name; # OUTPUT: «Rat␤» =end code -Case-sensitive words L and L represent special values infinity and +Case-sensitive words L and L represent the special values infinity and not-a-number respectively. The U+221E INFINITY (C<∞>) character can be used instead of L: @@ -112,7 +112,7 @@ say 73+Inf\i; # OUTPUT: «73+Inf\i␤» =end code Keep in mind the above syntax is just an addition expression and precedence -rules apply. It also cannot be used in places that forbit expressions, such +rules apply. It also cannot be used in places that forbid expressions, such as literals in routine parameters. =begin code @@ -138,7 +138,7 @@ how-is-it 3+2i; # OUTPUT: «meh␤» The types that do the L role offer high-precision and arbitrary-precision decimal numbers. Since the higher the precision the larger the performance penalty, the L types come in two flavours: -L and L. The L is the most oft-used variant +L and L. The L is the most often-used variant that degrades into a L in most cases, when it can no longer hold all of the requested precision. The L is the arbitrary-precision variant that keeps growing to provide all of the requested precision. @@ -177,7 +177,7 @@ say 1.1/4.2; # OUTPUT: «0.261905␤» =end code Keep in mind the above syntax is just a division expression and precedence -rules apply. It also cannot be used in places that forbit expressions, such +rules apply. It also cannot be used in places that forbid expressions, such as literals in routine parameters. =begin code @@ -254,7 +254,7 @@ say 1.0.perl; # OUTPUT: «1.0␤» say ⅓.perl; # OUTPUT: «<1/3>␤» =end code -For even more information, you may choose see the L object in +For even more information, you may choose to see the L object in the L, displaying its Bmerator and Bnominator: =begin code @@ -351,7 +351,7 @@ accidental. Numerics that are often written using an operator, such as C<1/2> (L division operator) and C<1+2i> (L, addition) can be written as a literal that doesn't involve the use of an operator: angle brackets I any spaces between the brackets and the characters inside. By adding spaces within the brackets, we tell the compiler that not only we -want a L or L literal, but we also want it to be an allmorph: the L or +want a L or L literal, but we also want it to be an allomorph: the L or L, in this case. If the numeric literal doesn't use any operators, then writing it inside the angle brackets, even @@ -417,7 +417,7 @@ say <1/99999999999999999999>.FatRat.^name; # OUTPUT: «FatRat␤» =end code A handy way to coerce a whole list of allomorphs is by -L the appropraite prefix operator: +L the appropriate prefix operator: =begin code say map *.^name, <42 50e0 100>; # OUTPUT: «(IntStr NumStr IntStr)␤» @@ -428,7 +428,7 @@ say map *.^name, ~«<42 50e0 100>; # OUTPUT: «(Str Str Str)␤» =head2 Object Identity The above discussion on coercing allomorphs becomes more important when we consider object -identity. Some constructs untilize it to ascertain whether two objects are "the same". And while +identity. Some constructs utilize it to ascertain whether two objects are "the same". And while to humans an allomorphic C<42> and regular C<42> might appear "the same", to those constructs, they're entirely different objects: @@ -441,7 +441,7 @@ say unique :with(&[==]), 1, 1, 1, 42, <42>; # OUTPUT: «(1 42)␤» say unique :as(*.Int), 1, 1, 1, 42, <42>; # OUTPUT: «(1 42)␤» say unique +«(1, 1, 1, 42, <42>); # OUTPUT: «(1 42)␤» -# Parametarized Hash with `Any` keys does not stringify them; our key is of type `Int`: +# Parameterized Hash with `Any` keys does not stringify them; our key is of type `Int`: my %h{Any} = 42 => "foo"; # But we use the allomorphic key of type `IntStr`, which is not in the Hash: say %h<42>:exists; # OUTPUT: «False␤» @@ -515,7 +515,7 @@ class { has int8 $.z } =end code At times, you may wish to coerce some value to a native type without creating any usable variables. -There are no C<.int> or similar coersion methods (method calls are latebound, so they're not +There are no C<.int> or similar coercion methods (method calls are latebound, so they're not well-suited for this purpose). Instead, simply use an anonymous variable: =begin code :preamble @@ -610,7 +610,7 @@ Since there are no classes behind native types, there are no type objects you'd normally get with variables that haven't been initialized. Thus, native types are automatically initialized to zero. In 6.c language, native floating point types (C, C, and C) are initialized to value C; it is -proposed for default to become C<0e0> in 6.d language. +proposed to become C<0e0> by default in 6.d language. =head2 Native Dispatch