About double

Discussions

EJB design: About double

  1. About double (2 messages)

    I have two related questions both about Java double type.

    1.Java question:
    As we know Java double type is 64 bits.But in our application,we need to calculate the summation of money which is out of the precision scope.Surely we could write a class to process the +-*/ and so on like sqrt() etc.But it's really complicated,we need very complex math transformation to implement it which is out of imagination.So is there clean solution?

    2.business solution
    currency exchange always results in precision lost,so how to balance the total and the summation of all units.
    eg:
    A:100000000.0002(->100000000.00)
    B:100000000.0003(->100000000.00)

    total:?

    Threaded Messages (2)

  2. About double[ Go to top ]

    maybe BigDecimal...

    of cause, wou will decrease calculation speed, but if you problem is in precision...
  3. About double[ Go to top ]

    no use by BigDecimal