Irrational number data type

Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
Reply

Join Date: Jun 2006
Posts: 263
Reputation: Mushy-pea is an unknown quantity at this point 
Solved Threads: 1
Mushy-pea's Avatar
Mushy-pea Mushy-pea is offline Offline
Posting Whiz in Training

Irrational number data type

 
0
  #1
Sep 29th, 2006
Hello everyone. I am planning to write a program, part of which will be able to calculate the value of an irrational number to an unlimited number of places. I will probably use a C++ class to implement a custom array to store these numbers. However, I need to know a couple of things about floating point values first:

1. If you have declared a standard "float" type variable in C and initialised it with a value, how do you know how many bits have been used for the exponent and how many for the modulus?

2. If you store 0.8743 (for example) in a float, are the four decimal digits after the point stored in the modulus in decimal form i.e.:

1000 0111 0100 0011

--8-----7-----4-----3---


Or is some other system used? Any answers would be appriciated.

Steven.
Last edited by Mushy-pea; Sep 29th, 2006 at 8:40 am. Reason: Mistakes.
The one question you should not ask when teaching a new language structure is "Do you understand?". Do you understand?
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,055
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: Irrational number data type

 
2
  #2
Sep 29th, 2006
See http://en.wikipedia.org/wiki/IEEE_754 for information on how float and double are typically implemented.
All my posts may be redistributed under the GNU Free Documentation License.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1318 | Replies: 1
Thread Tools Search this Thread



Tag cloud for Computer Science
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC