class_float.rst 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_float:
  4. float
  5. =====
  6. **Category:** Built-In Types
  7. Brief Description
  8. -----------------
  9. Float built-in type
  10. Member Functions
  11. ----------------
  12. +----------------------------+--------------------------------------------------------------------------------+
  13. | :ref:`float<class_float>` | :ref:`float<class_float_float>` **(** :ref:`bool<class_bool>` from **)** |
  14. +----------------------------+--------------------------------------------------------------------------------+
  15. | :ref:`float<class_float>` | :ref:`float<class_float_float>` **(** :ref:`int<class_int>` from **)** |
  16. +----------------------------+--------------------------------------------------------------------------------+
  17. | :ref:`float<class_float>` | :ref:`float<class_float_float>` **(** :ref:`String<class_string>` from **)** |
  18. +----------------------------+--------------------------------------------------------------------------------+
  19. Description
  20. -----------
  21. Float built-in type.
  22. Member Function Description
  23. ---------------------------
  24. .. _class_float_float:
  25. - :ref:`float<class_float>` **float** **(** :ref:`bool<class_bool>` from **)**
  26. Cast a :ref:`bool<class_bool>` value to a floating point value, ``float(true)`` will be equals to 1.0 and ``float(false)`` will be equals to 0.0.
  27. .. _class_float_float:
  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 equals to 1.0.
  30. .. _class_float_float:
  31. - :ref:`float<class_float>` **float** **(** :ref:`String<class_string>` from **)**
  32. 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.