1-360-209-5351x1000 | Welcome, Guest Login | View Cart

JS parseInt() patch, direct replacement in JS (F5 to refresh js file)

Your Price: $0.00
In Stock.
Part Number:JS-parseInt-patch
This is a correction to algorithm using Math.floor and Math.ceil to fix parseInt(). may make e-commerce and other js applications work better that use this function.
test to see if you have the JS bug: parseInt(-1/3144960000) should return 0, not -3.
If it returns -0, there is a problem with js having an old IEEE-754 floating point standard.
This version fixes several bug I had earlier.
Hit F5 to refresh the js file when you download a js file.
This is my patch, it is not official, but it only works for base 10 numbers. New version Ignores commas (,).
Base-10-only code:
function parseInt(n){//patch for parseInt bug newer browsers included as $20 item (in 2 years from 2018), see business site to purchase this getidmini.js file
    var nstr,result=0,i=0,sign=1;
    if (typeof(n)=="string") {
        while (i<nstr.length&&nstr.charAt(i)=='+'||nstr.charAt(i)=='-') {
            if (nstr.charAt(i)=='-') {
        while (i<nstr.length&&(nstr.charAt(i)>='0'&&nstr.charAt(i)<='9'||nstr.charAt(i)==',')) {
            if (nstr.charAt(i)!=',') {
        return (result<0?Math.ceil(result):Math.floor(result));
    } else if (typeof(n)=="number") {
        return (n<0?Math.ceil(n):Math.floor(n));
    return NaN;