class_float.rst 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the float.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_float:
  5. float
  6. =====
  7. **Category:** Built-In Types
  8. Brief Description
  9. -----------------
  10. Float built-in type
  11. Methods
  12. -------
  13. +---------------------------+-------------------------------------------------------------------------------------+
  14. | :ref:`float<class_float>` | :ref:`float<class_float_method_float>` **(** :ref:`bool<class_bool>` from **)** |
  15. +---------------------------+-------------------------------------------------------------------------------------+
  16. | :ref:`float<class_float>` | :ref:`float<class_float_method_float>` **(** :ref:`int<class_int>` from **)** |
  17. +---------------------------+-------------------------------------------------------------------------------------+
  18. | :ref:`float<class_float>` | :ref:`float<class_float_method_float>` **(** :ref:`String<class_String>` from **)** |
  19. +---------------------------+-------------------------------------------------------------------------------------+
  20. Description
  21. -----------
  22. Float built-in type.
  23. Method Descriptions
  24. -------------------
  25. .. _class_float_method_float:
  26. - :ref:`float<class_float>` **float** **(** :ref:`bool<class_bool>` from **)**
  27. 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.
  28. - :ref:`float<class_float>` **float** **(** :ref:`int<class_int>` from **)**
  29. Cast an :ref:`int<class_int>` value to a floating point value, ``float(1)`` will be equal to 1.0.
  30. - :ref:`float<class_float>` **float** **(** :ref:`String<class_String>` from **)**
  31. 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.