Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
libc/utils/MPFRWrapper/MPFRUtils.cpp
Show First 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | public: | ||||
} | } | ||||
MPFRNumber abs() const { | MPFRNumber abs() const { | ||||
MPFRNumber result(*this); | MPFRNumber result(*this); | ||||
mpfr_abs(result.value, value, mpfr_rounding); | mpfr_abs(result.value, value, mpfr_rounding); | ||||
return result; | return result; | ||||
} | } | ||||
MPFRNumber atanh() const { | |||||
MPFRNumber result(*this); | |||||
mpfr_atanh(result.value, value, mpfr_rounding); | |||||
return result; | |||||
} | |||||
MPFRNumber ceil() const { | MPFRNumber ceil() const { | ||||
MPFRNumber result(*this); | MPFRNumber result(*this); | ||||
mpfr_ceil(result.value, value); | mpfr_ceil(result.value, value); | ||||
return result; | return result; | ||||
} | } | ||||
MPFRNumber cos() const { | MPFRNumber cos() const { | ||||
MPFRNumber result(*this); | MPFRNumber result(*this); | ||||
▲ Show 20 Lines • Show All 302 Lines • ▼ Show 20 Lines | |||||
template <typename InputType> | template <typename InputType> | ||||
cpp::enable_if_t<cpp::is_floating_point_v<InputType>, MPFRNumber> | cpp::enable_if_t<cpp::is_floating_point_v<InputType>, MPFRNumber> | ||||
unary_operation(Operation op, InputType input, unsigned int precision, | unary_operation(Operation op, InputType input, unsigned int precision, | ||||
RoundingMode rounding) { | RoundingMode rounding) { | ||||
MPFRNumber mpfrInput(input, precision, rounding); | MPFRNumber mpfrInput(input, precision, rounding); | ||||
switch (op) { | switch (op) { | ||||
case Operation::Abs: | case Operation::Abs: | ||||
return mpfrInput.abs(); | return mpfrInput.abs(); | ||||
case Operation::Atanh: | |||||
return mpfrInput.atanh(); | |||||
case Operation::Ceil: | case Operation::Ceil: | ||||
return mpfrInput.ceil(); | return mpfrInput.ceil(); | ||||
case Operation::Cos: | case Operation::Cos: | ||||
return mpfrInput.cos(); | return mpfrInput.cos(); | ||||
case Operation::Cosh: | case Operation::Cosh: | ||||
return mpfrInput.cosh(); | return mpfrInput.cosh(); | ||||
case Operation::Exp: | case Operation::Exp: | ||||
return mpfrInput.exp(); | return mpfrInput.exp(); | ||||
▲ Show 20 Lines • Show All 469 Lines • Show Last 20 Lines |