Thread: Determining the Largest number??

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    82

    Determining the Largest number??

    Where Can i found information on determining the largest positive, whole value that a int, unsigned int, long, unsigned long, float, and double can hold?

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    In limits.h.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Code:
    #include <iostream>
    #include <limits>
    using namespace std;
    int main(void)
    {
    numeric_limits<double> doubleLim;
    cout<<doubleLim.max()<<endl;
    cout<<numeric_limits<double>::is_signed;
    //...etc
    }
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    82
    does not compile in linux

    Code:
     #include <iostream>
    #include <limits>
    using namespace std;
    int main(void)
    {
    numeric_limits<double> doubleLim;
    cout<<doubleLim.max()<<endl;
    cout<<numeric_limits<double>::is_signed;

  5. #5
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Show us the errors. Our psychic abilities do have limits. And you might want to add an } at the end.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 22
    Last Post: 05-29-2009, 05:44 PM
  2. adding a number to a number
    By bigmac(rexdale) in forum C Programming
    Replies: 11
    Last Post: 10-24-2007, 12:56 PM
  3. Determining what power of 2 a number is without loops
    By Sfpiano in forum C++ Programming
    Replies: 4
    Last Post: 07-16-2005, 10:39 AM
  4. Replies: 3
    Last Post: 03-29-2005, 04:24 PM
  5. Determining if a number has a remainder?
    By Captain Penguin in forum C Programming
    Replies: 3
    Last Post: 09-01-2001, 07:07 AM