# parseFloat() function [duplicate]

I have noticed that the parseFloat() function returns decimal numbers, but only up to 2 decimal places. Would it be possible for it to return the numbers with more decimal places? In case we need more precision

• how did you get to that conclusion?
– Juraj
May 11 at 18:57

the `parseFloat()` function returns decimal numbers

No, it doesn't. It returns a binary (not decimal) floating point number.

only up to 2 decimal places

The number returned by `parseFloat()` has 24 significant digits. Binary digits, that is, also called “bits”. This is roughly equivalent to 7 decimal digits.

That being said, beware of `Serial.print()`. This function converts binary floating point numbers to decimal, and defaults to showing only two digits after the radix point. You can ask for more:

``````Serial.println(x, 6);  // display x with 6 digits after the radix point.
``````

If you want to gain some basic understanding of how floating point numbers work, I recommend reading The Floating-Point Guide - What Every Programmer Should Know About Floating-Point Arithmetic.

• Thanks for the explanation, very educational! May 14 at 16:52