Convert decimal number to rational: Difference between revisions

→‎{{header|Raku}}: Fix comment: Perl 6 --> Raku
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
(→‎{{header|Raku}}: Fix comment: Perl 6 --> Raku)
Line 2,145:
=={{header|Raku}}==
(formerly Perl 6)
Decimals are natively represented as rationals in Perl 6Raku, so if the task does not need to handle repeating decimals, it is trivially handled by the <tt>.nude</tt> method, which returns the numerator and denominator:
<lang perl6>say .nude.join('/') for 0.9054054, 0.518518, 0.75;</lang>
{{out}}
2,392

edits