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
  • 54,300
  • 24
  • 162
  • 166
Joe
  • 2,343
  • 3
  • 21
  • 45

0 Answers0