Test integerness: Difference between revisions

Content deleted Content added
Thundergnat (talk | contribs)
Rename Perl 6 -> Raku, alphabetize, minor clean-up
SqrtNegInf (talk | contribs)
m →‎{{header|Raku}}: Fix comment: Perl 6 --> Raku
Line 1,947:
(formerly Perl 6)
 
In Perl 6Raku, all numeric types have a method called <tt>narrow</tt>, which returns an object with the same value but of the most appropriate type. So we can just check if ''that'' object is an <tt>Int</tt>. This works even with floats with large exponents, because the <tt>Int</tt> type supports arbitrarily large integers.
 
For the extra credit task, we can add another multi candidate that checks the distance between the number and it's nearest integer, but then we'll have to handle complex numbers specially.