Solving a Mystery Behavior of parseInt() in JavaScript

Dmitri Pavlutin digs into why parseInt(0.0000005); evaluates to 5: parseInt(0.5); // => 0 parseInt(0.05); // => 0 parseInt(0.005); // => 0 parseInt(0.0005); // => 0 parseInt(0.00005); // => 0 parseInt(0.000005); // => 0 parseInt(0.0000005); // => 5 ? Solving a Mystery Behavior of parseInt() in JavaScript → On a related note, Yannick Clybouw recently hit …


This content originally appeared on Bram.us and was authored by Bramus!

Dmitri Pavlutin digs into why parseInt(0.0000005); evaluates to 5:

parseInt(0.5);       // => 0
parseInt(0.05);      // => 0
parseInt(0.005);     // => 0
parseInt(0.0005);    // => 0
parseInt(0.00005);   // => 0
parseInt(0.000005);  // => 0
parseInt(0.0000005); // => 5 ?

Solving a Mystery Behavior of parseInt() in JavaScript →


This content originally appeared on Bram.us and was authored by Bramus!


Print Share Comment Cite Upload Translate Updates
APA

Bramus! | Sciencx (2021-05-11T15:32:41+00:00) Solving a Mystery Behavior of parseInt() in JavaScript. Retrieved from https://www.scien.cx/2021/05/11/solving-a-mystery-behavior-of-parseint-in-javascript-2/

MLA
" » Solving a Mystery Behavior of parseInt() in JavaScript." Bramus! | Sciencx - Tuesday May 11, 2021, https://www.scien.cx/2021/05/11/solving-a-mystery-behavior-of-parseint-in-javascript-2/
HARVARD
Bramus! | Sciencx Tuesday May 11, 2021 » Solving a Mystery Behavior of parseInt() in JavaScript., viewed ,<https://www.scien.cx/2021/05/11/solving-a-mystery-behavior-of-parseint-in-javascript-2/>
VANCOUVER
Bramus! | Sciencx - » Solving a Mystery Behavior of parseInt() in JavaScript. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/05/11/solving-a-mystery-behavior-of-parseint-in-javascript-2/
CHICAGO
" » Solving a Mystery Behavior of parseInt() in JavaScript." Bramus! | Sciencx - Accessed . https://www.scien.cx/2021/05/11/solving-a-mystery-behavior-of-parseint-in-javascript-2/
IEEE
" » Solving a Mystery Behavior of parseInt() in JavaScript." Bramus! | Sciencx [Online]. Available: https://www.scien.cx/2021/05/11/solving-a-mystery-behavior-of-parseint-in-javascript-2/. [Accessed: ]
rf:citation
» Solving a Mystery Behavior of parseInt() in JavaScript | Bramus! | Sciencx | https://www.scien.cx/2021/05/11/solving-a-mystery-behavior-of-parseint-in-javascript-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.