Malaysia recently introduce a rounding mechanism for trading to remove the need for 1 cent in the market, but with this new implementation it cause us web developer more task to make it work with our current application.
The Rounding Mechanism is a method whereby the total bill amount (including goods and services subject to tax) is rounded upwards or downwards to the nearest multiple of 5 sen. In this regard, total bill amount that ends in 1, 2, 6 and 7 sen will be rounded down while 3, 4, 8 and 9 sen will be rounded up to the nearest multiple of 5 sen.
For example, a total bill amounting to RM82.01 will be rounded down to RM82.00. If it amounts to RM82.04, it will be rounded up to RM82.05.
Source BNM Rounding Mechanism
Here’s two different version if you ever need it:
PHP
Credit Resipi PHP
function nearest_5cent($val) {
return round($val*20)/20;
}
JavaScript
var nearest_5cent = function(val) {
return (Math.round(val*20)/20);
}
HALLO BRO,
CAMNBER NAK BUAT CONVERT RM0.05 TU KEPADA TEXT PULA.
CONTOH RM LIMA SEN SAHAJA
You can try this tutorial Menggantikan Nombor Kepada Perkataan