Skip to content

Commit ed33a49

Browse files
committed
Add MAX_FLOAT/MIN_FLOAT/MAX_INT/MIN_INT/EPSILON constants and isNaN/isInfinite functions
1 parent c54ad02 commit ed33a49

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/Processing.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,16 @@ static constexpr int REPLACE = 0;
12581258
#endif
12591259

12601260
// Math constants (float precision)
1261+
// Processing Java numeric constants
1262+
static constexpr float MAX_FLOAT = ::std::numeric_limits<float>::max();
1263+
static constexpr float MIN_FLOAT = -::std::numeric_limits<float>::max();
1264+
static constexpr int MAX_INT = ::std::numeric_limits<int>::max();
1265+
static constexpr int MIN_INT = ::std::numeric_limits<int>::min();
1266+
static constexpr float EPSILON = 0.0001f;
1267+
// isNaN / isInfinite
1268+
inline bool isNaN(float v) { return ::std::isnan(v); }
1269+
inline bool isInfinite(float v) { return ::std::isinf(v); }
1270+
12611271
static constexpr float PI = static_cast<float>(M_PI);
12621272
static constexpr float TWO_PI = static_cast<float>(M_PI * 2.0);
12631273
static constexpr float HALF_PI = static_cast<float>(M_PI / 2.0);

0 commit comments

Comments
 (0)