summaryrefslogtreecommitdiff
path: root/libc/utils/MPFRWrapper
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2024-09-23 15:55:29 -0700
committerVitaly Buka <vitalybuka@google.com>2024-09-23 15:55:29 -0700
commit80323f174971174928c87fb0e958a6fcfe094d59 (patch)
treebb0862b94fc42ba636ea993820a3368b851fd334 /libc/utils/MPFRWrapper
parent1c4f36eefcbee84fe801c6817ff4cdc7feeafd13 (diff)
parent8dbb739ffb0880e4f739992d07dc6ba6edca9509 (diff)
Created using spr 1.3.4 [skip ci]
Diffstat (limited to 'libc/utils/MPFRWrapper')
-rw-r--r--libc/utils/MPFRWrapper/CMakeLists.txt1
-rw-r--r--libc/utils/MPFRWrapper/MPFRUtils.cpp3
2 files changed, 3 insertions, 1 deletions
diff --git a/libc/utils/MPFRWrapper/CMakeLists.txt b/libc/utils/MPFRWrapper/CMakeLists.txt
index 941d3cf004d4..0101c9f39908 100644
--- a/libc/utils/MPFRWrapper/CMakeLists.txt
+++ b/libc/utils/MPFRWrapper/CMakeLists.txt
@@ -14,6 +14,7 @@ if(LIBC_TESTS_CAN_USE_MPFR)
libc.src.__support.CPP.stringstream
libc.src.__support.CPP.string_view
libc.src.__support.CPP.type_traits
+ libc.src.__support.FPUtil.cast
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.fpbits_str
LibcTest.unit
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index 7ce6a70d0931..27ff1f7190ef 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -13,6 +13,7 @@
#include "src/__support/CPP/string_view.h"
#include "src/__support/CPP/stringstream.h"
#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/FPUtil/cast.h"
#include "src/__support/FPUtil/fpbits_str.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
@@ -683,7 +684,7 @@ template <> long double MPFRNumber::as<long double>() const {
template <> float16 MPFRNumber::as<float16>() const {
// TODO: Either prove that this cast won't cause double-rounding errors, or
// find a better way to get a float16.
- return static_cast<float16>(mpfr_get_d(value, mpfr_rounding));
+ return fputil::cast<float16>(mpfr_get_d(value, mpfr_rounding));
}
#endif