Convert to Fraction

Description

Let's say you would like to know what 0.15625 as a fraction is.

You type: 0.15625 GSB 1.

The display shows "running" and then you see first 5 and ten sec later 32. The fraction is therefore 5/32 (numerator = 5 and denominator = 32). 32 remains in X (display) after the program finished and 5 remains in Y (type key x↔y to see it).

Program Resources

Labels

Name Description
 1 Main program
 9 Loop and test

Storage Registers

Name Description
 0 ABS number input
 1 Guess

Program

Line Display Key Sequence
000
001 42,21, 1 f LBL 1
002 43 16 g ABS
003 44 0 STO 0
004 1 1
005 44 1 STO 1
006 42,21, 9 f LBL 9
007 33 R⬇
008 15 1/x
009 44,20, 1 STO × 1
010 36 ENTER
011 43 44 g INT
012 30
013 4 4
014 16 CHS
015 13 10ˣ
016 43 10 g x≤y
017 22 9 GTO 9
018 45 0 RCL 0
019 45 1 RCL 1
020 43 44 g INT
021 20 ×
022 42 31 f PSE
023 43 36 g LSTΧ
024 43 32 g RTN