I am searching for a JavaScript math function to round a currency figure UP to the nearest even penny, e.g. $123.43 would round up to $123.44. I do need the rounding to an even number in the second decimal place, not rounding to an even integer.
I found an Excel function (MOD) that accomplishes my objective perfectly, but it is not recognized in JavaScript. Here is an example of the Excel formula, where MOD is the function not recognized.
var N3 = this.getField("num.Tax.PriorYear.Estimate").value
event.value = N3 +MOD(N3, 0.02)
MY QUESTION: what JavaScript function is equivalent to the "MOD" function provided in Excel, and what is the proper syntax.
ALSO: can someone refer me to a good reference guide for JavaScript mathematical functions?
Thank you in advance for your help.
DavidD
var N3 = +getField("num.Tax.PriorYear.Estimate").value;
var result = N3 + (N3 % 0.02);
event.value = util.printf("%.2f", result);
My favorite JavaScript reference is Flanagan's "JavaScript: The Definitive Guide": http://www.amazon.com/JavaScript-Definitive-Guide-David-Flanagan/dp/0596101996
The ECMAScript Specification, though a bit dry, is useful too: http://www.ecma-international.org/publications/standards/Ecma-262.htm