Convert decimal number to rational: Difference between revisions
m
→{{header|TI SR-56}}: Terminology
m (→{{header|TI SR-56}}: Terminology) |
|||
Line 2,957:
|+ Register allocation
|-
| 0:
|-
| 5: Unused || 6: Unused || 7: Unused || 8: Unused || 9: Unused
Line 2,964:
Annotated listing:
<syntaxhighlight lang="text">
STO 0 //
0 STO 1 // Denominator := 0
*CP // RegT := 0
1 SUM 1 // Denominator += 1
RCL 1 * RCL 0 = Inv *Int // Find fractional part of
Inv *x=t 0 6 // If it is nonzero loop back to instruction 6
RCL 1 x<>t // Report denominator
Line 2,977:
'''Usage:'''
Enter the
{{in}}
Line 2,987:
After about five seconds, '''3''' will appear on the screen. Press x<>t and '''8''' will appear on the screen. The fraction is 3/8.
Any fraction with denominator <=100 is found in 1 minute or less. 100
=={{header|Vala}}==
|