|
-
Oct 20th, 2005, 12:47 PM
#1
Thread Starter
Lively Member
[resolved]loss of persition error, how to tell the compiler I don't care
Exactly what the subject says
Last edited by vagabon; Nov 2nd, 2005 at 08:17 AM.
Reason: answered
-
Oct 20th, 2005, 06:32 PM
#2
Frenzied Member
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?
-
Oct 20th, 2005, 06:51 PM
#3
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;
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 21st, 2005, 10:37 AM
#4
Thread Starter
Lively Member
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.
-
Oct 21st, 2005, 10:44 AM
#5
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 >.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|