Mozzer Mozzer - 7 months ago 44
Scala Question

How can i format a float variable in scala?

i need to format this variable :

val value = 3.2202

in a number like this: 3.2

How can i make this in scala?
I don't want a string or a println...I need another float variable with 1 decimal.

val floatVal = BigDecimal(3.2202).setScale(1, BigDecimal.RoundingMode.HALF_DOWN).toFloat