Results 1 to 2 of 2
  1. #1
    selma
    Guest

    can How to Round Numbers javascript has a bug?

    I tried How to Round Numbers javascript a lot of times,,,And I found a result such that...
    when I write anything number between 8192 and 10485 and if the number has 675 for decimal,it rounds to 67 for decimal ...but it should round to 68....
    can you enlighten me?

  2. #2
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    Hmm, this has got me stumped. I have to say I wouldn't have picked this one up - thanks for bringing it to our attention.

    I've researched it and tried a few alternatives to the Math.round method but they all have the same result. Looking around the net I see that everyone else is using the same code we are and it all has the same bug. At this stage I can only assume it's a limitation of JavaScript.

    8192 is of course 2^13. Maybe that's significant. Any mathematical coding gurus out there?

    I'm going to keep looking around for a solution. I'll let you know if one comes up.
    Dave Owen
    MediaCollege.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Subscribe to us on YouTube