Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8179331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:58:40+00:00 2026-06-06T23:58:40+00:00

I tried doing some floating point comparison and here is what I found: 130

  • 0

I tried doing some floating point comparison and here is what I found:

130 === 130.000000000000014210854715 // true
130 === 130.000000000000014210854716 // false
9 === 9.0000000000000008881784197001 // true
9 === 9.0000000000000008881784197002 // false
0.1 === 0.100000000000000012490009027033 // true
0.1 === 0.100000000000000012490009027034 // false

I tried running those on Firefox and Chrome with the same results. Okay, I KNOW that floating point comparison is a bad practice and has unexpected behavior. But I just curious about those numbers, why or how does those sequence of fractional digits calculated?

If you wish you could even expand those sequence further (kind of binary searching for the next sequence).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:58:41+00:00Added an answer on June 6, 2026 at 11:58 pm

    The fractional portion exceeds the precision of JavaScript’s Number type.

    JavaScript can only handle the 130.0000000000000 portion of your number, so it becomes 130 (those 0s have no significance).

    Every Number in JavaScript is really a 64-bit IEEE-754 float, so the number 130.000000000000014210854715 will look like in binary…

    0,10000000110,10000010000000000000000000000000000000000000000000000
    

    Where the groups are sign (+ or -), exponent and significand/mantissa.

    You can see that the number 130 is the same…

    0,10000000110,10000010000000000000000000000000000000000000000000000 
    

    You’d need a 128 bit Number for JavaScript to be able to tell these two numbers apart, ot use a float128 implementation for JavaScript or bignum.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing some exercises and tried to convert a simple class into a
I am new to mysql but have recently tried doing some tutorials to advance
Im doing some form validation on a website and I've tried to use JQuery
I am doing some byte[] comparisons. I tried == but this is just like
I'm just doing some University related Diffie-Hellman exercises and tried to use ruby for
I'm doing some kind of research related to mod_perl-Apache-Perl compatibility. Recently I tried to
I am doing some research on a asp.net bug. I tried to get adplus
I just did a push to Heroku and tried doing some testing by adding
I've been doing some tests with mongodb and sharding and at some point I
I tried doing this: [toolbar setTint:[UIColor colorWithPatternImage:[UIImage imageNamed:@thingFromMyBundle.png]]]; but it just ended up black.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.