07-09-2023, 06:10 PM
bplus, see what you get from the following
Code: (Select All)
Declare Library
Function snprintf& (Dest As String, Byval l As Long, frmt As String, Byval x As Double)
End Declare
Screen _NewImage(768, 768, 32)
_ScreenMove 0, 0
Cls
Locate 3, 1:
Color &HFF00FFFF~&&
Locate , 1: Print "c#";
Locate , 25: Print "c# + 1";
Print
Print
Color &HFFFF8000~&&
Print "c# = ... :": Color &HFFFFFFFF~&&
c# = 10#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 100#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 1000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 10000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 100000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 1000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 10000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 100000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 1000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 10000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 100000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 1000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 10000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 100000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 1000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 10000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 100000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 1000000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 10000000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 100000000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 1000000000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 10000000000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 100000000000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 1000000000000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 10000000000000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 100000000000000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 1000000000000000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 10000000000000000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 100000000000000000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
c# = 1000000000000000000000000000000#: Locate , 1: Print strf(c#);: Locate , 25: Print strf(c# + 1)
Print
Print
Function strf$ (x As Double)
Dim As String s
Dim As String frmt
Dim As Long l, ex, sign
sign = Sgn(x)
If sign < 0 Then x = -x
s = Spc(64)
frmt = "%.16g" + Chr$(0)
l = snprintf(s, Len(s), frmt, x)
s = _Trim$(s)
If InStr(s, ".") > 0 And Left$(s, 1) = "0" Then s = Mid$(s, 2)
If sign < 0 Then s = "-" + s Else s = " " + s
ex = InStr(s, "e")
If ex > 0 Then Mid$(s, ex, 1) = "F"
strf = s
End Function