Skip to content

Commit 5c7ff9f

Browse files
committed
Fixes links and reflows
1 parent 532a039 commit 5c7ff9f

File tree

1 file changed

+31
-25
lines changed

1 file changed

+31
-25
lines changed

doc/Language/numerics.pod6

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ L<Failure>, while L<Complex> division by zero produces C<NaN> components,
275275
regardlesss of what the numerator is.
276276
277277
As of 6.d language, both L<Num> and L<Complex> division by zero will produce
278-
a L<-Inf>, L<+Inf>, or L<NaN> depending on whether the numerator was negative, positive, or zero, respectively (for L<Complex> the real and imaginary
278+
a -L<Inf|/type/Num#Inf>, C<+Inf>, or L<NaN> depending on whether the numerator was negative, positive, or zero, respectively (for L<Complex> the real and imaginary
279279
components are L<Num> and are considered separately).
280280
281281
Division of L<Int> numerics produces a L<Rat> object (or a L<Num>, if
@@ -553,9 +553,10 @@ say my uint8 @a = 1000, 2000, 3000; # OUTPUT: «232 208 184␤»
553553
554554
=head2 Auto-Boxing
555555
556-
While they can be referred to as "native I<types>", native numerics are not actually classes
557-
that have any sort of methods available. However, you I<can> call any of the methods available
558-
on non-native versions of these numerics. What's going on?
556+
While they can be referred to as "native I<types>", native numerics are not
557+
actually classes that have any sort of methods available. However, you I<can>
558+
call any of the methods available on non-native versions of these numerics.
559+
What's going on?
559560
560561
=begin code
561562
my int8 $x = -42;
@@ -595,10 +596,11 @@ my int $a-native = -42;
595596
596597
=head2 Default Values
597598
598-
Since there are no classes behind native types, there are no type objects you'd normally get
599-
with variables that haven't been initialized. Thus, native types are automatically initialized
600-
to zero. In 6.c language, native floating point types (C<num>, C<num32>, and C<num64>) are
601-
initialized to value C<NaN>; it is proposed for default to become C<0e0> in 6.d language.
599+
Since there are no classes behind native types, there are no type objects you'd
600+
normally get with variables that haven't been initialized. Thus, native types
601+
are automatically initialized to zero. In 6.c language, native floating point
602+
types (C<num>, C<num32>, and C<num64>) are initialized to value C<NaN>; it is
603+
proposed for default to become C<0e0> in 6.d language.
602604
603605
=head2 Native Dispatch
604606
@@ -656,26 +658,30 @@ say f $x;
656658
# in block <unit> at -e line 1
657659
=end code
658660
659-
However, this rule is waived if a call is being made where one of the arguments is a native type
660-
and another one is a L<numeric literal>:
661+
However, this rule is waived if a call is being made where one of the arguments
662+
is a native type and another one is a
663+
L<numeric literal|/syntax/Number literals>:
661664
662665
=begin code
663666
multi f(int, int) {}
664667
f 42, my int $x; # Successfull call
665668
=end code
666669
667-
This way you do not have to constantly write, for example, C«$n +> 2» as C«$n +> (my int $ = 2)».
668-
The compiler knows the literal is small enough to fit to a native type and converts it to a native.
670+
This way you do not have to constantly write, for example, C«$n +> 2» as C«$n +>
671+
(my int $ = 2)». The compiler knows the literal is small enough to fit to a
672+
native type and converts it to a native.
669673
670674
=head2 Atomic Operations
671675
672676
The language offers L<some operations|https://docs.perl6.org/type/atomicint>
673677
that are guaranteed to be performed atomically, i.e. safe to be executed
674678
by multiple threads without the need for locking with no risk of data races.
675679
676-
For such operations, the L<atomicint> native type is required. This type is
677-
similar to a plain native L<int>, except it is sized such that CPU-provided atomic operations can be performed upon it. On a 32-bit CPU it will typically
678-
be 32 bits in size, and on an a 64-bit CPU it will typically be 64 bits in size.
680+
For such operations, the L<atomicint|/type/atomicint> native type is required.
681+
This type is similar to a plain native L<int|/type/int>, except it is sized such
682+
that CPU-provided atomic operations can be performed upon it. On a 32-bit CPU it
683+
will typically be 32 bits in size, and on an a 64-bit CPU it will typically be
684+
64 bits in size.
679685
680686
=begin code
681687
# !!WRONG!! Might be non-atomic on some systems
@@ -696,23 +702,23 @@ multi-dispatch.
696702
697703
=head1 Numeric Infectiousness
698704
699-
Numeric "infectiousness" dictates the resultant type when two numerics of different types are
700-
involved in some mathematical operations. A type is said to be more infectious than the other type
701-
if the result is of that type rather than the type of the other operand. For example, L<Num>
702-
type is more infectious than an L<Int>, thus we can expect C<42e0 + 42> to produce a L<Num> as the
703-
result.
705+
Numeric "infectiousness" dictates the resultant type when two numerics of
706+
different types are involved in some mathematical operations. A type is said to
707+
be more infectious than the other type if the result is of that type rather than
708+
the type of the other operand. For example, L<Num> type is more infectious than
709+
an L<Int>, thus we can expect C<42e0 + 42> to produce a L<Num> as the result.
704710
705711
The infectiousness is as follows, with the most infectious type listed first:
706712
707-
=item * Complex
713+
=item Complex
708714
709-
=item * Num
715+
=item Num
710716
711-
=item * FatRat
717+
=item FatRat
712718
713-
=item * Rat
719+
=item Rat
714720
715-
=item * Int
721+
=item Int
716722
717723
=begin code
718724
say (2 + 2e0).^name; # Int + Num => OUTPUT: «Num␤»

0 commit comments

Comments
 (0)