?

Average Accuracy: 99.7% → 99.7%
Time: 8.3s
Precision: binary64
Cost: 6976

?

\[0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
\[\mathsf{fma}\left(-0.12900613773279798 \cdot x, x \cdot x, x \cdot 0.954929658551372\right) \]
(FPCore (x)
 :precision binary64
 (- (* 0.954929658551372 x) (* 0.12900613773279798 (* (* x x) x))))
(FPCore (x)
 :precision binary64
 (fma (* -0.12900613773279798 x) (* x x) (* x 0.954929658551372)))
double code(double x) {
	return (0.954929658551372 * x) - (0.12900613773279798 * ((x * x) * x));
}
double code(double x) {
	return fma((-0.12900613773279798 * x), (x * x), (x * 0.954929658551372));
}
function code(x)
	return Float64(Float64(0.954929658551372 * x) - Float64(0.12900613773279798 * Float64(Float64(x * x) * x)))
end
function code(x)
	return fma(Float64(-0.12900613773279798 * x), Float64(x * x), Float64(x * 0.954929658551372))
end
code[x_] := N[(N[(0.954929658551372 * x), $MachinePrecision] - N[(0.12900613773279798 * N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[(-0.12900613773279798 * x), $MachinePrecision] * N[(x * x), $MachinePrecision] + N[(x * 0.954929658551372), $MachinePrecision]), $MachinePrecision]
0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right)
\mathsf{fma}\left(-0.12900613773279798 \cdot x, x \cdot x, x \cdot 0.954929658551372\right)

Error?

Derivation?

  1. Initial program 99.7%

    \[0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
  2. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.12900613773279798 \cdot x, x \cdot x, x \cdot 0.954929658551372\right)} \]
    Proof

    [Start]99.7

    \[ 0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \]

    sub-neg [=>]99.7

    \[ \color{blue}{0.954929658551372 \cdot x + \left(-0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right)\right)} \]

    +-commutative [=>]99.7

    \[ \color{blue}{\left(-0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right)\right) + 0.954929658551372 \cdot x} \]

    distribute-lft-neg-in [=>]99.7

    \[ \color{blue}{\left(-0.12900613773279798\right) \cdot \left(\left(x \cdot x\right) \cdot x\right)} + 0.954929658551372 \cdot x \]

    associate-*l* [=>]99.7

    \[ \left(-0.12900613773279798\right) \cdot \color{blue}{\left(x \cdot \left(x \cdot x\right)\right)} + 0.954929658551372 \cdot x \]

    associate-*r* [=>]99.7

    \[ \color{blue}{\left(\left(-0.12900613773279798\right) \cdot x\right) \cdot \left(x \cdot x\right)} + 0.954929658551372 \cdot x \]

    fma-def [=>]99.7

    \[ \color{blue}{\mathsf{fma}\left(\left(-0.12900613773279798\right) \cdot x, x \cdot x, 0.954929658551372 \cdot x\right)} \]

    metadata-eval [=>]99.7

    \[ \mathsf{fma}\left(\color{blue}{-0.12900613773279798} \cdot x, x \cdot x, 0.954929658551372 \cdot x\right) \]

    *-commutative [=>]99.7

    \[ \mathsf{fma}\left(-0.12900613773279798 \cdot x, x \cdot x, \color{blue}{x \cdot 0.954929658551372}\right) \]
  3. Final simplification99.7%

    \[\leadsto \mathsf{fma}\left(-0.12900613773279798 \cdot x, x \cdot x, x \cdot 0.954929658551372\right) \]

Alternatives

Alternative 1
Accuracy98.0%
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -2.7 \lor \neg \left(x \leq 2.7\right):\\ \;\;\;\;x \cdot \left(-0.12900613773279798 \cdot \left(x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 0.954929658551372\\ \end{array} \]
Alternative 2
Accuracy98.0%
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -2.7:\\ \;\;\;\;x \cdot \left(x \cdot \left(-0.12900613773279798 \cdot x\right)\right)\\ \mathbf{elif}\;x \leq 2.7:\\ \;\;\;\;x \cdot 0.954929658551372\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-0.12900613773279798 \cdot \left(x \cdot x\right)\right)\\ \end{array} \]
Alternative 3
Accuracy99.7%
Cost576
\[x \cdot \left(0.954929658551372 - x \cdot \left(x \cdot 0.12900613773279798\right)\right) \]
Alternative 4
Accuracy74.5%
Cost192
\[x \cdot 0.954929658551372 \]

Error

Reproduce?

herbie shell --seed 2023147 
(FPCore (x)
  :name "Rosa's Benchmark"
  :precision binary64
  (- (* 0.954929658551372 x) (* 0.12900613773279798 (* (* x x) x))))