Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
float¶
A built-in type for floating point numbers.
Description¶
The float built-in type is a 64-bit double-precision floating-point number, equivalent to double
in C++. This type has 14 reliable decimal digits of precision. The maximum value of float is approximately 1.79769e308
, and the minimum is approximately -1.79769e308
.
Many methods and properties in the engine use 32-bit single-precision floating-point numbers instead, equivalent to float
in C++, which have 6 reliable decimal digits of precision. For data structures such as Vector2 and Vector3, Godot uses 32-bit floating-point numbers by default, but it can be changed to use 64-bit doubles if Godot is compiled with the precision=double
option.
Math done using the float type is not guaranteed to be exact and will often result in small errors. You should usually use the @GlobalScope.is_equal_approx and @GlobalScope.is_zero_approx methods instead of ==
to compare float values for equality.
Tutorials¶
Constructors¶
float ( ) |
|
Operators¶
operator != ( float right ) |
|
operator != ( int right ) |
|
operator * ( Color right ) |
|
operator * ( Quaternion right ) |
|
operator * ( Vector2 right ) |
|
operator * ( Vector2i right ) |
|
operator * ( Vector3 right ) |
|
operator * ( Vector3i right ) |
|
operator * ( Vector4 right ) |
|
operator * ( Vector4i right ) |
|
operator * ( float right ) |
|
operator * ( int right ) |
|
operator ** ( float right ) |
|
operator ** ( int right ) |
|
operator + ( float right ) |
|
operator + ( int right ) |
|
operator - ( float right ) |
|
operator - ( int right ) |
|
operator / ( float right ) |
|
operator / ( int right ) |
|
operator < ( float right ) |
|
operator < ( int right ) |
|
operator <= ( float right ) |
|
operator <= ( int right ) |
|
operator == ( float right ) |
|
operator == ( int right ) |
|
operator > ( float right ) |
|