If you ever need to truncate a decimal value instead of rounding it, give this a try:
Code
Output
num1: 12.99
num1_rounded: 13
num1_formatted: 12
Try it yourself: https://mcsnippets.herokuapp.com/s/gQhFesBi
(Visited 6 times, 1 visits today)
the personal blog of adam spriggs
If you ever need to truncate a decimal value instead of rounding it, give this a try:
num1: 12.99
num1_rounded: 13
num1_formatted: 12
Try it yourself: https://mcsnippets.herokuapp.com/s/gQhFesBi