Skip to content

Commit

Permalink
Fix some typos and wording
Browse files Browse the repository at this point in the history
  • Loading branch information
uzluisf committed Jun 2, 2018
1 parent 1e3a7af commit e34029e
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions doc/Language/numerics.pod6
Expand Up @@ -60,16 +60,16 @@ to have the extra precision.
The L<Num> type offers
L<double-precision floating-point|https://en.wikipedia.org/wiki/Double-precision_floating-point_format> decimal numbers, sometimes called "doubles" in other languages.
A L<Num> literal is written with the exponent separated using letter C<e>. Keep
in mind that letter C<e> B<is required> even if the exponent is zero, as
A L<Num> literal is written with the exponent separated using the letter C<e>. Keep
in mind that the letter C<e> B<is required> even if the exponent is zero, as
otherwise you'll get a L<Rat> rational literal instead:
=begin code
say 42e0.^name; # OUTPUT: «Num␤»
say 42.0.^name; # OUTPUT: «Rat␤»
=end code
Case-sensitive words L<Inf> and L<NaN> represent special values infinity and
Case-sensitive words L<Inf> and L<NaN> represent the special values infinity and
not-a-number respectively. The U+221E INFINITY (C<>) character can be used
instead of L<Inf>:
Expand Down Expand Up @@ -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
Expand All @@ -138,7 +138,7 @@ how-is-it 3+2i; # OUTPUT: «meh␤»
The types that do the L<Rational> role offer high-precision and
arbitrary-precision decimal numbers. Since the higher the precision the
larger the performance penalty, the L<Rational> types come in two flavours:
L<Rat> and L<FatRat>. The L<Rat> is the most oft-used variant
L<Rat> and L<FatRat>. The L<Rat> is the most often-used variant
that degrades into a L<Num> in most cases, when it can no longer hold all of
the requested precision. The L<FatRat> is the arbitrary-precision variant that
keeps growing to provide all of the requested precision.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<Rational> object in
For even more information, you may choose to see the L<Rational> object in
the L<nude>, displaying its B<nu>merator and B<de>nominator:
=begin code
Expand Down Expand Up @@ -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<Complex>, addition) can be written as a literal that doesn't
involve the use of an operator: angle brackets I<without> 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<Rat> or L<Complex> literal, but we also want it to be an allmorph: the L<RatStr> or
want a L<Rat> or L<Complex> literal, but we also want it to be an allomorph: the L<RatStr> or
L<ComplexStr>, in this case.
If the numeric literal doesn't use any operators, then writing it inside the angle brackets, even
Expand Down Expand Up @@ -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<hypering|/language/operators#Hyper_Operators> the appropraite prefix operator:
L<hypering|/language/operators#Hyper_Operators> the appropriate prefix operator:
=begin code
say map *.^name, <42 50e0 100>; # OUTPUT: «(IntStr NumStr IntStr)␤»
Expand All @@ -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:
Expand All @@ -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␤»
Expand Down Expand Up @@ -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<my $y; my $z; sub some-native-taking-sub(|c){}>
Expand Down Expand Up @@ -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<num>, C<num32>, and C<num64>) are initialized to value C<NaN>; 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
Expand Down

0 comments on commit e34029e

Please sign in to comment.