-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Pow() syntax is inconsistent between floats and ints #9592
Comments
Just a correction, the syntax for the float case has to be one of:
|
As in the current master branch, there are three pow variants: std::f32::pow
std::f64::pow
std::num::pow All of them are plain functions, so Can this issue be closed then? |
There's actually more than three version of "power", and // trait methods
Real.powf
// freestanding
f32::pow
f64::pow
num::pow // (generic base, integer exponent)
num::powf // (generic Real base & exponent) In any case, I think the |
A quick update: a |
This is now all consistent, as far as I can tell. |
[arithmetic-side-effects] Detect overflowing associated constants of integers Triggers the negation of maximum unsigned integers using associated constants. Rustc already handles `-128i8` but doesn't handle `-i8::MAX`. At the same time, allows stuff like `-1234`. changelog: FP: [arithmetic-side-effects] Detect overflowing associated constants of integers
Brought this up on IRC the other day and was told to make an issue :)
The current syntax for Pow() is confusing/inconsistent for (ignorant) newcomers like myself. For floats, you can do:
But for any of the integers, you need to use the "static" trait function since integers do not implement the Algebraic trait:
The text was updated successfully, but these errors were encountered: