Comparison

Правка en1, от rahul_1234, 2015-07-13 16:46:31

In C, for comparing doubles we do: bool AreSame(double a, double b) { return std::fabs(a — b) < std::numeric_limits::epsilon(); }

However in java to compare Bigdecimal properly would this suffice: if(r.compareTo(BigDecimal.ZERO) == 0) { System.out.print("Yes"); } Or we have to do something else. Can somebody elaborate on this.

Теги comparison

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский rahul_1234 2015-07-13 16:49:19 2 Tiny change: '**In C, for comp' -> '**In C++, for comp'
en2 Английский rahul_1234 2015-07-13 16:47:54 14
en1 Английский rahul_1234 2015-07-13 16:46:31 375 Initial revision (published)