Videos
You can't do it in a simple way.
The problem is that the computer stores numbers in base 2, and has a finite precision. Then, your 8.88 becomes
8.88000000000000078159700933611020445823669433593750
According to your rules, it is rounded up to 8.89.
A solution could be multiplying your quantities by 100 (in the source code, not using JS), and divide them by 100 at the end.
var fieldVal100 = 888; // 8.88 * 100
fieldVal100 = Math.ceil(fieldVal100);
var fieldVal = fieldVal100 / 100; // 8.88
var fieldVal100 = 50000/3; // 500/3 * 100
fieldVal100 = Math.ceil(fieldVal100);
var fieldVal = fieldVal100 / 100; // 166.67
var fieldVal100 = 50000/6.95; // 500/6.95 * 100
fieldVal100 = Math.ceil(fieldVal100);
var fieldVal = fieldVal100 / 100; // 71.95
Another solution would be storing the numbers as strings instead of numbers, and use some library which operates those strings in base 10.
If you want to round up use ceil() and not round():
fieldVal = Math.ceil(fieldVal * 100) / 100;
If you round 7194.2 you will get 7194 and not 7195, hence leading to 71.94.
The reason why 8.88 * 100 is going to 8.89 is because the way computers store decimal numbers. Because they cannot represent all possible decimals they are approximated to a degree. So 8.88 * 100 = 888.0000000000001, which using ceil leads to 889.