![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Robotex |
How to get min and max numerical limits of float and int types?
Like a std::numerical_limits in C++
![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Robotex |
How to get min and max numerical limits of float and int types?
Like a std::numerical_limits in C++
![]() |
Reply From: | klaas |
Hi,
godot does only have one int and one float type.
The int then has 2 ^ 63 max value + 1 bit for +/- sign
The float max value is much higher but looses precission due to the exponent
int
Short for “integer”, it stores whole numbers (positive and negative). It is stored as a 64-bit value, equivalent to “int64_t” in C++.
float
Stores real numbers, including decimals, using floating-point values. It is stored as a 64-bit value, equivalent to “double” in C++. Note: Currently, data structures such as Vector2, Vector3, and PoolRealArray store 32-bit single-precision “float” values.
They should to create some numerical constants. I don’t want that my games become broken when they decide to change that limits
Robotex | 2020-08-04 08:45
So the answer is that it is not possible to get max/min value for int or float in godot?
The only way is calculate it manually by converting bit number with all bits set to 1?
Losatu | 2022-11-24 20:56