Thread: integral constant overflow error?

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    91

    integral constant overflow error?

    Code:
    int main()
    {
    	double big_number;
    	big_number = (1/61601) * sqrt((61602*61599)/61603);
    	printf("%f",big_number);
    }

    i get the error

    Code:
    warning C4307: '*' : integral constant overflow
    ???

  2. #2
    ---
    Join Date
    May 2004
    Posts
    1,379
    Something to do with this statement (1/61601) is my guess

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    91
    is it because my variable is too small ?

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by paperbox005
    Code:
    int main()
    {
    	double big_number;
    	big_number = (1/61601) * sqrt((61602*61599)/61603);
    	printf("%f",big_number);
    }
    i get the error
    Code:
    warning C4307: '*' : integral constant overflow
    ???
    3794621598

    This -- 1/61601 -- is zero, BTW.

    [edit]
    Code:
    #include <stdio.h>
    #include <math.h>
    
    int main()
    {
       double big_number;
       big_number = (1.0/61601.0) * sqrt((61602.0*61599.0)/61603.0);
       printf("INT_MAX = %d\n", INT_MAX);
       printf("%f\n",big_number);
       return 0;
    }
    
    /* my output
    INT_MAX = 2147483647
    0.004029
    */
    Last edited by Dave_Sinkula; 05-06-2005 at 09:53 PM.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  3. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  4. C++ compilation issues
    By Rupan in forum C++ Programming
    Replies: 1
    Last Post: 08-22-2005, 05:45 AM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 05:27 AM