Posted: Tue Mar 25, 2003 11:41 am
Restored from previous forum. Originally posted by geoff.
History
25th March 2003 : Version 3.62
- Fixed: Val(): now accepts any BASIC valid forms
And on testing I see Fred has also fixed ValF() Thanks fred.
a$="-1.234e-19rubbish"
a.f=ValF(a$)
This now gives the right answer.
If you want to display large and small numbers like this, you could use my version of StrF() below. If anyone finds a bug in this routine, please post a reply.
History
25th March 2003 : Version 3.62
- Fixed: Val(): now accepts any BASIC valid forms
And on testing I see Fred has also fixed ValF() Thanks fred.
a$="-1.234e-19rubbish"
a.f=ValF(a$)
This now gives the right answer.
If you want to display large and small numbers like this, you could use my version of StrF() below. If anyone finds a bug in this routine, please post a reply.
Code: Select all
Procedure.s zstrf(a.f,n.l)
; Convert float to string with n digits precision
a$=""
If ab:ProcedureReturn("O/F"):EndIf
b=1/b
If a8:n=8:EndIf;max float accuracy
b=1:For i.l=1 To n:b=b*10:Next i
e.l=0
While a>=b:a/10:e+1:Wend
b=b/10
While a=0 And e-n And e1:a$=a$+".":EndIf
a$+Right(Str(i),n-1)
i=e+n-1
If i<0
a$+"E-"+RSet(Str(-i),2,"0")
Else
a$+"E+"+RSet(Str(i),2,"0")
EndIf
EndIf
ProcedureReturn a$
EndProcedure