hello can you help fast ? tonight /
How do I convert a decimal number 23.125 to binary?
''''''''''''''''''
'by Rick Rothstein
''''''''''''''''''
Function DecToBin(ByVal DecimalIn As Variant, Optional NumberOfBits As
Variant) As String
' The DecimalIn argument is limited to 79228162514264337593543950266
' (approximately 96-bits) - large numerical values must be entered
' as a String value to prevent conversion to scientific notation.
DecToBin = "": DecimalIn = CDec(DecimalIn)
Do While DecimalIn < 0
DecToBin = Trim$(Str$(DecimalIn - 2 * Int(DecimalIn / 2))) &
DecToBin
DecimalIn = Int(DecimalIn / 2)
Loop
If Not IsMissing(NumberOfBits) Then
If Len(DecToBin) NumberOfBits Then
DecToBin = "Error - Number too large for bit size"
Else
DecToBin = Right$(String$(NumberOfBits, "0") & DecToBin,
NumberOfBits)
End If
End If
End Function
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic
VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com