how do i limit the visible this decimal number so it would only show
“15.70”
and not "15.700000000000001 "
(Shown in pic)
how do i limit the visible this decimal number so it would only show
“15.70”
and not "15.700000000000001 "
(Shown in pic)
Using the *round()
variable is your best bet. If you want to get into the decimals, you may also find it useful to extract characters from a string or number.
More generically, you need to find the index of the decimal point and then get the substring from the first character to the decimal point index + 2 (or whatever).
This is a little tedious to do (given the lack of a substring function), but fortunately someone has already done the hard yards for you.
Have a look at the cslib library which contains both the index and substring functions. (just use the forum search for it - I can’t remember the exact link)