miinaturvat Posted August 25, 2008 Report Posted August 25, 2008 hello I wish to write a program, preferably in C# but possibly VB, that when you enter a floating point value it gives you the hexadecimal representation of the float, and when you enter a hexidecimal number, it shows it's value as a float. E.g 0x41200000 is 10 as a float. But what is 0x41200001 as a float? I want my program to do work this out. Only problem is, I don't know how to do this! Could someone help me out? like provide bits of code or something? Thanks
SmokiestGrunl Posted August 25, 2008 Report Posted August 25, 2008 All you need to do is work out the math. Do you know how to work them out?
miinaturvat Posted August 26, 2008 Author Report Posted August 26, 2008 I have read up on IEEE 754 and sort of understand the math, but I don't know how to make a program do the math... Is there a simple way of doing it? Or maybe a class in C# that already does it?
SmokiestGrunl Posted August 26, 2008 Report Posted August 26, 2008 Well whats the math? if you don't want to say it publicly tell me in a PM.
miinaturvat Posted August 28, 2008 Author Report Posted August 28, 2008 Go here: http://www.h-schmidt.net/FloatApplet/IEEE754.html I want to do that, but in C#
SmokiestGrunl Posted August 28, 2008 Report Posted August 28, 2008 Its on the page. Conversion: The value of a IEEE-754 number is computed as:sign * 2exponent * mantissaThe sign is stored in bit 32. The exponent can be computed from bits 24-31 by subtracting 127. The mantissa (also known as significand or fraction) is stored in bits 1-23. An invisible leading bit (i.e. it is not actually stored) with value 1.0 is placed in front, then bit 23 has a value of 1/2, bit 22 has value 1/4 etc. As a result, the mantissa has a value between 1.0 and 2. If the exponent reaches -127 (binary 00000000), the leading 1 is no longer used to enable gradual underflow. Do you know how to set variables, use mod, the signs, etc?
miinaturvat Posted August 29, 2008 Author Report Posted August 29, 2008 Not very well... I think I understand it, but have never programmed anything involving mantissa and exponents or anything.
blacklabelfosho Posted August 29, 2008 Report Posted August 29, 2008 http://files.filefront.com/floatconvertzip...;/fileinfo.html love me forever 1
miinaturvat Posted August 30, 2008 Author Report Posted August 30, 2008 Thank you so much! I've been looking everywhere for this
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now