Link to home
Start Free TrialLog in
Avatar of LuckyLucks
LuckyLucks

asked on

memorymap in visual studio

Hi

In visual studio, memoryMap shows values in 32 bit foat, unsigned int, int etc. However, if you convert from a 32 bit float to an int, how come the final value of the number looks so different?

How come 1.0863247e+009 float looks not 1 if i change the viewing format to int? I know the bits are stored differenty for float, ints - but is there a view for the memoryPane to display the numbers in a way that casting of one format to another works?
Avatar of sarabande
sarabande
Flag of Luxembourg image

How come 1.0863247e+009 float looks not 1 if i change the viewing format to int?
e+009 means *10^9. so the integer result is 10863247 and not 1.

a float is 32 bit and has 3 components: sign, exponent, mantissa . a very good explanation of the IEEE format is at http://steve.hollasch.net/cgindex/coding/ieeefloat.html

since sign is 1 bit, exponent is 8 bit and mantissa is 23 bit we may have odd numbers when looking at them as bytes (8-bit) or integer (8, 16 or 32 bit). because of that 'casting' a float to an int actually is not to look differently to bit sequences but is a conversion and can't be done easily in a hex viewer.

Sara
Avatar of LuckyLucks
LuckyLucks

ASKER

is there a way to interpret the integer being displayed in the memory pane's hex viewer?  I can read off the integer and use a third party tool to convert it ?
ASKER CERTIFIED SOLUTION
Avatar of sarabande
sarabande
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial