by David M. Lewis (4 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 2nd August 2007
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Convert large binary strings into large decimal values. Stand-alone function.
'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
No comments have been posted about Convert large binary strings into large decimal values. Stand-alone function.. Why not be the first to post a comment about Convert large binary strings into large decimal values. Stand-alone function..