Average Error: 0.2 → 0.1
Time: 16.2s
Precision: 64
\[0.95492965855137202 \cdot x - 0.129006137732797982 \cdot \left(\left(x \cdot x\right) \cdot x\right)\]
\[x \cdot \left(\left(0.95492965855137202 - \left(x \cdot x\right) \cdot 0.129006137732797982\right) + 0.129006137732797982 \cdot \mathsf{fma}\left(x, -x, x \cdot x\right)\right)\]
0.95492965855137202 \cdot x - 0.129006137732797982 \cdot \left(\left(x \cdot x\right) \cdot x\right)
x \cdot \left(\left(0.95492965855137202 - \left(x \cdot x\right) \cdot 0.129006137732797982\right) + 0.129006137732797982 \cdot \mathsf{fma}\left(x, -x, x \cdot x\right)\right)
double f(double x) {
        double r26539 = 0.954929658551372;
        double r26540 = x;
        double r26541 = r26539 * r26540;
        double r26542 = 0.12900613773279798;
        double r26543 = r26540 * r26540;
        double r26544 = r26543 * r26540;
        double r26545 = r26542 * r26544;
        double r26546 = r26541 - r26545;
        return r26546;
}

double f(double x) {
        double r26547 = x;
        double r26548 = 0.954929658551372;
        double r26549 = r26547 * r26547;
        double r26550 = 0.12900613773279798;
        double r26551 = r26549 * r26550;
        double r26552 = r26548 - r26551;
        double r26553 = -r26547;
        double r26554 = fma(r26547, r26553, r26549);
        double r26555 = r26550 * r26554;
        double r26556 = r26552 + r26555;
        double r26557 = r26547 * r26556;
        return r26557;
}

Error

Bits error versus x

Derivation

  1. Initial program 0.2

    \[0.95492965855137202 \cdot x - 0.129006137732797982 \cdot \left(\left(x \cdot x\right) \cdot x\right)\]
  2. Simplified0.1

    \[\leadsto \color{blue}{x \cdot \left(0.95492965855137202 - 0.129006137732797982 \cdot \left(x \cdot x\right)\right)}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt0.1

    \[\leadsto x \cdot \left(\color{blue}{\sqrt{0.95492965855137202} \cdot \sqrt{0.95492965855137202}} - 0.129006137732797982 \cdot \left(x \cdot x\right)\right)\]
  5. Applied prod-diff0.1

    \[\leadsto x \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt{0.95492965855137202}, \sqrt{0.95492965855137202}, -\left(x \cdot x\right) \cdot 0.129006137732797982\right) + \mathsf{fma}\left(-x \cdot x, 0.129006137732797982, \left(x \cdot x\right) \cdot 0.129006137732797982\right)\right)}\]
  6. Simplified0.1

    \[\leadsto x \cdot \left(\color{blue}{\left(0.95492965855137202 - \left(x \cdot x\right) \cdot 0.129006137732797982\right)} + \mathsf{fma}\left(-x \cdot x, 0.129006137732797982, \left(x \cdot x\right) \cdot 0.129006137732797982\right)\right)\]
  7. Simplified0.1

    \[\leadsto x \cdot \left(\left(0.95492965855137202 - \left(x \cdot x\right) \cdot 0.129006137732797982\right) + \color{blue}{0.129006137732797982 \cdot \mathsf{fma}\left(x, -x, x \cdot x\right)}\right)\]
  8. Final simplification0.1

    \[\leadsto x \cdot \left(\left(0.95492965855137202 - \left(x \cdot x\right) \cdot 0.129006137732797982\right) + 0.129006137732797982 \cdot \mathsf{fma}\left(x, -x, x \cdot x\right)\right)\]

Reproduce

herbie shell --seed 2019195 +o rules:numerics
(FPCore (x)
  :name "Rosa's Benchmark"
  (- (* 0.954929658551372 x) (* 0.12900613773279798 (* (* x x) x))))