I would like to round a Double to a certain number of decimals always rounding down.
Example
rounding to .00 => 1.5679999 to 1.56
rounding to .000 => 1.5679999 to 1.567
round(1.5679999 * 100) / 100 //returns 1.57 round(1.5679999 * 1000) / 1000 //returns 1.568
I want a Double not a concatenated String
Just replace round
with floor
!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With