434,998 Members | 2,837 Online + Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

C++: integer constant is too large for "long" type

 P: n/a Folks, I'm a newbie here (and with C++). While executing a C++ program I'm getting the following message error: integer constant is too large for "long" type and here is the offending line in my code double X = 10000000000; (X is equal to 10^10) The execution for X = 10^9 worked fine. So what can I do to fix the problem? Thanks, Jo Aug 10 '07 #1
7 Replies

 P: n/a On Aug 9, 9:01 pm, Jo Deni

 P: n/a On Thu, 09 Aug 2007 20:01:44 -0700, Jo Deni wrote: Folks, I'm a newbie here (and with C++). While executing a C++ program I'm getting the following message error: integer constant is too large for "long" type and here is the offending line in my code double X = 10000000000; (X is equal to 10^10) The execution for X = 10^9 worked fine. So what can I do to fix the problem? Thanks, Jo don't you mean double X = 1.0e10; The compiler is trying to parse 10000000000 as an integer constant and it cannot do so. Aug 10 '07 #3

 P: n/a Jo Deni wrote: Folks, I'm a newbie here (and with C++). While executing a C++ program I'm getting the following message error: integer constant is too large for "long" type and here is the offending line in my code double X = 10000000000; (X is equal to 10^10) The execution for X = 10^9 worked fine. So what can I do to fix the problem? Try double X = 10000000000.0; Best Kai-Uwe Bux Aug 10 '07 #4

 P: n/a On Aug 10, 12:01 pm, Jo Deni

 P: n/a On Aug 9, 10:01 pm, Jo Deni

 P: n/a and here is the offending line in my code > double X = 10000000000; So what can I do to fix the problem? double X = 10000000000LL; Aug 10 '07 #7

 P: n/a On Aug 11, 3:52 am, 440...@email.com wrote: and here is the offending line in my code double X = 10000000000; So what can I do to fix the problem? double X = 10000000000LL; LL is not defined in the current C++ standard. Your compiler might support it as an extension, but it would be better to use 1E10 or 10000000000.0 . Aug 12 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion. 