?

Average Error: 0.2 → 0.2
Time: 9.6s
Precision: binary64
Cost: 704

?

\[0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
\[\left(x \cdot -0.12900613773279798\right) \cdot \left(x \cdot x\right) + x \cdot 0.954929658551372 \]
(FPCore (x)
 :precision binary64
 (- (* 0.954929658551372 x) (* 0.12900613773279798 (* (* x x) x))))
(FPCore (x)
 :precision binary64
 (+ (* (* x -0.12900613773279798) (* x x)) (* x 0.954929658551372)))
double code(double x) {
	return (0.954929658551372 * x) - (0.12900613773279798 * ((x * x) * x));
}
double code(double x) {
	return ((x * -0.12900613773279798) * (x * x)) + (x * 0.954929658551372);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (0.954929658551372d0 * x) - (0.12900613773279798d0 * ((x * x) * x))
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((x * (-0.12900613773279798d0)) * (x * x)) + (x * 0.954929658551372d0)
end function
public static double code(double x) {
	return (0.954929658551372 * x) - (0.12900613773279798 * ((x * x) * x));
}
public static double code(double x) {
	return ((x * -0.12900613773279798) * (x * x)) + (x * 0.954929658551372);
}
def code(x):
	return (0.954929658551372 * x) - (0.12900613773279798 * ((x * x) * x))
def code(x):
	return ((x * -0.12900613773279798) * (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 Float64(Float64(Float64(x * -0.12900613773279798) * Float64(x * x)) + Float64(x * 0.954929658551372))
end
function tmp = code(x)
	tmp = (0.954929658551372 * x) - (0.12900613773279798 * ((x * x) * x));
end
function tmp = code(x)
	tmp = ((x * -0.12900613773279798) * (x * x)) + (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[(N[(x * -0.12900613773279798), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(x * 0.954929658551372), $MachinePrecision]), $MachinePrecision]
0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right)
\left(x \cdot -0.12900613773279798\right) \cdot \left(x \cdot x\right) + x \cdot 0.954929658551372

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.2

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

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

    [Start]0.2

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

    associate-*r* [=>]0.2

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

    distribute-rgt-out-- [=>]0.2

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

    cancel-sign-sub-inv [=>]0.2

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

    +-commutative [<=]0.2

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

    associate-*r* [=>]0.2

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

    *-commutative [=>]0.2

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

    fma-def [=>]0.2

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

    *-commutative [=>]0.2

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

    metadata-eval [=>]0.2

    \[ x \cdot \mathsf{fma}\left(x, x \cdot \color{blue}{-0.12900613773279798}, 0.954929658551372\right) \]
  3. Applied egg-rr4.7

    \[\leadsto x \cdot \color{blue}{\frac{\left(x \cdot \left(x \cdot -0.12900613773279798\right)\right) \cdot \left(x \cdot \left(x \cdot -0.12900613773279798\right)\right) - 0.9118906527810399}{x \cdot \left(x \cdot -0.12900613773279798\right) - 0.954929658551372}} \]
  4. Applied egg-rr0.2

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

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

Alternatives

Alternative 1
Error1.2
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
Error1.2
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -2.7:\\ \;\;\;\;x \cdot \left(x \cdot \left(x \cdot -0.12900613773279798\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
Error0.2
Cost576
\[x \cdot \left(0.954929658551372 + x \cdot \left(x \cdot -0.12900613773279798\right)\right) \]
Alternative 4
Error16.3
Cost192
\[x \cdot 0.954929658551372 \]

Error

Reproduce?

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