-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various alterations and additions to numeric methods #6301
Conversation
…y base logarithms
Both expm1 and ln1p have been renamed to exp_m1 and ln_1p in order to be consistent with the underscore usage elsewhere. The exp_m1 method is used for increased accuracy when doing floating point calculations, so this has been moved from the more general 'Exponential' trait into 'Float'.
} | ||
|
||
/// Returns the floating point category of the number. If only one property is going to | ||
/// be tested, it is generally faster to use the specific predicate instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure that's true? At least if this method is inlined, I imagine the LLVM optimizer will be able to handle it well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you're probably right. I'll remove this in a future commit.
This is part of the redesign of the numeric traits tracked in issue #4819. Renamed: - `Exponential::expm1` -> `Float::exp_m1` - for consistency with underscore usage elsewhere - `Exponential::log` -> `Exponential::ln` - a less ambiguous name for the natural logarithm - `{float, f64, f32}::logarithm` -> `Exponential::log` - for arbitrary base logarithms - `Real::log_2` -> `Real::ln_2` - for consistency with `ln` - `Real::log_10` -> `Real::ln_10` - for consistency with `ln` Added: - `Signed::abs_sub` - wraps libm's `fdim` function - `Float::is_normal` - returns `true` if the number is neither zero, infinite, subnormal or NaN - `Float::classify` - returns the floating point category of the number - `Float::ln_1p` - returns the natural logarithm of the number plus one
do not trigger map_clone in the case of &mut fixes rust-lang#6299 changelog: do not trigger map_clone in the case of &mut
This is part of the redesign of the numeric traits tracked in issue #4819.
Renamed:
Exponential::expm1
->Float::exp_m1
- for consistency with underscore usage elsewhereExponential::log
->Exponential::ln
- a less ambiguous name for the natural logarithm{float, f64, f32}::logarithm
->Exponential::log
- for arbitrary base logarithmsReal::log_2
->Real::ln_2
- for consistency withln
Real::log_10
->Real::ln_10
- for consistency withln
Added:
Signed::abs_sub
- wraps libm'sfdim
functionFloat::is_normal
- returnstrue
if the number is neither zero, infinite, subnormal or NaNFloat::classify
- returns the floating point category of the numberFloat::ln_1p
- returns the natural logarithm of the number plus one