Code : Tout sélectionner
Procedure.S ISU(X.D)
S = Sign(X)
X = Abs(X)
Y = Log10(X)
Z = (Y + 8) / 3 + 1
ProcedureReturn StrD(X * Pow(10, 3 * (4 - Z) ) * S) + StringField("nano;micro;milli;;kilo;mega;giga", Z, ";")
EndProcedure
Code : Tout sélectionner
Define x.D
For i = 1 to 20
x = Random(999) * Pow(10, Random(18) - 9)
Debug StrD(x) + " " + ISU(x)
Next