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: Dmitry K.
Subject: Re: [avr-gcc-list] update on the last issue
Date: Tue, 5 Apr 2005 08:25:23 +1100
User-agent: KMail/1.5

On Monday 04 April 2005 11:07, intiha Ho gai wrote:
[snip]
>               table.sumXSquared = 7260107358192; <-- 252
>               table.sumXY = -1646741910392; <--- 253
>                denom = ( table.n * table.sumXSquared - table.sumX * 
> table.sumX);
>                if (denom != 0)
>                       a = ( table.n * table.sumXY - table.sumY * table.sumX) 
> / denom;
>        b = (table.sumY - a * table.sumX) / table.n;
>
>       sprintf(OutputMsg,"sumX=%ld, sumY=%ld, sumXY=%ld,
> sumXSquared=%ld\r\n",
> table.sumX,table.sumY,table.sumXY,table.sumXSquared);
>       UARTOutput(DBG_ERROR,"%s", &OutputMsg);
>       sprintf(OutputMsg,"**************** A=%f     B=%f
> ***********\r\n",a,b); UARTOutput(DBG_ERROR,"%s", &OutputMsg);
>
> 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?

Use `LL':
        table.sumXSquared = 7260107358192LL; <-- 252

sprintf:
        'll' qualificator must, but it is not realised in avr-libc's printf.

Regards.






reply via email to

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