Average Error: 0.2 → 0.2
Time: 9.4s
Precision: binary64
Cost: 6912
\[0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
\[0.954929658551372 \cdot x + {x}^{3} \cdot -0.12900613773279798 \]
(FPCore (x)
 :precision binary64
 (- (* 0.954929658551372 x) (* 0.12900613773279798 (* (* x x) x))))
(FPCore (x)
 :precision binary64
 (+ (* 0.954929658551372 x) (* (pow x 3.0) -0.12900613773279798)))
double code(double x) {
	return (0.954929658551372 * x) - (0.12900613773279798 * ((x * x) * x));
}
double code(double x) {
	return (0.954929658551372 * x) + (pow(x, 3.0) * -0.12900613773279798);
}
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 = (0.954929658551372d0 * x) + ((x ** 3.0d0) * (-0.12900613773279798d0))
end function
public static double code(double x) {
	return (0.954929658551372 * x) - (0.12900613773279798 * ((x * x) * x));
}
public static double code(double x) {
	return (0.954929658551372 * x) + (Math.pow(x, 3.0) * -0.12900613773279798);
}
def code(x):
	return (0.954929658551372 * x) - (0.12900613773279798 * ((x * x) * x))
def code(x):
	return (0.954929658551372 * x) + (math.pow(x, 3.0) * -0.12900613773279798)
function code(x)
	return Float64(Float64(0.954929658551372 * x) - Float64(0.12900613773279798 * Float64(Float64(x * x) * x)))
end
function code(x)
	return Float64(Float64(0.954929658551372 * x) + Float64((x ^ 3.0) * -0.12900613773279798))
end
function tmp = code(x)
	tmp = (0.954929658551372 * x) - (0.12900613773279798 * ((x * x) * x));
end
function tmp = code(x)
	tmp = (0.954929658551372 * x) + ((x ^ 3.0) * -0.12900613773279798);
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.954929658551372 * x), $MachinePrecision] + N[(N[Power[x, 3.0], $MachinePrecision] * -0.12900613773279798), $MachinePrecision]), $MachinePrecision]
0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right)
0.954929658551372 \cdot x + {x}^{3} \cdot -0.12900613773279798

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. Taylor expanded in x around 0 0.2

    \[\leadsto 0.954929658551372 \cdot x - \color{blue}{0.12900613773279798 \cdot {x}^{3}} \]
  3. Simplified0.2

    \[\leadsto 0.954929658551372 \cdot x - \color{blue}{{x}^{3} \cdot 0.12900613773279798} \]
    Proof
    (*.f64 (pow.f64 x 3) 6450306886639899/50000000000000000): 0 points increase in error, 0 points decrease in error
    (Rewrite<= *-commutative_binary64 (*.f64 6450306886639899/50000000000000000 (pow.f64 x 3))): 0 points increase in error, 0 points decrease in error
  4. Final simplification0.2

    \[\leadsto 0.954929658551372 \cdot x + {x}^{3} \cdot -0.12900613773279798 \]

Alternatives

Alternative 1
Error1.3
Cost712
\[\begin{array}{l} t_0 := x \cdot \left(\left(x \cdot x\right) \cdot -0.12900613773279798\right)\\ \mathbf{if}\;x \leq -118.06169231450599:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.914553418566181:\\ \;\;\;\;0.954929658551372 \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error1.3
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -118.06169231450599:\\ \;\;\;\;x \cdot \left(x \cdot \left(x \cdot -0.12900613773279798\right)\right)\\ \mathbf{elif}\;x \leq 1.914553418566181:\\ \;\;\;\;0.954929658551372 \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\left(x \cdot x\right) \cdot -0.12900613773279798\right)\\ \end{array} \]
Alternative 3
Error0.2
Cost704
\[0.954929658551372 \cdot x + x \cdot \left(x \cdot \left(x \cdot -0.12900613773279798\right)\right) \]
Alternative 4
Error0.2
Cost704
\[0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(x \cdot \left(x \cdot x\right)\right) \]
Alternative 5
Error0.2
Cost576
\[x \cdot \left(0.954929658551372 + x \cdot \left(x \cdot -0.12900613773279798\right)\right) \]
Alternative 6
Error0.2
Cost576
\[x \cdot \left(0.954929658551372 + \left(x \cdot x\right) \cdot -0.12900613773279798\right) \]
Alternative 7
Error16.7
Cost192
\[0.954929658551372 \cdot x \]

Error

Reproduce

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