Valued getting changed to exponential

I have a Payment screen where lot of calculations are done on the basis of some input and logic. The payment amount can not have more than 2 decimal precision. It is getting handled on UI .But while doing calculation some times values are giving exponential value or some invalid value which should not be the output. How to handle that, Should round function should be used or not. ?

  Discussion posts and replies are publicly visible

Parents Reply

  • todecimal(
    31914.60
    ) - todecimal(
    31914.40
    )
    ) - (
    0.2
    )

    The above calculation is giving exponential value. Since these values is used further for some calculations and validations So it is getting a break.

    and my requirement is that the value should not be more than 2 decimal precision. So I am using a round function and i also tried with round down function but it is not giving correct value in every case.

Children