Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to display a float number in scientific?
#8
Code: (Select All)

Declare Library
    Function snprintf& (Dest As String, Byval l As Long, frmt As String, Byval x As _Float)
End Declare

Dim As String * 20 result
Dim As String format
Dim As Long resultlen, flag
Dim As Single x

resultlen = Len(result) - 1
result = Space$(resultlen) + Chr$(0)
format = "%.2e" + Chr$(0)
x = 12345.6
flag = snprintf&(result, resultlen, format, x)
Print result

result = Space$(resultlen) + Chr$(0)
format = "%12.2e" + Chr$(0)
x = 12345.6
flag = snprintf&(result, resultlen, format, x)
Print result
Reply


Messages In This Thread
RE: How to display a float number in scientific? - by Jack - 08-04-2024, 05:15 PM



Users browsing this thread: 10 Guest(s)