Merge pull request #2934 from AchrafReyani/feat/libc-nextafterf
feat(libc): implement nextafterf
This commit is contained in:
commit
ea6661cce8
|
|
@ -83,6 +83,7 @@ float APS5_VABI roundf_nid_postfix(float x) { return std::round(x); }
|
|||
double APS5_VABI round_nid_postfix(double x) { return std::round(x); }
|
||||
float APS5_VABI cbrtf_nid_postfix(float x) { return std::cbrt(x); }
|
||||
float APS5_VABI remainderf_nid_postfix(float x, float y) { return std::remainder(x, y); }
|
||||
float APS5_VABI nextafterf_nid_postfix(float x, float y) { return std::nextafter(x, y); }
|
||||
int APS5_VABI __isfinite_nid_postfix(double x) { return std::isfinite(x) ? 1 : 0; }
|
||||
int APS5_VABI __isnan_nid_postfix(double x) { return std::isnan(x) ? 1 : 0; }
|
||||
int APS5_VABI __isinf_nid_postfix(double x) { return std::isinf(x) ? 1 : 0; }
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ double APS5_VABI exp2_nid_postfix(double);
|
|||
double APS5_VABI ldexp_nid_postfix(double, int);
|
||||
double APS5_VABI scalbn_nid_postfix(double, int);
|
||||
float APS5_VABI scalbnf_nid_postfix(float, int);
|
||||
float APS5_VABI nextafterf_nid_postfix(float, float);
|
||||
double APS5_VABI frexp_nid_postfix(double, int*);
|
||||
float APS5_VABI frexpf_nid_postfix(float, int*);
|
||||
std::int64_t APS5_VABI lround_nid_postfix(double);
|
||||
|
|
@ -244,6 +245,13 @@ int main() {
|
|||
Require(ldexp_nid_postfix(0.75, 4) == 12.);
|
||||
Require(scalbn_nid_postfix(0.75, -2) == 0.1875);
|
||||
Require(scalbnf_nid_postfix(0.75f, 4) == 12.f);
|
||||
Require(nextafterf_nid_postfix(1.f, 2.f) == 0x1.000002p0f && nextafterf_nid_postfix(1.f, 0.f) == 0x1.fffffep-1f);
|
||||
Require(nextafterf_nid_postfix(0.f, 1.f) == std::numeric_limits<float>::denorm_min());
|
||||
Require(nextafterf_nid_postfix(0.f, -1.f) == -std::numeric_limits<float>::denorm_min());
|
||||
Require(nextafterf_nid_postfix(std::numeric_limits<float>::denorm_min(), -1.f) == 0.f);
|
||||
Require(nextafterf_nid_postfix(1.f, 1.f) == 1.f && !std::signbit(nextafterf_nid_postfix(-0.f, 0.f)));
|
||||
Require(nextafterf_nid_postfix(std::numeric_limits<float>::max(), std::numeric_limits<float>::infinity()) == std::numeric_limits<float>::infinity());
|
||||
Require(std::isnan(nextafterf_nid_postfix(std::numeric_limits<float>::quiet_NaN(), 1.f)) && std::isnan(nextafterf_nid_postfix(1.f, std::numeric_limits<float>::quiet_NaN())));
|
||||
int exponent = 0;
|
||||
Require(frexp_nid_postfix(12., &exponent) == 0.75 && exponent == 4);
|
||||
Require(frexpf_nid_postfix(-12.f, &exponent) == -0.75f && exponent == 4);
|
||||
|
|
|
|||
Loading…
Reference in New Issue