Friday, March 29, 2019

c++ - double or float comparison

I've seen posts like:



What is the most effective way for float and double comparison?



Compare two floats



And many other related posts.



I saw in d3js library, it uses the following comparison:




  return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;


Is it OK to use this in C/C++ to do the comparison of double and float?

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...