?

Average Accuracy: 52.5% → 99.0%
Time: 19.0s
Precision: binary64
Cost: 6976

?

\[-1 \leq x \land x \leq 1\]
\[\frac{x - \sin x}{\tan x} \]
\[\frac{x}{\frac{\frac{\tan x}{x} \cdot 6}{x}} \]
(FPCore (x) :precision binary64 (/ (- x (sin x)) (tan x)))
(FPCore (x) :precision binary64 (/ x (/ (* (/ (tan x) x) 6.0) x)))
double code(double x) {
	return (x - sin(x)) / tan(x);
}
double code(double x) {
	return x / (((tan(x) / x) * 6.0) / x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (x - sin(x)) / tan(x)
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = x / (((tan(x) / x) * 6.0d0) / x)
end function
public static double code(double x) {
	return (x - Math.sin(x)) / Math.tan(x);
}
public static double code(double x) {
	return x / (((Math.tan(x) / x) * 6.0) / x);
}
def code(x):
	return (x - math.sin(x)) / math.tan(x)
def code(x):
	return x / (((math.tan(x) / x) * 6.0) / x)
function code(x)
	return Float64(Float64(x - sin(x)) / tan(x))
end
function code(x)
	return Float64(x / Float64(Float64(Float64(tan(x) / x) * 6.0) / x))
end
function tmp = code(x)
	tmp = (x - sin(x)) / tan(x);
end
function tmp = code(x)
	tmp = x / (((tan(x) / x) * 6.0) / x);
end
code[x_] := N[(N[(x - N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[Tan[x], $MachinePrecision]), $MachinePrecision]
code[x_] := N[(x / N[(N[(N[(N[Tan[x], $MachinePrecision] / x), $MachinePrecision] * 6.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\frac{x - \sin x}{\tan x}
\frac{x}{\frac{\frac{\tan x}{x} \cdot 6}{x}}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original52.5%
Target98.8%
Herbie99.0%
\[0.16666666666666666 \cdot \left(x \cdot x\right) \]

Derivation?

  1. Initial program 52.5%

    \[\frac{x - \sin x}{\tan x} \]
  2. Taylor expanded in x around 0 83.2%

    \[\leadsto \frac{\color{blue}{0.16666666666666666 \cdot {x}^{3}}}{\tan x} \]
  3. Applied egg-rr98.9%

    \[\leadsto \color{blue}{\frac{0.16666666666666666}{\frac{\tan x}{x}} \cdot \left(x \cdot x\right)} \]
    Proof

    [Start]83.2

    \[ \frac{0.16666666666666666 \cdot {x}^{3}}{\tan x} \]

    associate-/l* [=>]83.2

    \[ \color{blue}{\frac{0.16666666666666666}{\frac{\tan x}{{x}^{3}}}} \]

    cube-mult [=>]83.2

    \[ \frac{0.16666666666666666}{\frac{\tan x}{\color{blue}{x \cdot \left(x \cdot x\right)}}} \]

    associate-/r* [=>]97.9

    \[ \frac{0.16666666666666666}{\color{blue}{\frac{\frac{\tan x}{x}}{x \cdot x}}} \]

    associate-/r/ [=>]98.9

    \[ \color{blue}{\frac{0.16666666666666666}{\frac{\tan x}{x}} \cdot \left(x \cdot x\right)} \]
  4. Applied egg-rr99.0%

    \[\leadsto \color{blue}{\frac{x}{\frac{\frac{\tan x}{x} \cdot 6}{x}}} \]
    Proof

    [Start]98.9

    \[ \frac{0.16666666666666666}{\frac{\tan x}{x}} \cdot \left(x \cdot x\right) \]

    associate-*l/ [=>]98.9

    \[ \color{blue}{\frac{0.16666666666666666 \cdot \left(x \cdot x\right)}{\frac{\tan x}{x}}} \]

    *-commutative [=>]98.9

    \[ \frac{\color{blue}{\left(x \cdot x\right) \cdot 0.16666666666666666}}{\frac{\tan x}{x}} \]

    associate-/l* [=>]99.0

    \[ \color{blue}{\frac{x \cdot x}{\frac{\frac{\tan x}{x}}{0.16666666666666666}}} \]

    associate-/l* [=>]99.0

    \[ \color{blue}{\frac{x}{\frac{\frac{\frac{\tan x}{x}}{0.16666666666666666}}{x}}} \]

    div-inv [=>]99.0

    \[ \frac{x}{\frac{\color{blue}{\frac{\tan x}{x} \cdot \frac{1}{0.16666666666666666}}}{x}} \]

    metadata-eval [=>]99.0

    \[ \frac{x}{\frac{\frac{\tan x}{x} \cdot \color{blue}{6}}{x}} \]
  5. Final simplification99.0%

    \[\leadsto \frac{x}{\frac{\frac{\tan x}{x} \cdot 6}{x}} \]

Alternatives

Alternative 1
Accuracy98.8%
Cost320
\[0.16666666666666666 \cdot \left(x \cdot x\right) \]
Alternative 2
Accuracy98.9%
Cost320
\[x \cdot \frac{x}{6} \]
Alternative 3
Accuracy98.9%
Cost320
\[\frac{x}{\frac{6}{x}} \]

Error

Reproduce?

herbie shell --seed 2023133 
(FPCore (x)
  :name "ENA, Section 1.4, Exercise 4a"
  :precision binary64
  :pre (and (<= -1.0 x) (<= x 1.0))

  :herbie-target
  (* 0.16666666666666666 (* x x))

  (/ (- x (sin x)) (tan x)))