O'Reilly logo

Mastering Arduino by Jon Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Double and float

Double and float data types are floating point numbers which means they are numbers that can contain a decimal point. Both the double and float types can hold values ranging from -3.4028235E+38 to 3.4028235E+38.

On most platforms, the float data type has a precision of six or seven decimal digits while the double data type usually has fifteen digits; however, this is not true on the Arduino platform. On the Arduino platform, the double and float types are exactly the same, therefore they both have the precision to six or seven decimal digits.

There are two very good reasons not to use a double or float value unless you absolutely need a decimal number. The first reason is with precision inaccuracy, as an example 6.0 divided ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required