Is there ever a case where a comparison (equals()
) between two floating point values would return false
if you compare them as DOUBLE
For the comparison between float f and double d, you can calculate the difference of f and d. If abs(f-d) is less than some threshold, you can think of the equality holds. These threshold could be either absolute or relative as your application requirement. There are some good solutions Here. And I hope it helpful.