Average Error: 0.2 → 0.2
Time: 11.2s
Precision: 64
\[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)\]
\[x \cdot \left(x \cdot \left(3 - x \cdot 2\right)\right) + \left(2 \cdot \left(\left(-x\right) + x\right)\right) \cdot \left(x \cdot x\right)\]
\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)
x \cdot \left(x \cdot \left(3 - x \cdot 2\right)\right) + \left(2 \cdot \left(\left(-x\right) + x\right)\right) \cdot \left(x \cdot x\right)
double f(double x) {
        double r956812 = x;
        double r956813 = r956812 * r956812;
        double r956814 = 3.0;
        double r956815 = 2.0;
        double r956816 = r956812 * r956815;
        double r956817 = r956814 - r956816;
        double r956818 = r956813 * r956817;
        return r956818;
}

double f(double x) {
        double r956819 = x;
        double r956820 = 3.0;
        double r956821 = 2.0;
        double r956822 = r956819 * r956821;
        double r956823 = r956820 - r956822;
        double r956824 = r956819 * r956823;
        double r956825 = r956819 * r956824;
        double r956826 = -r956819;
        double r956827 = r956826 + r956819;
        double r956828 = r956821 * r956827;
        double r956829 = r956819 * r956819;
        double r956830 = r956828 * r956829;
        double r956831 = r956825 + r956830;
        return r956831;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.2
Target0.2
Herbie0.2
\[x \cdot \left(x \cdot \left(3 - x \cdot 2\right)\right)\]

Derivation

  1. Initial program 0.2

    \[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt0.4

    \[\leadsto \left(x \cdot x\right) \cdot \left(\color{blue}{\sqrt{3} \cdot \sqrt{3}} - x \cdot 2\right)\]
  4. Applied prod-diff0.4

    \[\leadsto \left(x \cdot x\right) \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt{3}, \sqrt{3}, -2 \cdot x\right) + \mathsf{fma}\left(-2, x, 2 \cdot x\right)\right)}\]
  5. Applied distribute-lft-in0.4

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

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

    \[\leadsto x \cdot \left(x \cdot \left(3 - x \cdot 2\right)\right) + \color{blue}{\left(2 \cdot \left(\left(-x\right) + x\right)\right) \cdot \left(x \cdot x\right)}\]
  8. Final simplification0.2

    \[\leadsto x \cdot \left(x \cdot \left(3 - x \cdot 2\right)\right) + \left(2 \cdot \left(\left(-x\right) + x\right)\right) \cdot \left(x \cdot x\right)\]

Reproduce

herbie shell --seed 2019305 +o rules:numerics
(FPCore (x)
  :name "Data.Spline.Key:interpolateKeys from smoothie-0.4.0.2"
  :precision binary64

  :herbie-target
  (* x (* x (- 3 (* x 2))))

  (* (* x x) (- 3 (* x 2))))