avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] update on the last issue


From: E. Weddington
Subject: Re: [avr-gcc-list] update on the last issue
Date: Mon, 04 Apr 2005 12:06:27 -0600
User-agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)

intiha Ho gai wrote:

Hi,
I did a little bit more of search and figured that if i use the long
long for my X, Y coordinates and the sums, I should be able to handle
extremely large numbers. But now When i do that, it still give me
incorrect results. Even when i try to assign them those high values
directly, it fails!!!!

Here is my code.
table.sumX = 12338578;
        table.sumY = -3336078;
        table.sumXSquared = 7260107358192; <-- 252
        table.sumXY = -1646741910392; <--- 253
<snip>

This is the compile warning!
Cricket.c:252: warning: integer constant is too large for "long" type
Cricket.c:253: warning: integer constant is too large for "long" type
Cricket.c:259: warning: long int format, different type arg (arg 3)
<-- Why these warnings?
Cricket.c:259: warning: long int format, different type arg (arg 4)
<--It prints something wrong as well :(

where i have defined table as of type regTable (i know long long and
int64_t are the same but i am clutching at straws)

typedef struct regressTbl{
        int16_t n ;
        long long sumXY;
        int64_t sumX,sumY;
        long long sumXSquared;
}regTable;

Any ideas?

Integer constants in C are of type *int* unless specified otherwise. You can use suffixes on the constants to tell the compiler what type (size) the numbers are, such as:
12345678UL
The UL on the end means Unsigned Long.

IIRC, you can use ULL to specify an unsigned long long.

HTH
Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]