Newbye quetion: Why a double can store more number than a long ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jose luis fernandez diaz

    Newbye quetion: Why a double can store more number than a long ?

    Hi,

    My OS is:

    cronos:jdiaz:tm p>uname -a
    HP-UX cronos B.11.11 U 9000/800 820960681 unlimited-user license


    I compile in 64-bits mode the program below:

    cronos:jdiaz:tm p>cat kk.C
    #include <iostream.h>
    #include <limits>

    int main()
    {
    long l_min = numeric_limits< long>::min();
    long l_max = numeric_limits< long>::max();
    double d_min = numeric_limits< double>::min();
    double d_max = numeric_limits< double>::max();
    cout << sizeof(long) << " " << sizeof(double) << endl;
    cout << l_min << " " << l_max << " " << d_min << " " << d_max <<
    endl;


    return 0;
    }
    cronos:jdiaz:tm p>a.out
    8 8
    -922337203685477 5808 922337203685477 5807 2.22507e-308 1.79769e+308



    The double and long types have the same size, but the double limits
    are bigger. Can anyone explein this to me ?

    Thanks,
    Jose Luis.
  • Lew Pitcher

    #2
    Re: Newbye quetion: Why a double can store more number than a long?

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    jose luis fernandez diaz wrote:[color=blue]
    > Hi,
    >
    > My OS is:
    >
    > cronos:jdiaz:tm p>uname -a
    > HP-UX cronos B.11.11 U 9000/800 820960681 unlimited-user license
    >
    >
    > I compile in 64-bits mode the program below:
    >
    > cronos:jdiaz:tm p>cat kk.C
    > #include <iostream.h>
    > #include <limits>
    >
    > int main()
    > {
    > long l_min = numeric_limits< long>::min();
    > long l_max = numeric_limits< long>::max();[/color]
    [snip]

    Well, since you are using a different language from C, we in the comp.lang.c
    newsgroup cannot assist you. Your question does not relate to C, and should be
    (presumably, from the crossposting, was) asked in a forum related to the
    language in which you wrote your example. This appears to be C++, so that forum
    would be comp.lang.c++.


    - --
    Lew Pitcher
    IT Consultant, Enterprise Application Architecture,
    Enterprise Technology Solutions, TD Bank Financial Group

    (Opinions expressed are my own, not my employers')
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.4 (MingW32)

    iD8DBQFAljf6agV FX4UWr64RAnujAJ wJ4mOsZZ9THxxul 4vwzrvTo/acYwCcDLiJ
    +EqfYBtEqbJjlf/u1b7p2DQ=
    =7HZL
    -----END PGP SIGNATURE-----

    Comment

    • Karl Heinz Buchegger

      #3
      Re: Newbye quetion: Why a double can store more number than a long ?

      jose luis fernandez diaz wrote:[color=blue]
      >
      > Hi,
      >
      > My OS is:
      >
      > cronos:jdiaz:tm p>uname -a
      > HP-UX cronos B.11.11 U 9000/800 820960681 unlimited-user license
      >
      > I compile in 64-bits mode the program below:
      >
      > cronos:jdiaz:tm p>cat kk.C
      > #include <iostream.h>
      > #include <limits>
      >
      > int main()
      > {
      > long l_min = numeric_limits< long>::min();
      > long l_max = numeric_limits< long>::max();
      > double d_min = numeric_limits< double>::min();
      > double d_max = numeric_limits< double>::max();
      > cout << sizeof(long) << " " << sizeof(double) << endl;
      > cout << l_min << " " << l_max << " " << d_min << " " << d_max <<
      > endl;
      >
      > return 0;
      > }
      > cronos:jdiaz:tm p>a.out
      > 8 8
      > -922337203685477 5808 922337203685477 5807 2.22507e-308 1.79769e+308
      >
      > The double and long types have the same size, but the double limits
      > are bigger. Can anyone explein this to me ?[/color]

      Well.

      1.79769E308

      does not mean that the number is accurate to the last digit. It means

      179769000000000 0000000....0000 00.....000000
      and the next smallest number is probably something like
      179768000000000 0000000....0000 00.....000000

      so there are large gaps between numbers. Those gaps get smaller when
      the numbers get smaller.

      --
      Karl Heinz Buchegger
      kbuchegg@gascad .at

      Comment

      • Jeff Schwab

        #4
        Re: Newbye quetion: Why a double can store more number than a long?

        jose luis fernandez diaz wrote:[color=blue]
        > Hi,
        >
        > My OS is:
        >
        > cronos:jdiaz:tm p>uname -a
        > HP-UX cronos B.11.11 U 9000/800 820960681 unlimited-user license
        >
        >
        > I compile in 64-bits mode the program below:
        >
        > cronos:jdiaz:tm p>cat kk.C
        > #include <iostream.h>[/color]

        #include <iostream> // No ".h" extension.
        [color=blue]
        > #include <limits>
        >
        > int main()
        > {[/color]

        using namespace std;
        [color=blue]
        > long l_min = numeric_limits< long>::min();
        > long l_max = numeric_limits< long>::max();
        > double d_min = numeric_limits< double>::min();
        > double d_max = numeric_limits< double>::max();
        > cout << sizeof(long) << " " << sizeof(double) << endl;
        > cout << l_min << " " << l_max << " " << d_min << " " << d_max <<
        > endl;
        >
        >
        > return 0;
        > }
        > cronos:jdiaz:tm p>a.out
        > 8 8
        > -922337203685477 5808 922337203685477 5807 2.22507e-308 1.79769e+308
        >
        >
        >
        > The double and long types have the same size, but the double limits
        > are bigger. Can anyone explein this to me ?[/color]

        Typically, some of the bits representing a double are interpreted as an
        exponent, and the rest as a multiplier. Floating-point math results in
        approximate results, whereas any operation closed over the field of
        integers will give an exact result when applied to long int's (if we
        discount {over,under}flo w).


        Comment

        • James McIninch

          #5
          Re: Newbye quetion: Why a double can store more number than a long ?

          <posted & mailed>

          The code below isn't C language code, but the question still applies.

          A double can represent larger numbers because it lacks the resolution of the
          long type. For a long integer, you have one number with absolute precision
          for each integer within the range. For a double, you have exactly the same
          number of values as the long, but on average, the difference between each
          individual value and the next is much greater. Instead of counting by 1's,
          you are counting by tens of thousands.

          It may be easier to understand if you think about it this way, a integer
          simply stores a number. A double uses the same number of bits to store two
          numbers: one an integer, and one to tell it where to stick the decimal
          point. The range of integers (where there is precision) is much smaller
          because only a portion of the double is used to store the integral part
          (mantissa) while another portion of the bits is used to store the position
          of the decimal point (exponent). That's a simplification, but you get the
          idea.

          Integers are perfectly precise with a narrow range, and doubles are, on
          average, very imprecise but cover a much wider range. Both doubles and
          integers (in this case, since they are the same number of bits on your
          system) have the same number of values.

          jose luis fernandez diaz wrote:
          [color=blue]
          > Hi,
          >
          > My OS is:
          >
          > cronos:jdiaz:tm p>uname -a
          > HP-UX cronos B.11.11 U 9000/800 820960681 unlimited-user license
          >
          >
          > I compile in 64-bits mode the program below:
          >
          > cronos:jdiaz:tm p>cat kk.C
          > #include <iostream.h>
          > #include <limits>
          >
          > int main()
          > {
          > long l_min = numeric_limits< long>::min();
          > long l_max = numeric_limits< long>::max();
          > double d_min = numeric_limits< double>::min();
          > double d_max = numeric_limits< double>::max();
          > cout << sizeof(long) << " " << sizeof(double) << endl;
          > cout << l_min << " " << l_max << " " << d_min << " " << d_max <<
          > endl;
          >
          >
          > return 0;
          > }
          > cronos:jdiaz:tm p>a.out
          > 8 8
          > -922337203685477 5808 922337203685477 5807 2.22507e-308 1.79769e+308
          >
          >
          >
          > The double and long types have the same size, but the double limits
          > are bigger. Can anyone explein this to me ?
          >
          > Thanks,
          > Jose Luis.[/color]

          --
          remove .spam from address to reply by e-mail.

          Comment

          • Terry

            #6
            Re: Newbye quetion: Why a double can store more number than a long ?


            "Lew Pitcher" <Lew.Pitcher@td .com> wrote in message
            news:MHqlc.1745 5$3Q4.280308@ne ws20.bellglobal .com...[color=blue]
            > -----BEGIN PGP SIGNED MESSAGE-----
            > Hash: SHA1
            >
            > jose luis fernandez diaz wrote:[color=green]
            > > Hi,
            > >
            > > My OS is:
            > >
            > > cronos:jdiaz:tm p>uname -a
            > > HP-UX cronos B.11.11 U 9000/800 820960681 unlimited-user license
            > >
            > >
            > > I compile in 64-bits mode the program below:
            > >
            > > cronos:jdiaz:tm p>cat kk.C
            > > #include <iostream.h>
            > > #include <limits>
            > >
            > > int main()
            > > {
            > > long l_min = numeric_limits< long>::min();
            > > long l_max = numeric_limits< long>::max();[/color]
            > [snip]
            >
            > Well, since you are using a different language from C, we in the[/color]
            comp.lang.c[color=blue]
            > newsgroup cannot assist you. Your question does not relate to C, and[/color]
            should be[color=blue]
            > (presumably, from the crossposting, was) asked in a forum related to the
            > language in which you wrote your example. This appears to be C++, so that[/color]
            forum[color=blue]
            > would be comp.lang.c++.
            >
            >
            > - --
            > Lew Pitcher
            > IT Consultant, Enterprise Application Architecture,
            > Enterprise Technology Solutions, TD Bank Financial Group
            >[/color]

            Not very helpful.

            Regards


            Comment

            • CBFalconer

              #7
              Re: Newbye quetion: Why a double can store more number than a long ?

              jose luis fernandez diaz wrote:[color=blue]
              >
              > I compile in 64-bits mode the program below:
              >
              > cronos:jdiaz:tm p>cat kk.C
              > #include <iostream.h>
              > #include <limits>
              >
              > int main()
              > {
              > long l_min = numeric_limits< long>::min();
              > long l_max = numeric_limits< long>::max();
              > double d_min = numeric_limits< double>::min();
              > double d_max = numeric_limits< double>::max();
              > cout << sizeof(long) << " " << sizeof(double) << endl;
              > cout << l_min << " " << l_max << " " << d_min << " " << d_max << endl;
              >
              > return 0;
              > }[/color]

              C++ is off topic on c.l.c. Please refrain from any such
              cross-postings.

              --
              Some useful references:
              <http://www.ungerhu.com/jxh/clc.welcome.txt >
              <http://www.eskimo.com/~scs/C-faq/top.html>
              <http://benpfaff.org/writings/clc/off-topic.html>
              <http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/> (C99)


              Comment

              • joe durusau

                #8
                Re: Newbye quetion: Why a double can store more number than a long ?



                CBFalconer wrote:
                [color=blue]
                > jose luis fernandez diaz wrote:[color=green]
                > >
                > > I compile in 64-bits mode the program below:
                > >
                > > cronos:jdiaz:tm p>cat kk.C
                > > #include <iostream.h>
                > > #include <limits>
                > >
                > > int main()
                > > {
                > > long l_min = numeric_limits< long>::min();
                > > long l_max = numeric_limits< long>::max();
                > > double d_min = numeric_limits< double>::min();
                > > double d_max = numeric_limits< double>::max();
                > > cout << sizeof(long) << " " << sizeof(double) << endl;
                > > cout << l_min << " " << l_max << " " << d_min << " " << d_max << endl;
                > >
                > > return 0;
                > > }[/color]
                >
                > C++ is off topic on c.l.c. Please refrain from any such
                > cross-postings.
                >
                > --
                > Some useful references:
                > <http://www.ungerhu.com/jxh/clc.welcome.txt >
                > <http://www.eskimo.com/~scs/C-faq/top.html>
                > <http://benpfaff.org/writings/clc/off-topic.html>
                > <http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/> (C99)[/color]

                Well, the question doesn't have anything to do with unix, either, but
                you might see whether your sompiler has sizeof() in it. That could tell
                you the size of long and of double, and might provide a clue.

                The best place to persue this sort of thing is a textbook. There are
                very few newsgroups that devote themselves to trying to run down
                questions relating to problems that probably pertain to a specific
                compiler/platform issue such as this one. Too bad, but that's the
                way it is.

                Speaking only for myself,

                Joe Durusau



                Comment

                • Jack Klein

                  #9
                  Re: Newbye quetion: Why a double can store more number than a long ?

                  On Mon, 3 May 2004 17:09:27 +0100, "Terry"
                  <terry@tbean.fr eeserve.co.uk> wrote in comp.lang.c:

                  [snip]
                  [color=blue]
                  > Not very helpful.
                  >
                  > Regards[/color]

                  Nor was your follow up.

                  --
                  Jack Klein
                  Home: http://JK-Technology.Com
                  FAQs for
                  comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
                  comp.lang.c++ http://www.parashift.com/c++-faq-lite/
                  alt.comp.lang.l earn.c-c++

                  Comment

                  • jose luis fernandez diaz

                    #10
                    Re: Newbye quetion: Why a double can store more number than a long ?

                    Hi,

                    I have made the program below to try to understand how a floating
                    point number is made by my computer (HP-UX cronos B.11.11 U 9000/800):

                    #include <stdio.h>
                    #include <math.h>

                    union
                    {
                    float f;
                    unsigned char uc[sizeof(float)];
                    } f_union;


                    int main()
                    {
                    f_union.f=1.0F;

                    unsigned char u1=1, u2;
                    u1 <<= sizeof(unsigned char)*8-1;

                    for (int i=0; i < sizeof(float); ++i)
                    {
                    u2=f_union.uc[i];
                    for(int j=0; j<sizeof(unsign ed char)*8; j++)
                    {
                    printf("%d", ((u1 & u2)!=0));
                    u2 <<= 1;
                    }
                    }
                    printf("\n");

                    int exp;
                    double man = frexp(f_union.f , &exp);
                    printf("%lf %d\n%f\n", man, exp,f_union.f);


                    return 0;
                    }


                    but I didn't. Perhaps the program is wrong. Here are some outputs:

                    001111111000000 000000000000000 00
                    0.500000 1
                    1.000000

                    010000000000000 000000000000000 00
                    0.500000 2
                    2.000000

                    010000000100000 000000000000000 00
                    0.750000 2
                    3.000000


                    010000001000000 000000000000000 00
                    0.500000 3
                    4.000000

                    010000001010000 000000000000000 00
                    0.625000 3
                    5.000000

                    010000010000000 000000000000000 00
                    0.500000 4
                    8.000000




                    Any hint are welcome.

                    Thanks,
                    Jose Luis.

                    jose_luis_fdez_ diaz_news@yahoo .es (jose luis fernandez diaz) wrote in message news:<c2f95fd0. 0405030402.7625 ba21@posting.go ogle.com>...[color=blue]
                    > Hi,
                    >
                    > My OS is:
                    >
                    > cronos:jdiaz:tm p>uname -a
                    > HP-UX cronos B.11.11 U 9000/800 820960681 unlimited-user license
                    >
                    >
                    > I compile in 64-bits mode the program below:
                    >
                    > cronos:jdiaz:tm p>cat kk.C
                    > #include <iostream.h>
                    > #include <limits>
                    >
                    > int main()
                    > {
                    > long l_min = numeric_limits< long>::min();
                    > long l_max = numeric_limits< long>::max();
                    > double d_min = numeric_limits< double>::min();
                    > double d_max = numeric_limits< double>::max();
                    > cout << sizeof(long) << " " << sizeof(double) << endl;
                    > cout << l_min << " " << l_max << " " << d_min << " " << d_max <<
                    > endl;
                    >
                    >
                    > return 0;
                    > }
                    > cronos:jdiaz:tm p>a.out
                    > 8 8
                    > -922337203685477 5808 922337203685477 5807 2.22507e-308 1.79769e+308
                    >
                    >
                    >
                    > The double and long types have the same size, but the double limits
                    > are bigger. Can anyone explein this to me ?
                    >
                    > Thanks,
                    > Jose Luis.[/color]

                    Comment

                    • Karl Heinz Buchegger

                      #11
                      Re: Newbye quetion: Why a double can store more number than a long ?

                      jose luis fernandez diaz wrote:[color=blue]
                      >
                      > Hi,
                      >
                      > I have made the program below to try to understand how a floating
                      > point number is made by my computer (HP-UX cronos B.11.11 U 9000/800):
                      >[/color]

                      Your program won't help you in understanding what's the deal with
                      floating point numbers and why they have a greater range then eg. long.

                      Let us simplify the whole thing in a more familiar environment.
                      Assume you are my 'computer'. But I will allow you to calulate
                      with 5 digits only (and no sign for simplicity)

                      If you use those 5 digits for 'long' only , you can use those 5
                      digits to count from 00000 to 99999, so your range is 100000 numbers.
                      But you can do different also. You can divide the available 5 digits
                      into a mantissa and an exponent. Say you use 2 digits for the exponent
                      and the remaining 3 digits for the mantissa (you are familiar with
                      sientific notation, are you?). So eg. a number 100 can be represented
                      in various ways:

                      number scientific not. our notation
                      *************** *************** ********
                      100 100 * 10^0 100 00
                      100 10 * 10^1 010 01
                      100 1 * 10^2 001 02

                      Note: in the column 'our notation', no representation uses more then
                      5 digits which fits perfectly to what I allowed to you :-)

                      Now lets see some other numbers.
                      Say you need to represent 1000 in 'out notation'. How can you do that?
                      Well you can eg. do 001 03. That would be 1 * 10^3. Or you could do
                      010 02 (10 * 10^2), or 100 01 (100 * 10^1). Fine. But now try to represent
                      1001 in 'out notation'. You can't. That's because the only way to get there
                      would be to increment the mantissa. Let's see whats happening then:

                      (1000) 001 03 -> (~1001) 002 03 -> 2 * 10^3 -> 2000
                      (1000) 010 02 -> (~1001) 011 02 -> 11 * 10^2 -> 1100
                      (1000) 100 01 -> (~1001) 101 01 -> 101 * 10^1 -> 1010

                      You see, using only 5 digits, it is impossible to get at the number 1001. You can
                      get 1000 and you can get 1010, but no numbers inbetween. It follows from the fact
                      that you reserve some of the available 5 digits to represent an exponent, which
                      drops the 'range' of numbers representable with the remaining 3 digits. But you
                      get the freedome to move the comma around by fiddeling with the exponent. Using
                      those 5 digit 'scientific notation' it is easy to represent

                      1000 -> 100 01
                      10000 -> 100 02
                      100000 -> 100 03
                      1000000 -> 100 04
                      10000000 -> 100 05

                      Right now we are way 'over' the upper limit for 5-digit-long, which was
                      99999. But we bought this by reducing the granularity. We cannot represent
                      all numbers in 10 millions, just some of them.

                      100 05 -> 10000000
                      101 05 -> 10100000

                      All numbers between 10000000 and 10100000 are not representable by our 5 digit
                      scheme but need to be approximated by either 10000000 or 10100000.

                      Back to your computer. It doesn't use only 5 digits, but much more. Also the
                      exponent is not taken to base 10, but to base 2. This reduces the effect you
                      just saw. But the principle is still the same. You buy the greater range
                      by reducing the granularity.

                      --
                      Karl Heinz Buchegger
                      kbuchegg@gascad .at

                      Comment

                      • jose luis fernandez diaz

                        #12
                        Re: Newbye quetion: Why a double can store more number than a long ?

                        Ok. I understand.

                        Regards,
                        Jose Luis.

                        Karl Heinz Buchegger <kbuchegg@gasca d.at> wrote in message news:<409779C7. 65D57E09@gascad .at>...[color=blue]
                        > jose luis fernandez diaz wrote:[color=green]
                        > >
                        > > Hi,
                        > >
                        > > I have made the program below to try to understand how a floating
                        > > point number is made by my computer (HP-UX cronos B.11.11 U 9000/800):
                        > >[/color]
                        >
                        > Your program won't help you in understanding what's the deal with
                        > floating point numbers and why they have a greater range then eg. long.
                        >
                        > Let us simplify the whole thing in a more familiar environment.
                        > Assume you are my 'computer'. But I will allow you to calulate
                        > with 5 digits only (and no sign for simplicity)
                        >
                        > If you use those 5 digits for 'long' only , you can use those 5
                        > digits to count from 00000 to 99999, so your range is 100000 numbers.
                        > But you can do different also. You can divide the available 5 digits
                        > into a mantissa and an exponent. Say you use 2 digits for the exponent
                        > and the remaining 3 digits for the mantissa (you are familiar with
                        > sientific notation, are you?). So eg. a number 100 can be represented
                        > in various ways:
                        >
                        > number scientific not. our notation
                        > *************** *************** ********
                        > 100 100 * 10^0 100 00
                        > 100 10 * 10^1 010 01
                        > 100 1 * 10^2 001 02
                        >
                        > Note: in the column 'our notation', no representation uses more then
                        > 5 digits which fits perfectly to what I allowed to you :-)
                        >
                        > Now lets see some other numbers.
                        > Say you need to represent 1000 in 'out notation'. How can you do that?
                        > Well you can eg. do 001 03. That would be 1 * 10^3. Or you could do
                        > 010 02 (10 * 10^2), or 100 01 (100 * 10^1). Fine. But now try to represent
                        > 1001 in 'out notation'. You can't. That's because the only way to get there
                        > would be to increment the mantissa. Let's see whats happening then:
                        >
                        > (1000) 001 03 -> (~1001) 002 03 -> 2 * 10^3 -> 2000
                        > (1000) 010 02 -> (~1001) 011 02 -> 11 * 10^2 -> 1100
                        > (1000) 100 01 -> (~1001) 101 01 -> 101 * 10^1 -> 1010
                        >
                        > You see, using only 5 digits, it is impossible to get at the number 1001. You can
                        > get 1000 and you can get 1010, but no numbers inbetween. It follows from the fact
                        > that you reserve some of the available 5 digits to represent an exponent, which
                        > drops the 'range' of numbers representable with the remaining 3 digits. But you
                        > get the freedome to move the comma around by fiddeling with the exponent. Using
                        > those 5 digit 'scientific notation' it is easy to represent
                        >
                        > 1000 -> 100 01
                        > 10000 -> 100 02
                        > 100000 -> 100 03
                        > 1000000 -> 100 04
                        > 10000000 -> 100 05
                        >
                        > Right now we are way 'over' the upper limit for 5-digit-long, which was
                        > 99999. But we bought this by reducing the granularity. We cannot represent
                        > all numbers in 10 millions, just some of them.
                        >
                        > 100 05 -> 10000000
                        > 101 05 -> 10100000
                        >
                        > All numbers between 10000000 and 10100000 are not representable by our 5 digit
                        > scheme but need to be approximated by either 10000000 or 10100000.
                        >
                        > Back to your computer. It doesn't use only 5 digits, but much more. Also the
                        > exponent is not taken to base 10, but to base 2. This reduces the effect you
                        > just saw. But the principle is still the same. You buy the greater range
                        > by reducing the granularity.[/color]

                        Comment

                        • Abhishek

                          #13
                          Re: Newbye quetion: Why a double can store more number than a long ?



                          Hi,

                          Long stores the integers as a normal bit representation and a double is like
                          a bigger float, in that it stores values in IEEE Floating point format.

                          You should know more about it if you want to do any serious programming in
                          any language. Please check google for IEEE Floating point format.



                          "jose luis fernandez diaz" <jose_luis_fdez _diaz_news@yaho o.es> wrote in
                          message news:<c2f95fd0. 0405030402.7625 ba21@posting.go ogle.com>...
                          [color=blue]
                          > Hi,[/color]
                          [color=blue]
                          >[/color]
                          [color=blue]
                          > My OS is:[/color]
                          [color=blue]
                          >[/color]
                          [color=blue]
                          > cronos:jdiaz:tm p>uname -a[/color]
                          [color=blue]
                          > HP-UX cronos B.11.11 U 9000/800 820960681 unlimited-user license[/color]
                          [color=blue]
                          >[/color]
                          [color=blue]
                          >[/color]
                          [color=blue]
                          > I compile in 64-bits mode the program below:[/color]
                          [color=blue]
                          >[/color]
                          [color=blue]
                          > cronos:jdiaz:tm p>cat kk.C[/color]
                          [color=blue]
                          > #include <iostream.h>[/color]
                          [color=blue]
                          > #include <limits>[/color]
                          [color=blue]
                          >[/color]
                          [color=blue]
                          > int main()[/color]
                          [color=blue]
                          > {[/color]
                          [color=blue]
                          > long l_min = numeric_limits< long>::min();[/color]
                          [color=blue]
                          > long l_max = numeric_limits< long>::max();[/color]
                          [color=blue]
                          > double d_min = numeric_limits< double>::min();[/color]
                          [color=blue]
                          > double d_max = numeric_limits< double>::max();[/color]
                          [color=blue]
                          > cout << sizeof(long) << " " << sizeof(double) << endl;[/color]
                          [color=blue]
                          > cout << l_min << " " << l_max << " " << d_min << " " << d_max <<[/color]
                          [color=blue]
                          > endl;[/color]
                          [color=blue]
                          >[/color]
                          [color=blue]
                          >[/color]
                          [color=blue]
                          > return 0;[/color]
                          [color=blue]
                          > }[/color]
                          [color=blue]
                          > cronos:jdiaz:tm p>a.out[/color]
                          [color=blue]
                          > 8 8[/color]
                          [color=blue]
                          > -922337203685477 5808 922337203685477 5807 2.22507e-308 1.79769e+308[/color]
                          [color=blue]
                          >[/color]
                          [color=blue]
                          >[/color]
                          [color=blue]
                          >[/color]
                          [color=blue]
                          > The double and long types have the same size, but the double limits[/color]
                          [color=blue]
                          > are bigger. Can anyone explein this to me ?[/color]
                          [color=blue]
                          >[/color]
                          [color=blue]
                          > Thanks,[/color]
                          [color=blue]
                          > Jose Luis.[/color]


                          ---
                          Outgoing mail is certified Virus Free.
                          Checked by AVG anti-virus system (http://www.grisoft.com).
                          Version: 6.0.670 / Virus Database: 432 - Release Date: 4/27/2004


                          Comment

                          Working...