[resolved]loss of persition error, how to tell the compiler I don't care
Exactly what the subject says
Re: loss of persition error, how to tell the compiler I don't care
What's the line of code causing the error?
Is there anything after the error such as: expected double, but found int?
Re: loss of persition error, how to tell the compiler I don't care
I suppose you mean "precision"? ("Persition" is not a word.)
I further suppose the error says "loss of precision"?
I further suppose you have code like this:
Code:
double d = 213.392;
// ...
int i = d;
Or perhaps to float. Whatever. The solution is to explicitely cast the values:
Code:
double d = 213.392;
int i = (int)d;
float f = (float)d;
Re: loss of persition error, how to tell the compiler I don't care
I'll check and see if that works when I get back on the other PC at school that has the file on it. I was doing calculations and if I stored an vareable as a double it would cause an infinate loop so I switched it to an int or a float (i think an int) and it told me that.
Re: loss of persition error, how to tell the compiler I don't care
You compared doubles with ==. You shouldn't do that. Use < and >.