Sign in to follow this  
Muncher

Float subtraction problem

Recommended Posts

Damn, ive seen some weird stuff, but this bug takes the cake. Im using C++, compiler is Studio.NET. i have two variables of type float x and y. with the following values (values are loaded from a file) x = 34.635418 y = 34.635422 if i subtract them i get: float res = x - y; wait for it..... res = -3.8146973e-006 WTF?! THE ANSWER SHOULD NOT BE -3!!!! I have tried different compilers, all get the same result. PLEASE HELP - i bet its something really simple too.... Paul [Edited by - felisandria on September 19, 2004 3:15:12 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Ravuya
Welcome to scientific notation. You may have heard of it in all the high-school physics lectures you skipped.
ROOFLELOLROTFLMAOHAHALOL!!!!1~

High school physics was useless anyway.

Share this post


Link to post
Share on other sites
Quote:
Original post by jjac7212
hey u guys, leave him alone.
he might be (like me) a young programmer who hasn't yet
done that math in school

Yes, but that does not justify swearing in the post topic, and one is much less likely to receive constructive help/comments if people do not approve of your post language.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this