Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

equal but greater

Status
Not open for further replies.

donivb

Programmer
Joined
Mar 14, 2006
Messages
1
Location
GB
two values are equal but the greater than condition gets satisfied what could be the reason? and how do i fix this?

 
Sounds like you're mis-using floats to me.

> and how do i fix this?
Realise that all floats are approximate, including their visual representations.
So you might be seeing 1.234 and 1.234 when you print out the values in the debugger / printf, but that doesn't mean that the == test is automatically true.

What you might really have is 1.2340000001 and 1.2340000002


--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top