Skip to content
Advertisement

Tag: rounding

MYR Currency Rounding

Looking for help in rounding the money to the nearest 0.05 in js language. Input & Expected Output: From: https://www.bnm.gov.my/misc/-/asset_publisher/2BOPbOBfILtL/content/frequently-asked-questions-faqs-on-rounding-mechanism Answer You could take an offset and take a multiple floored value. If you need zeroes at the end take .toFixed(2).

Javascript: Round up to the next multiple of 5

I need a utility function that takes in an integer value (ranging from 2 to 5 digits in length) that rounds up to the next multiple of 5 instead of the nearest multiple of 5. Here is what I got: When I run round5(32), it gives me 30, where I want 35. When I run round5(37), it gives me 35,

Advertisement