Results 1 to 7 of 7

Thread: A question about C laguage

  1. #1

    A question about C laguage

    Could anyone give me a hint to write a program that prints the smallest and the largest double value available on the system that the program is running on?

    I mean by using c language! thanks
    I\'d found my best love, but I didn\'t treasure her. I felt regretful after that. It\'s the ultimate pain in the world. If God can give me a chance, I will tell her three word: \"I love you\". If God wanna give me a time limit, I\'ll say this love will last 10 thousand years!

  2. #2
    AFAIK it is the same for all OS types, and is strictly a C thing:

    2.2E-308 to 1.8E308

    Where E is X 10 raised to the power...

    http://bwilkins.panola.cc.tx.us/COSC...&Constants.htm

    EDIT: I tryed to print the range, I can print 2.2E-308 but for some reason I get infinity for 1.8E308

    It might be one of C's limitation,

    double x = 2.2E-308,y = 1.8E308;

    cout << "double ranges from " << (double) x << " to " << (double) y << endl;
    system("PAUSE");

    double ranges from 2.2e-308 to infinity
    Press any key to continue...

    test

  3. #3
    Senior Member
    Join Date
    Sep 2001
    Posts
    1,027
    That's usually specified in limits.h

    Ammo
    Credit travels up, blame travels down -- The Boss

  4. #4
    wouldn't that have an issue with the word size? I.E.(as my post got answered before), a 64 bit word has a 1 bit sign, an 11 digit exponent, and a 35 bit mantissa.


    ---Aku. Soku. Zan.

  5. #5
    I made some code:

    what do you think?

    anyone know how to copy some words from my own file to this website under Linux?
    I\'d found my best love, but I didn\'t treasure her. I felt regretful after that. It\'s the ultimate pain in the world. If God can give me a chance, I will tell her three word: \"I love you\". If God wanna give me a time limit, I\'ll say this love will last 10 thousand years!

  6. #6
    Leftie Linux Lover the_JinX's Avatar
    Join Date
    Nov 2001
    Location
    Beverwijk Netherlands
    Posts
    2,534
    you click in your text with the left mouse button at the start of the line you want to coppy.
    keep the left button down and selelect the text..
    release the left mouse button..

    move your mouse to the input box below... and click your middle mouse button..

    that's all.
    ASCII stupid question, get a stupid ANSI.
    When in Russia, pet a PETSCII.

    Get your ass over to SLAYRadio the best station for C64 Remixes !

  7. #7
    Senior Member
    Join Date
    Nov 2001
    Posts
    119
    The limits are defined in limits.h.Try help on the header.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •