AnsweredAssumed Answered

casting double to long

Question asked by els.ari on Apr 3, 2014
Latest reply on Apr 3, 2014 by fm
Hi 

I'm using STM32f407.

i was trying this code:
int main()
{
    signed long sArg;
    double dArg;
    sArg = ( signed long) dArg;
}

the build is ok , but when tryin to program the target i got "no source available for 0x0".
is there a  problem  casting double to long ?

also using atof() :
unsigned char buf[10];
dArg = atof(buf);

give the same problem.

with this code i was able to run:
int main()
{
    signed long sArg;
    double dArg;
    float fArg;
    fArg = (float) dArg;
    sArg =  ( signed long)fArg
}

any explanations?

thanks,

Ari.      

Outcomes