HTML5 Input Type Number 16 Digits or More Chrome Replaces with Zeroes

forms, google-chrome, html

Solution

When the number input is blurred, Chrome parses the number. According to the WHATWG standard, it should convert it to an IEEE 754 double-precision floating-point number, just like the way numbers are represented in JavaScript. And also like in JavaScript, there's a limit to the precision that these numbers can have, hence the rounding.

You might want to use `<input type="text">` instead..

Problem

Has anyone else experienced a problem with Chrome when using an input type of number and the number of digits exceeds 16? In my situation, anything after the 16th digit is being replaced with a zero on blur. This doesn't occur in the other browsers. ``` <label for="some-number-input">Number Input</label> <input type="number" name="some-number-input" id="some-number-input" /> ``` Is there a solution to this other than changing the input type? Thanks.

Original source

Related problems