Debian Codegraph @

src/simple.rs

raw symbols SCIP
1 use craterust-analyzer cargo fast-float2 0.2.3 crate/::commonrust-analyzer cargo fast-float2 0.2.3 common/::AdjustedMantissarust-analyzer cargo fast-float2 0.2.3 common/AdjustedMantissa#;
2 use craterust-analyzer cargo fast-float2 0.2.3 crate/::decimalrust-analyzer cargo fast-float2 0.2.3 decimal/::{parse_decimalrust-analyzer cargo fast-float2 0.2.3 decimal/parse_decimal()., Decimalrust-analyzer cargo fast-float2 0.2.3 decimal/Decimal#};
3 use craterust-analyzer cargo fast-float2 0.2.3 crate/::floatrust-analyzer cargo fast-float2 0.2.3 float/::Floatrust-analyzer cargo fast-float2 0.2.3 float/Float#;
4
5 #[inline]
6 pub fn parse_long_mantissarust-analyzer cargo fast-float2 0.2.3 simple/parse_long_mantissa().<F: Floatrust-analyzer cargo fast-float2 0.2.3 float/Float#>(s: &[u8]) -> AdjustedMantissarust-analyzer cargo fast-float2 0.2.3 common/AdjustedMantissa# {
7 const MAX_SHIFTrust-analyzer cargo fast-float2 0.2.3 simple/MAX_SHIFT.: usize = 60;
8 const NUM_POWERSrust-analyzer cargo fast-float2 0.2.3 simple/NUM_POWERS.: usize = 19;
9 const POWERSrust-analyzer cargo fast-float2 0.2.3 simple/POWERS.: [u8; 19] =
10 [0, 3, 6, 9, 13, 16, 19, 23, 26, 29, 33, 36, 39, 43, 46, 49, 53, 56, 59];
11
12 let get_shift = |n| {
13 if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().NUM_POWERSrust-analyzer cargo fast-float2 0.2.3 simple/NUM_POWERS. {
14 POWERSrust-analyzer cargo fast-float2 0.2.3 simple/POWERS.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().n]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as usize
15 } else {
16 MAX_SHIFTrust-analyzer cargo fast-float2 0.2.3 simple/MAX_SHIFT.
17 }
18 };
19
20 let am_zero = AdjustedMantissarust-analyzer cargo fast-float2 0.2.3 common/AdjustedMantissa#::zero_pow2rust-analyzer cargo fast-float2 0.2.3 common/impl#[AdjustedMantissa]zero_pow2().(0);
21 let am_inf = AdjustedMantissarust-analyzer cargo fast-float2 0.2.3 common/AdjustedMantissa#::zero_pow2rust-analyzer cargo fast-float2 0.2.3 common/impl#[AdjustedMantissa]zero_pow2().(F::INFINITE_POWERrust-analyzer cargo fast-float2 0.2.3 float/Float#INFINITE_POWER.);
22
23 let mut d = parse_decimalrust-analyzer cargo fast-float2 0.2.3 decimal/parse_decimal().(s);
24
25 if d.num_digitsrust-analyzer cargo fast-float2 0.2.3 decimal/Decimal#num_digits. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 || d.decimal_pointrust-analyzer cargo fast-float2 0.2.3 decimal/Decimal#decimal_point. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().324 {
26 return am_zero;
27 } else if d.decimal_pointrust-analyzer cargo fast-float2 0.2.3 decimal/Decimal#decimal_point. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]ge().310 {
28 return am_inf;
29 }
30 let mut exp2 = 0_i32;
31 while d.decimal_pointrust-analyzer cargo fast-float2 0.2.3 decimal/Decimal#decimal_point. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt().0 {
32 let n = d.decimal_pointrust-analyzer cargo fast-float2 0.2.3 decimal/Decimal#decimal_point. as usize;
33 let shift = get_shift(n);
34 d.right_shiftrust-analyzer cargo fast-float2 0.2.3 decimal/impl#[Decimal]right_shift().(shift);
35 if d.decimal_pointrust-analyzer cargo fast-float2 0.2.3 decimal/Decimal#decimal_point. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().Decimalrust-analyzer cargo fast-float2 0.2.3 decimal/Decimal#::DECIMAL_POINT_RANGErust-analyzer cargo fast-float2 0.2.3 decimal/impl#[Decimal]DECIMAL_POINT_RANGE. {
36 return am_zero;
37 }
38 exp2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().shift as i32;
39 }
40 while d.decimal_pointrust-analyzer cargo fast-float2 0.2.3 decimal/Decimal#decimal_point. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le().0 {
41 let shift = if d.decimal_pointrust-analyzer cargo fast-float2 0.2.3 decimal/Decimal#decimal_point. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 {
42 match d.digitsrust-analyzer cargo fast-float2 0.2.3 decimal/Decimal#digits.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). {
43 digit if digit rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge().5 => break,
44 0 | 1 => 2,
45 _ => 1,
46 }
47 } else {
48 get_shift((-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().d.decimal_pointrust-analyzer cargo fast-float2 0.2.3 decimal/Decimal#decimal_point.) as usize)
49 };
50 d.left_shiftrust-analyzer cargo fast-float2 0.2.3 decimal/impl#[Decimal]left_shift().(shift);
51 if d.decimal_pointrust-analyzer cargo fast-float2 0.2.3 decimal/Decimal#decimal_point. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt().Decimalrust-analyzer cargo fast-float2 0.2.3 decimal/Decimal#::DECIMAL_POINT_RANGErust-analyzer cargo fast-float2 0.2.3 decimal/impl#[Decimal]DECIMAL_POINT_RANGE. {
52 return am_inf;
53 }
54 exp2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign().shift as i32;
55 }
56 exp2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign().1;
57 while (F::MINIMUM_EXPONENTrust-analyzer cargo fast-float2 0.2.3 float/Float#MINIMUM_EXPONENT. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().1) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt().exp2 {
58 let mut n = ((F::MINIMUM_EXPONENTrust-analyzer cargo fast-float2 0.2.3 float/Float#MINIMUM_EXPONENT. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().1) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().exp2) as usize;
59 if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().MAX_SHIFTrust-analyzer cargo fast-float2 0.2.3 simple/MAX_SHIFT. {
60 n = MAX_SHIFTrust-analyzer cargo fast-float2 0.2.3 simple/MAX_SHIFT.;
61 }
62 d.right_shiftrust-analyzer cargo fast-float2 0.2.3 decimal/impl#[Decimal]right_shift().(n);
63 exp2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().n as i32;
64 }
65 if (exp2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().F::MINIMUM_EXPONENTrust-analyzer cargo fast-float2 0.2.3 float/Float#MINIMUM_EXPONENT.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]ge().F::INFINITE_POWERrust-analyzer cargo fast-float2 0.2.3 float/Float#INFINITE_POWER. {
66 return am_inf;
67 }
68 d.left_shiftrust-analyzer cargo fast-float2 0.2.3 decimal/impl#[Decimal]left_shift().(F::MANTISSA_EXPLICIT_BITSrust-analyzer cargo fast-float2 0.2.3 float/Float#MANTISSA_EXPLICIT_BITS. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1);
69 let mut mantissa = d.roundrust-analyzer cargo fast-float2 0.2.3 decimal/impl#[Decimal]round().();
70 if mantissa rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]ge().(1_u64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<usize>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<usize>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<usize>`]shl().(F::MANTISSA_EXPLICIT_BITSrust-analyzer cargo fast-float2 0.2.3 float/Float#MANTISSA_EXPLICIT_BITS. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1)) {
71 d.right_shiftrust-analyzer cargo fast-float2 0.2.3 decimal/impl#[Decimal]right_shift().(1);
72 exp2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().1;
73 mantissa = d.roundrust-analyzer cargo fast-float2 0.2.3 decimal/impl#[Decimal]round().();
74 if (exp2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().F::MINIMUM_EXPONENTrust-analyzer cargo fast-float2 0.2.3 float/Float#MINIMUM_EXPONENT.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]ge().F::INFINITE_POWERrust-analyzer cargo fast-float2 0.2.3 float/Float#INFINITE_POWER. {
75 return am_inf;
76 }
77 }
78 let mut power2 = exp2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().F::MINIMUM_EXPONENTrust-analyzer cargo fast-float2 0.2.3 float/Float#MINIMUM_EXPONENT.;
79 if mantissa rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]lt().(1_u64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<usize>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<usize>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<usize>`]shl().F::MANTISSA_EXPLICIT_BITSrust-analyzer cargo fast-float2 0.2.3 float/Float#MANTISSA_EXPLICIT_BITS.) {
80 power2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign().1;
81 }
82 mantissa rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAndAssign<Self>`]bitand_assign().&=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAndAssign<Self>`]bitand_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAndAssign<Self>`]bitand_assign().(1_u64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<usize>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<usize>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<usize>`]shl().F::MANTISSA_EXPLICIT_BITSrust-analyzer cargo fast-float2 0.2.3 float/Float#MANTISSA_EXPLICIT_BITS.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub().1;
83 AdjustedMantissarust-analyzer cargo fast-float2 0.2.3 common/AdjustedMantissa# {
84 mantissarust-analyzer cargo fast-float2 0.2.3 common/AdjustedMantissa#mantissa.,
85 power2rust-analyzer cargo fast-float2 0.2.3 common/AdjustedMantissa#power2.,
86 }
87 }