diff options
Diffstat (limited to 'source/arduino/floatcast.rst')
-rw-r--r-- | source/arduino/floatcast.rst | 53 |
1 files changed, 14 insertions, 39 deletions
diff --git a/source/arduino/floatcast.rst b/source/arduino/floatcast.rst index 6b85727..773bfe9 100644 --- a/source/arduino/floatcast.rst +++ b/source/arduino/floatcast.rst @@ -1,51 +1,26 @@ +.. highlight:: cpp + .. _arduino-floatcast: -float() -======= +float() (cast) +============== Description ----------- -Converts a value to the -`float <http://arduino.cc/en/Reference/Float>`_ data type. - - - -Syntax ------- - -float(x) - - - -Parameters ----------- - -x: a value of any type - +Converts a value to the :ref:`float <arduino-float>` data type. Here +is an example:: + int x = 2; + float f = float(x); // f now holds "2.0", a floating point value -Returns -------- +The value ``x`` can be of any type. However, if ``x`` is not a number +(like an ``int`` or ``long``), you will get strange results. -float +See the :ref:`float <arduino-float>` reference for details about the +precision and limitations of ``float`` values on the Maple. - - -Notes ------ - -See the reference for -`float <http://arduino.cc/en/Reference/Float>`_ for details about -the precision and limitations of floating point numbers on -Arduino. - - - -See also +See Also -------- - -- `float <http://arduino.cc/en/Reference/Float>`_ - - +- :ref:`float <arduino-float>` |