Joke Collection Website - Blessing messages - How to convert single-precision floating-point numbers into decimal numbers
How to convert single-precision floating-point numbers into decimal numbers
Second, the transformation example in VB:
VB floating-point number conversion program
Use the function CopyMemory for OptionExplicit'' conversion.
PrivateDeclausebcopymorylib "kernel32" alias "rtlmovemory" (Destination Asany, SourceAsAny, ByValLengthAsLong).
DimFAsSingle'' decimal number
Ma Di (3) asbyte' 16 hexadecimal floating-point number
The private subcommand 1 _ click ()' is converted to decimal numbers.
A (0) = clng ("&h" & text 1 (3)。 Text)' 16 hexadecimal characters to numbers.
a( 1)= CLng(" & H " & text 1(2)。 Text)
a(2)= CLng(" & H " & text 1( 1)。 Text)
A(3)=CLng("&H"&Text 1(0)。 Text)
CopyMemoryF, A(0), 4' conversion
Text2.text = f' displays the result.
End joint
PrivateSubCommand2_Click ()' ()' is converted to floating-point number format.
F = val (text2.text)' Decimal characters to numbers.
CopyMemoryA(0), f, 4' conversion
Text 1 (0)。 Text = IIF (a (3) > 15, hexadecimal (a (3)), "0" & hexadecimal (A(3))' displays the results.
Text 1( 1)。 Text=IIf(A(2)> 15,Hex(A(2))," 0"&Hex(A(2)))
Text 1(2)。 Text=IIf(A( 1)> 15,Hex(A( 1))," 0"&Hex(A( 1)))
Text 1(3)。 Text=IIf(A(0)> 15,Hex(A(0))," 0"&Hex(A(0)))
End joint
Extended data:
Examples of transformation in C language:
Trade union f
{
floatf
unsigned chars[4];
} a;
floatm
Unsigned chart [4]
//Convert to decimal number
a . s[0]= 0x 5 1; //Low priority
a . s[ 1]= 0x 06;
a . s[2]= 0x9E;
a . s[3]= 0x3F;
m = a.f
//Convert to floating-point number format
a . f = m;
t[0]= a . s[0];
t[ 1]= a . s[ 1];
t[2]= a . s[2];
t[3]= a . s[3];
- Related articles
- How to use SMS to apply for CCB bill installment
- I can't receive the verification code of the compulsory course evaluation. Tell me what happened.
- Why can't I receive the verification code for the same trip?
- I'm waiting for you to make 68 sentences.
- Is the loan in Wechat business formal? What are the requirements for the application?
- Does sending a letter mean sending a notice?
- I accidentally ran a red light and never received a violation message.
- Do you need to reply if you are dissatisfied with the text messages sent by lawyers every minute?
- Conditions and process of housing mortgage loan
- How to switch applicants for Alipay Suzhou City Code?