Jump to content

Integer long division: Difference between revisions

m
→‎{{header|Raku}}: add some more edge condition test cases
No edit summary
m (→‎{{header|Raku}}: add some more edge condition test cases)
Line 45:
=={{header|Raku}}==
It's a built-in.
<lang perl6>for 0/1, 1/1, 1/3, 1/7, -83/60, 1/17, 10/13, 3227/555, 5**21/2**63, 1/149, 1/5261 -> $rat {
printf "%35s - Period is %-5s: %s%s\n", $rat.nude.join('/'), .[1].chars, .[0], (.[1].comb RZ~ "\c[COMBINING OVERLINE]" xx *).join
given $rat.base-repeating
}</lang>
{{out}}
<pre style="overflow:auto;white-space:revert;"> 10/1 - Period is 0 : 10
1/1 - Period is 0 : 1
1/3 - Period is 1 : 0.̅3
1/7 - Period is 6 : 0.̅1̅4̅2̅8̅5̅7
-83/60 - Period is 1 : -1.38̅3
1/17 - Period is 16 : 0.̅0̅5̅8̅8̅2̅3̅5̅2̅9̅4̅1̅1̅7̅6̅4̅7
10/13 - Period is 6 : 0.̅7̅6̅9̅2̅3̅0
10,327

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.