Hi guys, something very simple but I can’t find the way.
in this code i want to round the result to an integer (j1.home_od < 2)?(-100 / (j1.home_od - 1)):((j1.home_od - 1) * 100)
j1.home_od = 2.255
get as result 125.4999999
I have already tried .round() but it gives me an error
Note: 0 skill code
maybe I am missing something, as I said before, I have no skill with code
I tried to do something simpler, round a simple number, use “round” and it didn’t work for me and “format number” didn’t work either
(23.4332).formatNumber(2, '.', ',')
this is the correct code?
We encountered this error sometime ago. Its a Javascript problem. The way JS works with numbers, and floating values specifically.
The workaround we implemented was to simply do a round(2) since we needed 2 decimal places.
In your case it would look something like: ((j1.home_od < 2)?(-100 / (j1.home_od - 1)):((j1.home_od - 1) * 100)).round(2)