JavaScript’s Defects on Numbers

Number larger than 0×20000000000000 (54bit) will not be reliable.

Here is the test script:

javascript:alert (0x1ffffffffffffe);
javascript:alert (0x1fffffffffffff);
javascript:alert (0x20000000000000);
javascript:alert (0x20000000000001);

You can see that the latter two numbers are same number in JavaScript!


The safe number range for integer is “-0x1fffffffffffff – 0x1fffffffffffff” (53bit). Therefore, in Java to JavaScript world, conversion of Java’s long number to JavaScript’s Number may result in incorrect calculations.

This entry was posted in JavaScript. Bookmark the permalink.

23 Responses to JavaScript’s Defects on Numbers

  1. I won’t debate along with your conclusions simply I feel you are exact on the money! You’ve come up with a valid case for your sentiments and now I know much more this unusual subject. Thank you this outstanding publish and that i will arrive again for additional.

  2. Chris says:

    That would be because all numbers in javascript are actually 64 bit floating point.
    Not all integers higher than 53 bits can be exactly represented as a 64 bit floating point value, hence 0×20000000000000 and 0×20000000000001 are the same.
    This is due to the 11 bit exponent and the 1 sign bit. This only leaves 52 bits to store the fraction

  3. First, let me commend your pellucidity on this subject. I am not a pro during this subject, but after reading your write-up, my knowledge has developed substantially. Please tolerate me to catch your rss nourish to remain in contact with any upcoming revisions. Pleasant career and will offer it on to pals and my weblog audience.

  4. gry dzieci says:

    Super witryna. Oby tak dalej.

  5. Your thought is not incorrect,I am guessing God helps those who aid themselves. Come on!

  6. Earlean Metzinger says:

    Nowadays to find a similar Efficient and Effective SEO Automation software at one Time payment of US 99-00 is a rarity\

  7. Hi there, just wanted to mention, I loved this article. It was inspiring.
    Keep on posting!

    Feel free to surf to my web blog: milwaukee Car accident attorney

  8. Hey there, I think your website might be having browser compatibility
    issues. When I look at your blog in Opera, it looks fine but when opening in Internet Explorer, it has some
    overlapping. I just wanted to give you a quick heads up!
    Other then that, great blog!

    Feel free to visit my web page – auto accident attorney fort lauderdale

  9. Since the popularity of saltwater fly fishing has increased over the past years, bonefish anglers from around the world are captivated by the Republic of Kiribati.
    Breathing dirty air, no matter how cool that
    air is, can cause health problems. The Suzuki
    Swift entered the American market for the 1989 model year.

  10. Utilizing the created free Crystal it is going to be attainable to principally unlock and shopping for anything within Star Wars Force Collection totally free.

  11. Within the simply mean interval let us take a look beneath
    to obtain cool money cheats and useful suggestions.

  12. BATTLE BEARS GOLD is an award profitable multiplayer motion app for Android and iOS gadgets like iPhone, iPad, iPod Contact and iPad Mini.

  13. One SIM card vulnerability and some hacks
    later, the possibly deadly remote takeover flaw went from being a theoretical assault to
    a believable threat.

  14. Natasha says:

    But the perfect a part of human enticing place usually
    that Pixel Firearm 3d fashions get into has now per day news.

  15. Bidoo coughing resources are recognized for supplying the help that was greatest hacking.

  16. The most effective hack has to work on all the mobiles, ought to work faster, limitless properly being,
    infinite gold and infinite money.

  17. it’s good to read this web site,The most effective hack has to work on all the mobiles.

  18. sell land says:

    thank you, this post.

  19. thank you, this post the good.

  20. You’ve gotten great thing listed here

  21. 今日は よろしくお願いしますね^^すごいですね^^
    銈般儍銉?銉栥儸銈广儸銉冦儓 338798-J8980/8131 銉栥儵銉冦偗 銉?偠銉?绶ㄣ伩杈笺伩銉?偠銉? GUCCI 銆怸DKG-tk銆戙?愩伅銇撱伣銇欏?蹇滃晢鍝併?戙?愩偝銉炽儞銉嬪彈鍙栧?蹇滃晢鍝併?戙?怋OX鍙楀彇瀵捐薄鍟嗗搧銆憒銈般儍銉?銉栥儸銈广儸銉冦儓 338798-J8980/8131 銉栥儵銉冦偗 銉?偠銉?绶ㄣ伩杈笺伩銉?偠銉? G

  22. Thanks, this website is extremely handy

  23. Great little shoe charm, fast shipping, thanks!!

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>