Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,24 @@
|
|||
Procedure.i ggT(a.i, b.i)
|
||||
Define t.i : If a < b : Swap a, b : EndIf
|
||||
While a%b : t=a : a=b : b=t%a : Wend : ProcedureReturn b
|
||||
EndProcedure
|
||||
|
||||
Procedure.s Dec2Rat(dn.d)
|
||||
Define nk$, gt.i, res$
|
||||
nk$=Trim(StringField(StrD(dn),2,"."),"0")
|
||||
gt=ggT(Val(nk$),Int(Pow(10.0,Len(nk$))))
|
||||
res$=Str(Val(nk$)/gt)+"/"+Str(Int(Pow(10.0,Len(nk$)))/gt)
|
||||
ProcedureReturn res$
|
||||
EndProcedure
|
||||
|
||||
OpenConsole()
|
||||
Define d.d
|
||||
Repeat
|
||||
Read.d d : If Not (d>0.0 And d<1.0) : Break : EndIf
|
||||
Print(LSet(StrD(d),15," ")+" -> "+#TAB$+Dec2Rat(d)+#CRLF$)
|
||||
ForEver
|
||||
Input() : End
|
||||
|
||||
DataSection
|
||||
Data.d 0.9054054,0.518518,0.75,0.0
|
||||
EndDataSection
|
||||
Loading…
Add table
Add a link
Reference in a new issue