Rounding Numbers
To round numbers to whole numbers you can use the following formula:
Math.round(formula)
Math.round((ausgabenpriv21 - ausgabenpriv19)
{
"result": "8"
}
To round number to a fixed decimal number behind the comma, use this formula:
(Math.round((ausgabenpriv21 - ausgabenpriv19) * 100) / 100).toFixed(2);
{
"result": "-7.80"
}
The “.toFixed(x)” rounds it to the desired decimal points, which you can specifiy by chosing a value for “x”, i.e 2 as in the example.