Skip to content

Commit ab2d339

Browse files
committed
feat: add isnan and isfinite functions to webcc::math; update std namespace in compat/cmath
1 parent 4ff0c2e commit ab2d339

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

include/webcc/compat/cmath

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
namespace std
1414
{
1515
using webcc::abs;
16+
using webcc::isfinite;
17+
using webcc::isnan;
1618
using webcc::sqrt;
1719
using webcc::sin;
1820
using webcc::cos;

include/webcc/core/math.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,26 @@ namespace webcc
6161
return __builtin_nanf("");
6262
}
6363

64+
inline bool isnan(float x)
65+
{
66+
return __builtin_isnan(x);
67+
}
68+
69+
inline bool isnan(double x)
70+
{
71+
return __builtin_isnan(x);
72+
}
73+
74+
inline bool isfinite(float x)
75+
{
76+
return __builtin_isfinite(x);
77+
}
78+
79+
inline bool isfinite(double x)
80+
{
81+
return __builtin_isfinite(x);
82+
}
83+
6484
// --- Linear Algebra ---
6585
struct Vec3
6686
{

0 commit comments

Comments
 (0)