Implicit type conversion: Difference between revisions

Content added Content deleted
(Added Idris task)
m (→‎{{header|Perl 6}}: update to ease automated testing)
Line 669: Line 669:
(A normal Rat number has a denominator that is limited to 64 bits, with underflow to floating point to prevent performance degradation; a FatRat, in contrast, has an unlimited denominator size, and can chew up all your memory if you're not careful.)
(A normal Rat number has a denominator that is limited to 64 bits, with underflow to floating point to prevent performance degradation; a FatRat, in contrast, has an unlimited denominator size, and can chew up all your memory if you're not careful.)


<lang perl6>$x = (-1).sqrt; say $x, ' ', $x.WHAT; # NaN (Num)
<lang perl6>my $x;
$x = (-1).sqrt; say $x, ' ', $x.WHAT; # NaN (Num)
$x = (-1).Complex.sqrt; say $x, ' ', $x.WHAT; # 6.12323399573677e-17+1i (Complex)
$x = (-1).Complex.sqrt; say $x, ' ', $x.WHAT; # 6.12323399573677e-17+1i (Complex)