Does NumberFormat in java/kotlin have any docs on ...
# random
c
Does NumberFormat in java/kotlin have any docs on how it rounds specifically? I noticed it would round 5.869 to $5.87, but trying to find in the docs on what it's doing exactly.
s
Note the
setRoundingMode
function on the NumberFormat class
The docs for the DecimalFormat subclass describe a bit more, including mentioning that the default there is
RoundingMode.HALF_EVEN
c
@Sam thank you! ALthough I have to say that I feel like an idiot for not being able to figure that out myself. 😭
Okay. i went back to the docs to try to see where i messed up with this. Like you said. DecimalFormat docs are the ones that specify the default rounding. I guess I didnt know that i was using DecimalFormat instead of NumberFormat