hey how to compare longest decimal number using == operator??

Recommended Answers

All 4 Replies

Just what are you comparing for? The equality operator only tells you if they are equal; it won't give you which is the larger of the two. If you mean to determine which of two numbers is larger, you would use the inequality operators such as < (less than) or > (greater than).

hey i m jst cmparing for equality oly..
ma values are 1.0000029775773537376784127130643 nd 1.0000029775773537376784127228965....it mst return false..i m gettng it as true...

floats and doubles can't be eaily compared for equality due to rounding errors in memory. Read this related thread

ya thank you....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.