Coverage Report

Created: 2026-02-26 07:34

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/pxfm-0.1.27/src/shared_eval.rs
Line
Count
Source
1
/*
2
 * // Copyright (c) Radzivon Bartoshyk 7/2025. All rights reserved.
3
 * //
4
 * // Redistribution and use in source and binary forms, with or without modification,
5
 * // are permitted provided that the following conditions are met:
6
 * //
7
 * // 1.  Redistributions of source code must retain the above copyright notice, this
8
 * // list of conditions and the following disclaimer.
9
 * //
10
 * // 2.  Redistributions in binary form must reproduce the above copyright notice,
11
 * // this list of conditions and the following disclaimer in the documentation
12
 * // and/or other materials provided with the distribution.
13
 * //
14
 * // 3.  Neither the name of the copyright holder nor the names of its
15
 * // contributors may be used to endorse or promote products derived from
16
 * // this software without specific prior written permission.
17
 * //
18
 * // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
 * // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
 * // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
 * // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
 * // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
 * // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
 * // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
 * // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
 * // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
 * // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 */
29
use crate::double_double::DoubleDouble;
30
31
#[inline]
32
0
pub(crate) fn poly_dd_3(x: DoubleDouble, poly: [(u64, u64); 3], l: f64) -> DoubleDouble {
33
0
    let zch = poly[2];
34
0
    let ach = f64::from_bits(zch.0) + l;
35
0
    let acl = (f64::from_bits(zch.0) - ach) + l + f64::from_bits(zch.1);
36
0
    let mut ch = DoubleDouble::new(acl, ach);
37
38
0
    let zch = poly[1];
39
0
    ch = DoubleDouble::quick_mult(ch, x);
40
0
    let th = ch.hi + f64::from_bits(zch.0);
41
0
    let tl = (f64::from_bits(zch.0) - th) + ch.hi;
42
0
    ch.hi = th;
43
0
    ch.lo += tl + f64::from_bits(zch.1);
44
45
0
    let zch = poly[0];
46
0
    ch = DoubleDouble::quick_mult(ch, x);
47
0
    let th = ch.hi + f64::from_bits(zch.0);
48
0
    let tl = (f64::from_bits(zch.0) - th) + ch.hi;
49
0
    ch.hi = th;
50
0
    ch.lo += tl + f64::from_bits(zch.1);
51
52
0
    ch
53
0
}
54
55
#[inline]
56
0
pub(crate) fn poly_dekker_generic<const N: usize>(
57
0
    x: DoubleDouble,
58
0
    poly: [(u64, u64); N],
59
0
) -> DoubleDouble {
60
0
    let zch = poly.last().unwrap();
61
0
    let ach = f64::from_bits(zch.0);
62
0
    let acl = f64::from_bits(zch.1);
63
0
    let mut ch = DoubleDouble::new(acl, ach);
64
65
0
    for zch in poly.iter().rev().skip(1) {
66
0
        ch = DoubleDouble::quick_mult(ch, x);
67
0
        let th = ch.hi + f64::from_bits(zch.0);
68
0
        let tl = (f64::from_bits(zch.0) - th) + ch.hi;
69
0
        ch.hi = th;
70
0
        ch.lo += tl + f64::from_bits(zch.1);
71
0
    }
72
73
0
    ch
74
0
}
Unexecuted instantiation: pxfm::shared_eval::poly_dekker_generic::<32>
Unexecuted instantiation: pxfm::shared_eval::poly_dekker_generic::<7>