+2 votes

How to get min and max numerical limits of float and int types?

Like a std::numerical_limits in C++

in Engine by (273 points)

1 Answer

+3 votes
Best answer

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



Short for "integer", it stores whole numbers (positive and negative). It is stored as a 64-bit value, equivalent to "int64_t" in C++.


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.

by (4,078 points)
selected by

They should to create some numerical constants. I don't want that my games become broken when they decide to change that limits

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?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.