Convert large binary strings into large decimal values. Stand-alone function.
Convert large binary strings into large decimal values. Stand-alone function.
Rate Convert large binary strings into large decimal values. Stand-alone function.
(2(2 Vote))
'By David M. Lewis [email protected]
'Converts binary into decimal value. Up to 8-byte floating point (14 digit precision, exponent+-300)
'This code is free & public property.
Dim blen As Integer
Dim bloop As Integer
Dim decval As Double
Dim bitval As Double
blen = Len(indata)
bitval = 1 'First bit has max value of 1.
For bloop = 0 To (blen - 1) 'We read from right to left.
If Mid(indata, blen - bloop, 1) = "1" Then decval = decval + bitval
bitval = bitval * 2 'Value of each bit doubles after the first.
Next bloop
bin2dec = decval
End Function
Convert large binary strings into large decimal values. Stand-alone function. Comments
No comments yet — be the first to post one!
Post a Comment