Convert decimal number to rational: Difference between revisions

Content added Content deleted
(Added Delphi example)
(Added Quackery.)
Line 2,173: Line 2,173:
[1] "157/50"
[1] "157/50"
</pre>
</pre>

=={{header|Quackery}}==

Using the Quackery big number rational arithmetic library <code>bigrat.qky</code>.

<lang Quackery>[ $ "bigrat.qky" loadfile ] now!

[ dup echo$
say " is "
$->v drop
dup 100 > if
[ say "approximately "
proper 100 round
improper ]
vulgar$ echo$
say "." cr ] is task ( $ --> )

$ "0.9054054 0.518518 0.75" nest$ witheach task</lang>

{{out}}

<pre>0.9054054 is approximately 67/74.
0.518518 is approximately 14/27.
0.75 is 3/4.</pre>


=={{header|Racket}}==
=={{header|Racket}}==