]>
Commit | Line | Data |
---|---|---|
353b0b11 | 1 | // ignore-wasm32 compiled with panic=abort by default |
3dfed10e XL |
2 | // compile-flags: --crate-type lib -Cdebug-assertions=no |
3 | ||
4 | #![feature(flt2dec)] | |
5 | ||
6 | extern crate core; | |
7 | ||
8 | use core::num::flt2dec; | |
9 | use std::fmt::{Formatter, Result}; | |
10 | ||
11 | // EMIT_MIR funky_arms.float_to_exponential_common.ConstProp.diff | |
12 | fn float_to_exponential_common<T>(fmt: &mut Formatter<'_>, num: &T, upper: bool) -> Result | |
13 | where | |
14 | T: flt2dec::DecodableFloat, | |
15 | { | |
16 | let force_sign = fmt.sign_plus(); | |
17 | // A bug in const propagation (never reached master, but during dev of a PR) caused the | |
18 | // `sign = Minus` assignment to get propagated into all future reads of `sign`. This is | |
19 | // wrong because `sign` could also have `MinusPlus` value. | |
20 | let sign = match force_sign { | |
21 | false => flt2dec::Sign::Minus, | |
22 | true => flt2dec::Sign::MinusPlus, | |
23 | }; | |
24 | ||
25 | if let Some(precision) = fmt.precision() { | |
26 | // 1 integral digit + `precision` fractional digits = `precision + 1` total digits | |
27 | float_to_exponential_common_exact(fmt, num, sign, precision as u32 + 1, upper) | |
28 | } else { | |
29 | float_to_exponential_common_shortest(fmt, num, sign, upper) | |
30 | } | |
31 | } | |
32 | #[inline(never)] | |
33 | fn float_to_exponential_common_exact<T>( | |
34 | fmt: &mut Formatter<'_>, | |
35 | num: &T, | |
36 | sign: flt2dec::Sign, | |
37 | precision: u32, | |
38 | upper: bool, | |
39 | ) -> Result | |
40 | where | |
41 | T: flt2dec::DecodableFloat, | |
42 | { | |
43 | unimplemented!() | |
44 | } | |
45 | ||
46 | #[inline(never)] | |
47 | fn float_to_exponential_common_shortest<T>( | |
48 | fmt: &mut Formatter<'_>, | |
49 | num: &T, | |
50 | sign: flt2dec::Sign, | |
51 | upper: bool, | |
52 | ) -> Result | |
53 | where | |
54 | T: flt2dec::DecodableFloat, | |
55 | { | |
56 | unimplemented!() | |
57 | } |