diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2019-11-28 15:24:26 +0100 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2019-12-06 14:01:05 +0100 |
| commit | cba479f75c7513f91f727741882a99442f393c12 (patch) | |
| tree | b9dcaf3f1f8510c49370bf91381ac568256911b8 /src/test/debuginfo/enum-thinlto.rs | |
| parent | f442797c17f8f1f6ff217d48e664018359bdd6bc (diff) | |
| download | rust-cba479f75c7513f91f727741882a99442f393c12.tar.gz rust-cba479f75c7513f91f727741882a99442f393c12.zip | |
Add `{f32,f64}::approx_unchecked_to<Int>` unsafe methods
As discussed in https://github.com/rust-lang/rust/issues/10184 Currently, casting a floating point number to an integer with `as` is Undefined Behavior if the value is out of range. `-Z saturating-float-casts` fixes this soundness hole by making `as` “saturate” to the maximum or minimum value of the integer type (or zero for `NaN`), but has measurable negative performance impact in some benchmarks. There is some consensus in that thread for enabling saturation by default anyway, but provide an `unsafe fn` alternative for users who know through some other mean that their values are in range.
Diffstat (limited to 'src/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions
