Strange calculation problem in C multiply by 1.2 fails
Posted
by DoomStone
on Stack Overflow
See other posts from Stack Overflow
or by DoomStone
Published on 2010-05-09T07:19:43Z
Indexed on
2010/05/09
7:28 UTC
Read the original article
Hit count: 179
c
|typecasting
I have this c code, where i need to calculate a dobule from a long.
double result;
long t2_value;
t2_value = 72;
result = t2_value * 1.2;
Now this code crashes at "result = t2_value * 1.2;" only with the error "Vector 0000000006".
Here is the strange thing, if i replace
result = t2_value * 1.2;
with
result = 72 * 1.2;
evything works just as it should, i have tryed type casting t2_value as an double
result = ((double)t2_value * 1.2);
or making it an int istead of a long, but nothing helps.
© Stack Overflow or respective owner