Files
godot-docs/classes/class_float.rst
2020-01-21 09:28:25 +01:00

56 lines
2.0 KiB
ReStructuredText

:github_url: hide
.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
.. DO NOT EDIT THIS FILE, but the float.xml source instead.
.. The source is found in doc/classes or modules/<name>/doc_classes.
.. _class_float:
float
=====
**Category:** Built-In Types
Brief Description
-----------------
Float built-in type
Methods
-------
+---------------------------+-------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`float<class_float_method_float>` **(** :ref:`bool<class_bool>` from **)** |
+---------------------------+-------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`float<class_float_method_float>` **(** :ref:`int<class_int>` from **)** |
+---------------------------+-------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`float<class_float_method_float>` **(** :ref:`String<class_String>` from **)** |
+---------------------------+-------------------------------------------------------------------------------------+
Description
-----------
Float built-in type.
Method Descriptions
-------------------
.. _class_float_method_float:
- :ref:`float<class_float>` **float** **(** :ref:`bool<class_bool>` from **)**
Cast a :ref:`bool<class_bool>` value to a floating point value, ``float(true)`` will be equal to 1.0 and ``float(false)`` will be equal to 0.0.
----
- :ref:`float<class_float>` **float** **(** :ref:`int<class_int>` from **)**
Cast an :ref:`int<class_int>` value to a floating point value, ``float(1)`` will be equal to 1.0.
----
- :ref:`float<class_float>` **float** **(** :ref:`String<class_String>` from **)**
Cast a :ref:`String<class_String>` value to a floating point value. This method accepts float value strings like ``"1.23"`` and exponential notation strings for its parameter so calling ``float("1e3")`` will return 1000.0 and calling ``float("1e-3")`` will return 0.001.