-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Shifts not implemented on floats, f32, f64 #7189
Comments
Floating point numbers have no obvious semantics with regards to shifting, compared to integers. Example, More importantly, there is no basic operation for floating point shifts so it would have to be implemented in software. Rust is a systems language, so hidden costs are considered bad and shifting is generally considered to be a speedy operation. having Lastly, what use would it be? Bit shifting is normally done for the encoding of data at a bit level, but floating point numbers are bit-level encoding. You are essentially asking if we are planning to implement a way to corrupt floating point numbers at a language level. Not a bug. Closing. |
@Aatch , that's not quite true; for example, LLVM has a floating-point shift instruction: http://llvm.org/docs/doxygen/html/namespacellvm_1_1X86ISD.html My understanding is that typically, low-level compiler optimizations would turn other floating-point operations onto shifts (operating on the bit-level representation of floats so as to preserve semantics; floats aren't magic, you can manipulate their representations just as with ints), but this isn't an area I'm particularly familiar with. On the other hand, I don't imagine rustc would ever do these optimizations, since LLVM can do them perfectly well. @graydon , can you confirm/deny that this bug should stay closed? |
[`map_identity`]: recognize tuple identity function Fixes rust-lang#7189 This lint now recognizes `.map(|(a, b)| (a, b))` as a useless `map` call. changelog: [`map_identity`]: recognize tuple identity function
Are there plans for these to be implemented, or are they intentionally left out? I noticed in the development core wiki that more bitwise goodies were available for ints, but binary operations on floats were left out.
The text was updated successfully, but these errors were encountered: