1

What is the best solution to make my BigDecimal to have 2 digits after the decimal point (while keeping it as precise as possible) in Scala?

val bigDec1 = BigDecimal(12345.12)
val bigDec2 = BigDecimal(1345.12)
((bigDec1/bigDec2)*100) 

The last row is equal to 917.7709051980492446770548352563340 but I want it to be 917.77.

jub0bs
  • 60,866
  • 25
  • 183
  • 186
Joe
  • 2,543
  • 3
  • 25
  • 49

0 Answers0