Answers for "double.compare in java"

0

how to compare doubles in java

private static void testBdEquality() 
{
     BigDecimal a = new BigDecimal("2.00");
     BigDecimal b = new BigDecimal("2.0");
 
     System.out.println(a.equals(b));           // false
 
     System.out.println(a.compareTo(b) == 0);   // true
}
Posted by: Guest on September-10-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language