mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 08:46:49 +08:00
added lacking overloads to avoid potential ambiguity
This commit is contained in:
parent
6702cd4244
commit
e12463583f
@ -373,6 +373,18 @@ integer_times_pow10(int64_t mantissa, int decimal_exponent) noexcept {
|
||||
|
||||
// the following overloads are here to avoid surprising ambiguity for int,
|
||||
// unsigned, etc.
|
||||
#if !defined(_MSC_VER)
|
||||
FASTFLOAT_CONSTEXPR20 inline double
|
||||
integer_times_pow10(unsigned long long mantissa,
|
||||
int decimal_exponent) noexcept {
|
||||
return integer_times_pow10(static_cast<uint64_t>(mantissa), decimal_exponent);
|
||||
}
|
||||
|
||||
FASTFLOAT_CONSTEXPR20 inline double
|
||||
integer_times_pow10(long long mantissa, int decimal_exponent) noexcept {
|
||||
return integer_times_pow10(static_cast<int64_t>(mantissa), decimal_exponent);
|
||||
}
|
||||
#endif
|
||||
FASTFLOAT_CONSTEXPR20 inline double
|
||||
integer_times_pow10(unsigned mantissa, int decimal_exponent) noexcept {
|
||||
return integer_times_pow10(static_cast<uint64_t>(mantissa), decimal_exponent);
|
||||
|
||||
@ -2140,6 +2140,10 @@ TEST_CASE("integer_times_pow10") {
|
||||
-3141592653589793238, -18, -3.141592653589793238);
|
||||
verify_integer_multiplication_by_power_of_10<uint64_t>(
|
||||
3141592653589793238, -18, 3.141592653589793238);
|
||||
verify_integer_multiplication_by_power_of_10<long long>(
|
||||
-3141592653589793238, -18, -3.141592653589793238);
|
||||
verify_integer_multiplication_by_power_of_10<unsigned long long>(
|
||||
3141592653589793238, -18, 3.141592653589793238);
|
||||
|
||||
for (int mode : {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO, FE_TONEAREST}) {
|
||||
fesetround(mode);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user