rounding numbers and converting to string (hiding scientific notation)
#4
on second look, the code doesn't look right
it's a bit messy to try and figure out, why don't you give the following a try
Code: (Select All)
Declare Library
    Function sstr& Alias "snprintf" (Dest As String, Byval l As Long, frmt As String, Byval x As Single)
    Function dstr& Alias "snprintf" (Dest As String, Byval l As Long, frmt As String, Byval x As Double)
End Declare
n! = .3123456!
dp% = 2
value$ = Spc(64) + Chr$(0)
frmt$ = "%." + _Trim$(Str$(dp%)) + "g" + Chr$(0)
ok& = sstr&(value$, 62, frmt$, n!)
Print value$
Reply


Messages In This Thread
RE: rounding numbers and converting to string (hiding scientific notation) - by Jack - 07-18-2022, 07:06 PM



Users browsing this thread: 5 Guest(s)