fix(libc): apply range handling to llroundf
The original fix predates llroundf, which was added in #2933. Use the same guest range and exception behavior for the fourth wrapper and include it in the edge-case checks.
This commit is contained in:
parent
03dde075c9
commit
fcc3145abf
|
|
@ -52,7 +52,7 @@ float APS5_VABI frexpf_nid_postfix(float x, int* exponent) { return std::frexp(x
|
|||
std::int64_t APS5_VABI lround_nid_postfix(double x) { return RoundToInt64(x); }
|
||||
std::int64_t APS5_VABI lroundf_nid_postfix(float x) { return RoundToInt64(x); }
|
||||
std::int64_t APS5_VABI llround_nid_postfix(double x) { return RoundToInt64(x); }
|
||||
std::int64_t APS5_VABI llroundf_nid_postfix(float x) { return std::llround(x); }
|
||||
std::int64_t APS5_VABI llroundf_nid_postfix(float x) { return RoundToInt64(x); }
|
||||
int APS5_VABI __isfinitef_nid_postfix(float x) { return std::isfinite(x) ? 1 : 0; }
|
||||
int APS5_VABI __isnormal_nid_postfix(double x) { return std::isnormal(x) ? 1 : 0; }
|
||||
int APS5_VABI __isnormalf_nid_postfix(float x) { return std::isnormal(x) ? 1 : 0; }
|
||||
|
|
|
|||
|
|
@ -273,12 +273,14 @@ static void CheckDoubleRounding(double value, std::int64_t expected, bool invali
|
|||
}
|
||||
|
||||
static void CheckFloatRounding(float value, std::int64_t expected, bool invalid) {
|
||||
std::feclearexcept(FE_ALL_EXCEPT);
|
||||
errno = 12345;
|
||||
const std::int64_t result = lroundf_nid_postfix(value);
|
||||
Require(result == expected);
|
||||
Require((std::fetestexcept(FE_INVALID) != 0) == invalid);
|
||||
Require(errno == 12345);
|
||||
for (const bool useLlround : {false, true}) {
|
||||
std::feclearexcept(FE_ALL_EXCEPT);
|
||||
errno = 12345;
|
||||
const std::int64_t result = useLlround ? llroundf_nid_postfix(value) : lroundf_nid_postfix(value);
|
||||
Require(result == expected);
|
||||
Require((std::fetestexcept(FE_INVALID) != 0) == invalid);
|
||||
Require(errno == 12345);
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue