About 4,330,000 results
Open links in new tab
  1. java - Double vs. BigDecimal? - Stack Overflow

    Aug 5, 2010 · A BigDecimal is an exact way of representing numbers. A Double has a certain precision. Working with doubles of various magnitudes (say d1=1000.0 and d2=0.001) could result in the 0.001 …

  2. How to use comparison operators like >, =, < on BigDecimal

    Jan 8, 2016 · Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in value but have a different scale (like 2.0 and 2.00) are considered equal by this method. …

  3. java - BigDecimal - to use new or valueOf - Stack Overflow

    Mar 15, 2012 · For BigDecimal: this is a bit tricky, because they don't do the same thing. BigDecimal.valueOf(double) will use the canonical String representation of the double value passed …

  4. How to convert an integer to bigdecimal in Java - Stack Overflow

    Apr 16, 2018 · I want to create a method that calculates multiplication of an integer and a bigdecimal. I search on Google and forums, but I didn't find anything. import java.math.BigDecimal; private Integer …

  5. java - BigDecimal, precision and scale - Stack Overflow

    Feb 16, 2016 · A BigDecimal is defined by two values: an arbitrary precision integer and a 32-bit integer scale. The value of the BigDecimal is defined to be . Precision: The precision is the number of digits …

  6. How to check if BigDecimal variable == 0 in java?

    Jul 30, 2015 · Comparing with the BigDecimal constant BigDecimal.ZERO avoids having to construct a new BigDecimal(0) every execution. FYI, BigDecimal also has constants BigDecimal.ONE and …

  7. Compare if BigDecimal is greater than zero - Stack Overflow

    Dec 10, 2013 · How can I compare if BigDecimal value is greater than zero?

  8. Convert double to BigDecimal and set BigDecimal Precision

    In Java, I want to take a double value and convert it to a BigDecimal and print out its String value to a certain precision. import java.math.BigDecimal; public class Main { public static void

  9. Java:Why should we use BigDecimal instead of Double in the real world ...

    Apr 16, 2016 · When dealing with real world monetary values, I am advised to use BigDecimal instead of Double.But I have not got a convincing explanation except, "It is normally done that way". Can you …

  10. BigDecimal.ZERO vs. new BigDecimal (0). Which to use and why?

    In the OpenJDK 6b14 implementation, for example, BigDecimal.ZERO is created by invoking the private new BigDecimal(BigInteger, long, int) constructor with values BigInteger.ZERO, 0, and 0. From a …