Thread: Basic question involving data types

  1. #1
    Codigious FingerPrint's Avatar
    Join Date
    Mar 2006

    Basic question involving data types

    I skipped around a lot in learning C++ and in doing so, I didnt comprehend things as good as I should have. I decided to start over, well almost over. I was looking at and in like the third section it talks about data types. I am having trouble understanding what something means. In the chart on the page it shows( the | just represent boxes):

    | double | Double precision floating point number. | 8bytes | 1.7e +/- 308 (15 digits) |
    What exactly does "1.7e +/- 308 (15 digits)" mean? More specificaly what does 1.7e mean? It also says 15 digits, does that just mean it can go 15 digits from 0 in either direction? Float and ong double are also like this.

    I get the rest of the chart, but that part confuses me.

    EDIT: I read ona little farther while waiting for an answer. I came across this:

    They express numbers with decimals and/or exponents. They can include either a decimal point, an e 
    character (that expresses "by ten at the Xth height", where X is an integer value that follows the 
    e character), or both a decimal point and an e character:
    After reading it, I think I know what e means now. Double( 1.7e +/- 308 ) would basically be 1.7 * 10 +/- 308. So its like...oh whats that called lol. Im thinkin exponents/ something else...hmmm...scientific notation. I honestly dont remember much about scientific notation, but thats what its making me think of. So, 1.7e +/- 308 is like the short way of writing out what 1.7 * 10 +/- 308? Stop me if im wrong lol.
    Last edited by FingerPrint; 10-30-2006 at 10:18 PM.
    /* ------------------------------------------------------------------*/
                               // INSERT CODE HERE
    /* ------------------------------------------------------------------*/

  2. #2
    Registered User Xeridanus's Avatar
    Join Date
    Oct 2006
    QLD, Aussieland
    1.7e +/- 308 has to do with the range a double can hold. from 1.7 * 10^308 to 1.7 * 10^-308, and of course the negatives of those numbers as well. a float/double cannot hold exactly 0 because of the way the data is stored in the computer. it is stored as sign-bit|exponent|base (in that order, next to each other). i forget the computer terms for exponent and base but one of them is mantissa. because a double cannot hold exactly 0, there is a gap either side of 0. sign-bit is 1 if the number is negative (0 otherwise, this is the same for ints), exponent is negative(the first bit of the exponent will be 1) if the number is smaller than 1 and base must always have 1 as the first bit.

    if this does not answer your question try looking up discrete mathematics for computing.

    EDIT: well looky here at what i found :P
    it might be a bit advanced. i didn't go looking for it, in fact i was looking for something else.
    Last edited by Xeridanus; 10-30-2006 at 10:56 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. basic question about global variables
    By radeberger in forum C++ Programming
    Replies: 0
    Last Post: 04-06-2009, 01:54 AM
  2. pthread question how would I init this data structure?
    By mr_coffee in forum C Programming
    Replies: 2
    Last Post: 02-23-2009, 12:42 PM
  3. Errors
    By Rhidian in forum C Programming
    Replies: 10
    Last Post: 04-04-2005, 01:22 PM
  4. Data types in Unicode
    By Garfield in forum Windows Programming
    Replies: 12
    Last Post: 10-28-2001, 10:48 AM
Website Security Test