aboutsummaryrefslogtreecommitdiffstats
path: root/source/arduino/double.rst
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-10-25 21:15:28 -0400
committerMarti Bolivar <mbolivar@mit.edu>2010-11-17 12:44:28 -0500
commit2d429e75ce69e77f8c95490ac03881ec9aa0354a (patch)
treea3b810a6c75625b07a4b976e5d1e319c60e19a6b /source/arduino/double.rst
parent30ac55d80c18e93f9c39a6dd850c10f9e7fd92ac (diff)
downloadlibrambutan-2d429e75ce69e77f8c95490ac03881ec9aa0354a.tar.gz
librambutan-2d429e75ce69e77f8c95490ac03881ec9aa0354a.zip
arduino language reference nearing completion, properly CC-BY-SA 3.0 attributed
Diffstat (limited to 'source/arduino/double.rst')
-rw-r--r--source/arduino/double.rst36
1 files changed, 25 insertions, 11 deletions
diff --git a/source/arduino/double.rst b/source/arduino/double.rst
index 4e7f20c..658af12 100644
--- a/source/arduino/double.rst
+++ b/source/arduino/double.rst
@@ -3,30 +3,44 @@
double
======
-Desciption
-----------
+Description
+-----------
-Double precision floating point number. Occupies 4 bytes.
+Double precision floating point number. Occupies 8 bytes.
+Floating point numbers are not exact, and may yield strange results
+when compared. For example ``6.0 / 3.0`` may not equal ``2.0``. You
+should instead check that the absolute value of the difference between
+the numbers is less than some small number.
+Floating point math is also much slower than integer math in
+performing calculations, so should be avoided if, for example, a loop
+has to run at top speed for a critical timing function. Programmers
+often go to some lengths to convert floating point calculations to
+integer math to increase speed.
-The double implementation on the Arduino is currently exactly the
-same as the float, with no gain in precision.
+For more information about floating point math, see the `Wikipedia
+article <http://en.wikipedia.org/wiki/Floating_point>`_\ .
+Floating-point numbers represent numbers with "decimal point", unlike
+integral types, which always represent whole numbers. Floating-point
+numbers are often used to approximate analog and continuous values
+because they have greater resolution than integers.
+The double implementation on the Maple uses twice the number of bytes
+as a :ref:`float <arduino-float>`, with the corresponding gains in
+precision.
Tip
---
Users who borrow code from other sources that includes double
variables may wish to examine the code to see if the implied
-precision is different from that actually achieved on the Arduino.
+precision is different from that actually achieved on the Maple.
+See Also
+--------
-See:
-----
-
-
-- `float <http://arduino.cc/en/Reference/Float>`_
+- :ref:`float <arduino-float>`