Computing.Net > Forums > Programming > Floating point format

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Floating point format

Reply to Message Icon

Name: manojkumar.paul
Date: August 7, 2007 at 07:06:17 Pacific
OS: Win-2000
CPU/Ram: 512
Product: Intel
Comment:

hello friends,
Help! Please help me out, what is the process of solving this problem, what should I do?

Using the floating point format convert the floating point number represented by 11000100110101101111010011010000 to base 10 (decimal) representation where,
Sign bit = negative = 1
Base 2
8-bit
excess-128 exponent
23 bits of mantissa

Thanks..

Manoj Kumar Paul
Software Developer
Java



Sponsored Link
Ads by Google

Response Number 1
Name: Guy
Date: August 7, 2007 at 09:58:12 Pacific
Reply:

I am going to assume that is IEEE 754 format.

And that you are working in Java, at least 1.5.

So I think it is pretty easy:

long along = Long.parseLong("11000100110101101111010011010000",2);
float afloat = Float.intBitsToFloat( (int)along );
System.out.println("along= " + along);
System.out.println("afloat= " + afloat);

You might also take a look at:

http://en.wikipedia.org/wiki/IEEE_754



0

Response Number 2
Name: Razor2.3
Date: August 7, 2007 at 20:20:59 Pacific
Reply:

Basically, you do what we did for the floating point numbers, only backwards:
Step 0:
1 10001001 10101101111010011010000 becomes:
Sign = 1
e = 10001001
s = 10101101111010011010000
Answer = ?

Step 1: Convert the 'e' to base-10, add the "1." to the front of the 's'.
e = 137 - 127 (b10)
s = 1.1010110111101001101
Answer = -?

Step 2: e = e - 127
e = 10 (b10)
s = 1.1010110111101001101
Answer = -?

Step 3: Move the '.' e number of spaces.
s = 11010110111.101001101
Answer = -?

Step 4: Our answer (in base-2)
Answer = -11010110111.101001101(b2)

Step 5: base-2 -> base-10
Answer = -(1719 + 2^-1 + 2^-3 + 2^-6 + 2^-7 + 2^-9) = -1719.650390625


0

Response Number 3
Name: manojkumar.paul
Date: August 7, 2007 at 22:24:56 Pacific
Reply:

Is -1719.650390625 the final answer to the question?

Manoj Kumar Paul
Software Developer
Java


0

Response Number 4
Name: manojkumar.paul
Date: August 7, 2007 at 22:44:43 Pacific
Reply:

Thank you Razor,

Is -1719.650390625 the final answer to the question?

Thanx once again.

Manoj Kumar Paul
Software Developer
Java


0

Response Number 5
Name: Razor2.3
Date: August 7, 2007 at 23:19:05 Pacific
Reply:

Well, VBA says so, so that's what I'm going with.


0

Related Posts

See More



Response Number 6
Name: manojkumar.paul
Date: August 7, 2007 at 23:46:05 Pacific
Reply:

Ok, Thanx a loads Razor

Manoj Kumar Paul
Software Developer
Java


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Floating point format

Floating point format www.computing.net/answers/programming/floating-point-format/15579.html

floating points www.computing.net/answers/programming/floating-points/2124.html

RDTSC With C www.computing.net/answers/programming/rdtsc-with-c/12038.html