Scientific Notation to Decimal Value
#1
I'm interested in knowing if there might be a different way to recalculate Scientific Notation into a decimal value. Here is the method I'm presently using which works ok with Single dimension arrays/variables but when the resultant value is zero I've been going back are Redim to Double or whatever can get me a decimal value other than zero.

Code: (Select All)
' Removing Scientific Notation from a Variable/Array of Single dimension


Dim Shared Number, x, y


'In the main module will be a calculation which generates a Scientifically Notated value

Number = 115 / 123456

Print Number

x = 115
y = 123456

Number = SNrid

Print Number

Function SNrid
    ScNote$ = Str$(x / y)
    If InStr(1, ScNote$, "E") Or InStr(1, ScNote$, "D") Then
        SNA = x / y
        a = SNA * 10000000
        b = a \ 1
        C = a - b
        If C >= .5 Then
            b = b + 1
            SNB = b * .0000001
        End If
        If C < .5 Then
            SNB = b * .0000001
        End If
        SNrid = SNB
        Exit Function
    End If
    SNrid = x / y

End Function
Reply


Messages In This Thread
Scientific Notation to Decimal Value - by Dimster - 03-26-2023, 03:12 PM



Users browsing this thread: 1 Guest(s)