Saturday, January 7, 2023

Casio fx-9750GIII: Decimal Expansion of a Fraction

Casio fx-9750GIII:  Decimal Expansion of a Fraction


Introduction - Happy New Year!


The program DEC21 finds a decimal expansion of a positive fraction.  This program is based on Barry Kissane's DECIMAL program from "Programming Your Calculator: Casio fx-7400G Plus" (see source below).  



Casio fx-9750GIII Program:  DEC21

244 bytes


"2022-11-22 EWS"

"FRACTION EXPANSION"

"NUM.(>0) "?→N

"DEN.(>0) "?→X

Int log (N/X)+1→T

ClrText

Locate 1,2,N

Locate 13,2,"÷"

Locate 1,3,X

Locate 13,3,"≈"


For 1→I To 21

If T=0

Then 

Locate I,5,"."

I+1→I

IfEnd

Int (N÷X)→D

10*(N-D×X)→N

Locate I,5,D

T-1→T

Next

Locate 18,1,"   "


Note:  the approximate symbol, ≈, is found in the CHAR menu.


Examples:


Example 1:

558/127


NUM:  558

DEN:  127


Result:

558 ÷

127 ≈


4.3937007874015748031



Example 2:

5/27


NUM: 5

DEN: 27


5  ÷

27  ≈


0.1851851851851851851


Here's to a great 2023!



Source


Kissane, Barry.  Programming Your Calculator: Casio fx-7400G Plus. Chatswood NSW, Australia, 2000. ISBN 0 9758302 0 3.   


Eddie



Remember, my regular posting schedule for January and February 2023 is on Saturdays only. 


All original content copyright, © 2011-2023.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


RCL 40 Book On Sale

RCL 40 Book On Sale The fantastic book, RCL 40: Recollection, Reinvention, & HP Calculators , edited by W.A.C. Mier-Jedrezejowic, Ph. D,...