How to convert floating point number to hexadecimal representation

I am new VIsual Basic and need to learn how to convert a floating point number, declared as a single, to its internal hexadecimal representation (IEEE 754 32-bit representation). The hexadecimal number will then be transmitted across RS-232 to another controller which interprets the 32-bit hexadecimal data as single precision floating point.

As an example

Global float_input as Single

float_input = 2.5

desired hexadecimal output = &H 40200000

[481 byte] By [apunater] at [2007-12-24]
# 1

Are you trying to convert the Single value into a string, and then transmit the string across the RS-232 connection?

Best regards,
Johan Stenberg

MSJohanStenberg at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 2

Check out http://msdn2.microsoft.com/en-us/library/yhwsaf3w.aspx for some additional info that you may find useful...

Best regards,
Johan Stenberg

MSJohanStenberg at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 3

Thanks...

This is exactly what I was looking for...

apunater at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...