- Ace (god developer, master meme creater)

Actual Issue

Root cause findings

  1. Method we use to round the floating point value produces values with inconsistent decimal points.
     
  2. Currently we round the value and then convert from USD. Because of this we are losing precision values needed for consistent/correct decimal points values.

Most JS rounding methods does not produce reliable and consistent values 

Issue no. 1

Solutions

  1. Use numbers based on exponential notation
    https://www.jacklmoore.com/notes/rounding-in-javascript/

     
  2. Use regex and use rounding down throughout the app so that every decimal out is consistant

Issue no. 1

Issue no. 2

Solution

  • Convert from USD first and then use CurrencyUtils.adjustDecimals() to do the round

Whats next ...

Revisit and unify rounding in front-end

END

Rounding

By salimmalik

Rounding

  • 152