mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-01-01 03:12:18 +08:00
Minor fix.
This commit is contained in:
parent
764a064c12
commit
252a1c9dce
@ -66,6 +66,10 @@ from_chars_result parse_infnan(const char *first, const char *last, T &value) n
|
|||||||
* Credit : @mwalcott3
|
* Credit : @mwalcott3
|
||||||
*/
|
*/
|
||||||
fastfloat_really_inline bool rounds_to_nearest() noexcept {
|
fastfloat_really_inline bool rounds_to_nearest() noexcept {
|
||||||
|
// https://lemire.me/blog/2020/06/26/gcc-not-nearest/
|
||||||
|
#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
// See
|
// See
|
||||||
// A fast function to check your floating-point rounding mode
|
// A fast function to check your floating-point rounding mode
|
||||||
// https://lemire.me/blog/2022/11/16/a-fast-function-to-check-your-floating-point-rounding-mode/
|
// https://lemire.me/blog/2022/11/16/a-fast-function-to-check-your-floating-point-rounding-mode/
|
||||||
|
|||||||
@ -132,7 +132,9 @@ TEST_CASE("rounds_to_nearest") {
|
|||||||
fesetround(FE_TONEAREST);
|
fesetround(FE_TONEAREST);
|
||||||
std::cout << "FE_TONEAREST: fmin + 1.0f = " << iHexAndDec(fmin + 1.0f) << " 1.0f - fmin = " << iHexAndDec(1.0f - fmin) << std::endl;
|
std::cout << "FE_TONEAREST: fmin + 1.0f = " << iHexAndDec(fmin + 1.0f) << " 1.0f - fmin = " << iHexAndDec(1.0f - fmin) << std::endl;
|
||||||
CHECK(fegetround() == FE_TONEAREST);
|
CHECK(fegetround() == FE_TONEAREST);
|
||||||
|
#if (FLT_EVAL_METHOD == 1) || (FLT_EVAL_METHOD == 0)
|
||||||
CHECK(fast_float::detail::rounds_to_nearest() == true);
|
CHECK(fast_float::detail::rounds_to_nearest() == true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("parse_zero") {
|
TEST_CASE("parse_zero") {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user