feat: improved small num test
This commit is contained in:
@@ -81,6 +81,7 @@ struct decimal {
|
|||||||
decimal sqrt() { return {((int32_t)sqrtf(i)) << HALF_SHIFT}; }
|
decimal sqrt() { return {((int32_t)sqrtf(i)) << HALF_SHIFT}; }
|
||||||
|
|
||||||
float to_float() { return TO_FLOAT(i); }
|
float to_float() { return TO_FLOAT(i); }
|
||||||
|
bool isSmall() { return (abs(i) < (1 << (HALF_SHIFT - 1))); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <int n, class Dev> struct vec {
|
template <int n, class Dev> struct vec {
|
||||||
@@ -164,7 +165,7 @@ template <int n, class Dev> struct vec {
|
|||||||
}
|
}
|
||||||
bool isSmall() {
|
bool isSmall() {
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
if (abs(v[i].i) > (1 << (HALF_SHIFT - 1)))
|
if (!v[i].isSmall())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user