Convert decimal number to rational: Difference between revisions

Content added Content deleted
Line 2,750: Line 2,750:


=={{header|RPL}}==
=={{header|RPL}}==
From HP-48 versions, conversion can be directly acheived with the <code>→Q</code> instruction. HP- models shall use instaed the following code, which is based on continuous fractions.
Starting with HP-48 versions, the conversion can be performed directly with the <code>→Q</code> instruction. Earlier versions must instead use the following code, which is based on continued fractions.
{{works with|Halcyon Calc|4.2.8}}
{{works with|Halcyon Calc|4.2.8}}
{| class="wikitable"
{| class="wikitable"
Line 2,769: Line 2,769:
"'" OVER RE sign * →STR + "/" +
"'" OVER RE sign * →STR + "/" +
SWAP IM →STR + STR→
SWAP IM →STR + STR→
≫ ≫ '<span style="color:blue">'''→PQ'''</span>' STO'' STO
≫ ≫ '<span style="color:blue">→PQ</span>' STO
|
|
<span style="color:blue">'''→PQ'''</span> ''( x → 'p/q' ) ''
<span style="color:blue">'''→PQ'''</span> ''( x → 'p/q' ) ''