I’m facing a problem to get the digit of a number after decimal point. I need the digit to do if else statement.
Here is an example:
31.30 = 31.30 31.31 = 31.30 31.32 = 31.30 31.33 = 31.35 31.34 = 31.35 31.35 = 31.35 31.36 = 31.35 31.37 = 31.35 31.38 = 31.40 31.39 = 31.30
So, I need to get the second digit after decimal point. Then, i can use the digit to do if else statement. This rounding issue is happening in Malaysia.
Something like this might work for doing the rounding to the nearest 5 cents, although then you may need to format the output to have the proper number of digits past the decimal point:
Which would give you 31.35, i.e., rounded to the nearest nickel.
This seems a little more direct than getting the digit and doing an if/else.