summary refs log tree commit diff
path: root/src/libstd/f32.rs
AgeCommit message (Collapse)AuthorLines
2017-11-19std: Add a new wasm32-unknown-unknown targetAlex Crichton-1/+0
This commit adds a new target to the compiler: wasm32-unknown-unknown. This target is a reimagining of what it looks like to generate WebAssembly code from Rust. Instead of using Emscripten which can bring with it a weighty runtime this instead is a target which uses only the LLVM backend for WebAssembly and a "custom linker" for now which will hopefully one day be direct calls to lld. Notable features of this target include: * There is zero runtime footprint. The target assumes nothing exists other than the wasm32 instruction set. * There is zero toolchain footprint beyond adding the target. No custom linker is needed, rustc contains everything. * Very small wasm modules can be generated directly from Rust code using this target. * Most of the standard library is stubbed out to return an error, but anything related to allocation works (aka `HashMap`, `Vec`, etc). * Naturally, any `#[no_std]` crate should be 100% compatible with this new target. This target is currently somewhat janky due to how linking works. The "linking" is currently unconditional whole program LTO (aka LLVM is being used as a linker). Naturally that means compiling programs is pretty slow! Eventually though this target should have a linker. This target is also intended to be quite experimental. I'm hoping that this can act as a catalyst for further experimentation in Rust with WebAssembly. Breaking changes are very likely to land to this target, so it's not recommended to rely on it in any critical capacity yet. We'll let you know when it's "production ready". --- Currently testing-wise this target is looking pretty good but isn't complete. I've got almost the entire `run-pass` test suite working with this target (lots of tests ignored, but many passing as well). The `core` test suite is still getting LLVM bugs fixed to get that working and will take some time. Relatively simple programs all seem to work though! --- It's worth nothing that you may not immediately see the "smallest possible wasm module" for the input you feed to rustc. For various reasons it's very difficult to get rid of the final "bloat" in vanilla rustc (again, a real linker should fix all this). For now what you'll have to do is: cargo install --git https://github.com/alexcrichton/wasm-gc wasm-gc foo.wasm bar.wasm And then `bar.wasm` should be the smallest we can get it! --- In any case for now I'd love feedback on this, particularly on the various integration points if you've got better ideas of how to approach them!
2017-11-08std: Move the `cmath` module into the `sys` moduleAlex Crichton-86/+2
This commit moves the `f32::cmath` and `f64::cmath` modules into the `sys` module. Note that these are not publicly exported modules, simply implementation details. These modules are already platform-specific with shims on MSVC and this is mostly just a reflection of that reality. This should also help cut down on `#[cfg]` traffic if platforms are brought on which don't directly support these functions.
2017-09-08Revert "Add clamp functions"Jacob Kiesel-20/+0
This reverts commit c589f867f89d4e6e48c6602aed8e878208d4822f.
2017-09-08Revert "Add NAN examples"Jacob Kiesel-1/+0
This reverts commit f74c5d2e18e50c24de2cc1192bf2088cdaa61916.
2017-09-08Revert "Fix f32 examples."Jacob Kiesel-4/+2
This reverts commit 61f20f8df02e53ee60dc1719ce0e502eecebf8b4.
2017-09-08Revert "Fix documentation and formatting."Jacob Kiesel-4/+1
This reverts commit 2e34ff767113c6a15c5862b0646ca9ad7ffd81b1.
2017-09-08Revert "Add panic unit tests"Jacob Kiesel-18/+0
This reverts commit b762283e57ff71f6763effb9cfc7fc0c7967b6b0.
2017-09-04Add panic unit testsJacob Kiesel-0/+18
2017-09-01Fix documentation and formatting.Jacob Kiesel-1/+4
2017-08-26Fix f32 examples.Jacob Kiesel-2/+4
2017-08-26Add NAN examplesJacob Kiesel-0/+1
2017-08-26Add clamp functionsJacob Kiesel-0/+20
2017-07-18float_bits_conv made it into 1.20est31-2/+2
2017-07-06Stabilize float_bits_convest31-4/+2
2017-07-03Make sNaN removal code tolerate different sNaN encodingsest31-8/+16
IEEE 754-1985 specifies the encoding of NaN floating point numbers, but while it mentions that NaNs can be subdivided into signaling and quiet ones, it doesn't fix the encoding of signaling NaNs in binary formats. This led to different implementations (CPUs) having different encodings. IEEE 754-2008 finally specified the encoding of signaling NaNs but some architectures are compatible with it, while others aren't. Certain MIPS and PA-RISC CPUs have different encodings for signaling NaNs. In order to have the float <-> binary cast feature of the std library be portable to them, we don't mask any quiet NaNs like we did before (only being compliant to IEEE 754-2008 and nothing else), but instead we simply pass a known good NaN instead. Note that in the code removed there was a bug; the 64 bit mask for quiet NaNs should have been `0x0008000000000000` instead of the specified `0x0001000000000000`.
2017-06-28Auto merge of #42431 - nagisa:core-float-2, r=alexcrichtonbors-16/+8
Fix NaN handling in is_sign_negative/positive This would be my proposed fix for the #42425 provided we decide it is indeed a problem. Note this would technically be a breaking change to a stable API. We might want to consider deprecating these methods and adding new ones.
2017-06-22Fix NaN handling in is_sign_negative/positiveSimonas Kazlauskas-16/+8
See #42425
2017-06-14Re-implement float min/max in rustSimonas Kazlauskas-4/+2
See #42423
2017-04-22Remove unused import.Corey Farwell-1/+1
2017-04-20Remove float_extrasJosh Stone-204/+0
[unstable, deprecated since 1.11.0]
2017-04-18Allow us to remove masking in the futureest31-2/+2
2017-04-18Preserve sNaN payload when converting them to quiet NaNsest31-7/+25
2017-04-18Convert sNaN to quiet NaN instead of returning errorsest31-12/+18
2017-04-18assert_ne and tracking issueest31-3/+3
2017-04-18Add examples headingest31-0/+4
2017-04-18Return Err(()) when trying to convert sNaN representation to floatest31-7/+17
2017-04-18Add functions to safely transmute float to intest31-0/+51
2017-04-11Improve module description for std::f32 and std::f64.Paul Lange-1/+3
Fixes #29353
2017-02-21Get linkchecker cleanSteve Klabnik-1/+1
This affects the book, some missed things in the reference, the grammar, and the standard library. Whew!
2016-11-01std: Flatten the num directory to reflect the module layoutBrian Anderson-0/+1871
This makes it dissimilar to how core is structured on disk, but more predictable on its own.