?

Average Error: 30.5 → 0.0
Time: 6.0s
Precision: binary64
Cost: 20096

?

\[-0.01 \leq x \land x \leq 0.01\]
\[1 - \cos x \]
\[0.5 \cdot {x}^{2} + \left(-0.041666666666666664 \cdot {x}^{4} + 0.001388888888888889 \cdot {x}^{6}\right) \]
(FPCore (x) :precision binary64 (- 1.0 (cos x)))
(FPCore (x)
 :precision binary64
 (+
  (* 0.5 (pow x 2.0))
  (+
   (* -0.041666666666666664 (pow x 4.0))
   (* 0.001388888888888889 (pow x 6.0)))))
double code(double x) {
	return 1.0 - cos(x);
}
double code(double x) {
	return (0.5 * pow(x, 2.0)) + ((-0.041666666666666664 * pow(x, 4.0)) + (0.001388888888888889 * pow(x, 6.0)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 1.0d0 - cos(x)
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = (0.5d0 * (x ** 2.0d0)) + (((-0.041666666666666664d0) * (x ** 4.0d0)) + (0.001388888888888889d0 * (x ** 6.0d0)))
end function
public static double code(double x) {
	return 1.0 - Math.cos(x);
}
public static double code(double x) {
	return (0.5 * Math.pow(x, 2.0)) + ((-0.041666666666666664 * Math.pow(x, 4.0)) + (0.001388888888888889 * Math.pow(x, 6.0)));
}
def code(x):
	return 1.0 - math.cos(x)
def code(x):
	return (0.5 * math.pow(x, 2.0)) + ((-0.041666666666666664 * math.pow(x, 4.0)) + (0.001388888888888889 * math.pow(x, 6.0)))
function code(x)
	return Float64(1.0 - cos(x))
end
function code(x)
	return Float64(Float64(0.5 * (x ^ 2.0)) + Float64(Float64(-0.041666666666666664 * (x ^ 4.0)) + Float64(0.001388888888888889 * (x ^ 6.0))))
end
function tmp = code(x)
	tmp = 1.0 - cos(x);
end
function tmp = code(x)
	tmp = (0.5 * (x ^ 2.0)) + ((-0.041666666666666664 * (x ^ 4.0)) + (0.001388888888888889 * (x ^ 6.0)));
end
code[x_] := N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[(0.5 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.041666666666666664 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(0.001388888888888889 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
1 - \cos x
0.5 \cdot {x}^{2} + \left(-0.041666666666666664 \cdot {x}^{4} + 0.001388888888888889 \cdot {x}^{6}\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original30.5
Target0.0
Herbie0.0
\[\frac{\sin x \cdot \sin x}{1 + \cos x} \]

Derivation?

  1. Initial program 30.5

    \[1 - \cos x \]
  2. Taylor expanded in x around 0 0.0

    \[\leadsto \color{blue}{0.5 \cdot {x}^{2} + \left(-0.041666666666666664 \cdot {x}^{4} + 0.001388888888888889 \cdot {x}^{6}\right)} \]
  3. Final simplification0.0

    \[\leadsto 0.5 \cdot {x}^{2} + \left(-0.041666666666666664 \cdot {x}^{4} + 0.001388888888888889 \cdot {x}^{6}\right) \]

Alternatives

Alternative 1
Error0.1
Cost13376
\[0.5 \cdot {x}^{2} + -0.041666666666666664 \cdot {x}^{4} \]
Alternative 2
Error0.3
Cost6656
\[0.5 \cdot {x}^{2} \]
Alternative 3
Error30.5
Cost6592
\[1 - \cos x \]

Error

Reproduce?

herbie shell --seed 2023104 
(FPCore (x)
  :name "ENA, Section 1.4, Mentioned, A"
  :precision binary64
  :pre (and (<= -0.01 x) (<= x 0.01))

  :herbie-target
  (/ (* (sin x) (sin x)) (+ 1.0 (cos x)))

  (- 1.0 (cos x)))