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 7 7460
On Aug 9, 9:01 pm, Jo Deni <joachim_denin...@web.dewrote:
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
try "long long" or "__int64" or "long double" instead of "double"
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.
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
On Aug 10, 12:01 pm, Jo Deni <joachim_denin...@web.dewrote:
double X = 10000000000;
The execution for X = 10^9 worked fine.
So what can I do to fix the problem?
Hi Jo,
I think your compiler would first parse all elements in your program,
and consider the number to be a 32 bit integer (at which time there's
a problem), then later try to "promote" it to a double for assignment
into X. Just write the number as a floating pointer constant to begin
with: 1E10 or 1000000000000.0.
Tony
On Aug 9, 10:01 pm, Jo Deni <joachim_denin...@web.dewrote:
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
10000000000 is trying to be a literal 'int', which is implicitly
converted to the double X. You get the error as 10000000000 is too
large for a 32 bit int. If you use:
double X = 10000000000.0;
it should be fine.
Steve.
and here is the offending line in my code
>
double X = 10000000000;
So what can I do to fix the problem?
double X = 10000000000LL;
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 . This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Paul Thakur |
last post by:
I am writing vbscript code in an .asp page. I need to display field values
from a sql table consisting of several fields, one of them is of type "Long
Text". This field contains XML data. I like to...
|
by: Num |
last post by:
Hi all,
I have to convert a J2EE date as a long ("Millis") in a .NET date as a
long ("Ticks")
In Java, currentTimeMillis, is the difference, measured in
milliseconds, between the current time...
|
by: Adam Ierymenko |
last post by:
I have a question that might have been asked before, but I have not been
able to find anything via groups.google.com or any web search that is
definative.
I am writing an evolutionary AI...
|
by: bq |
last post by:
Hello,
Two questions related to floating point support:
What C compilers for the wintel (MS Windows + x86) platform are C99
compliant as far as <math.h> and <tgmath.h> are concerned?
What...
|
by: Vijay |
last post by:
With the option strict On set.....
Dim fs As FileStream = File.OpenRead(strFile)
With fs
Dim buffer(fs.Length) As Byte ' <--- Option Strict On disallows implicit
conversions from 'Long' to...
|
by: Zero |
last post by:
Hi everybody,
i want to write a small program, which shows me the biggest and
smallest number in dependance of the data type.
For int the command could be:
...
|
by: silvia.fama |
last post by:
Hi!
I'm using c language.
I need to copy a long type value into a char string using a memcpy
function:
memcpy(string, (long *) value, len)
this value will be then insert into a database.
On...
|
by: ext |
last post by:
"A "long" in C is an "int" in C#."
Does this mean that whenever passing a parameter to a C function which
expects a long type, the variable on C# side should be declared as int type?
What if...
|
by: nineoo |
last post by:
To all,
Ok , now this may sound a little crazy, but does any one know if there is a way to increase the maximum value of a unsigned long int?
I'm aware of the the max value of an...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |