My Math Forum  

Go Back   My Math Forum > Science Forums > Computer Science

Computer Science Computer Science Forum


Reply
 
LinkBack Thread Tools Display Modes
October 21st, 2012, 03:45 AM   #1
Newbie
 
Joined: Oct 2012

Posts: 2
Thanks: 0

exercise problem IEEE 754 floating point

Hi Everyone,


I need some help on how to convert decimal numbers in to IEEE 754 (single) floating point notation.

For example, given a number 1995,5, then I do:
1995 to binary is 111 1100 1011
0,5 to binary is 0,1
Together we have: 111 1100 1011,1

After standardising, we have 1,11110010111 x 2^10(dec) and and then it's clear on howto convert it to IEEE 754.

But now I have an excercise like -0,000000012. How do you solve this kind of exercise manually. We may not use a calculator. I'm especially interested on how to standardize this number? For hours I've been searching for the answer with no result...

Any help would be great.

Best regards!
abdel is offline  
 
October 21st, 2012, 11:15 AM   #2
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 932

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: exercise problem IEEE 754 floating point

Exactly the same, but flip the sign bit.
CRGreathouse is offline  
October 22nd, 2012, 05:13 AM   #3
Newbie
 
Joined: Oct 2012

Posts: 2
Thanks: 0

Re: exercise problem IEEE 754 floating point

Quote:
Originally Posted by CRGreathouse
Exactly the same, but flip the sign bit.
It's not about the sign bit. Assume 0,000000012 without a sign. So what now? Exact the same?

0,000000012 x 2 = 0,000000024
0,000000012 x 2 = 0,000000048
0,000000012 x 2 = 0,000000072
0,000000012 x 2 = 0,000000144
0,000000012 x 2 = 0,000000288
0,000000012 x 2 = 0,000000576
0,000000012 x 2 = 0,000001152
0,000000012 x 2 = 0,000002304
...

You see, it's not the most pretty and quickest method. I would like to write 0,000000012 as a power of two, like 1,... x 2^n. (Preferably without using a calculator.)

Someone (else) ?
abdel is offline  
October 22nd, 2012, 05:28 AM   #4
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 932

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: exercise problem IEEE 754 floating point

If you know your powers of two, this is just the sum of adjacent powers of two (shifted appropriately). So you shouldn't need more than a single addition to see how far to shift it (and possibly a second if that was the wrong amount, to get the significand).
CRGreathouse is offline  
Reply

  My Math Forum > Science Forums > Computer Science

Tags
754, exercise, floating, ieee, point, problem



Search tags for this page
Click on a term to search for related topics.
Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
floating point numbers with modulus(mod) abady-1 Number Theory 5 September 21st, 2013 02:08 PM
Floating Point Notation... Primalscientist Computer Science 9 June 2nd, 2011 06:29 AM
Precision Arithmetic: A New Floating-Point Arithmetic Chengpu Real Analysis 3 June 2nd, 2010 11:37 AM
Precision Arithmetic: A New Floating-Point Arithmetic Chengpu Linear Algebra 0 May 23rd, 2010 04:55 PM
Floating Point Numbers - Single Precision Format (help!) RonnieStokie Algebra 3 December 12th, 2007 10:36 PM





Copyright © 2017 My Math Forum. All rights reserved.