?

Average Accuracy: 53.6% → 99.4%
Time: 20.2s
Precision: binary64
Cost: 7424

?

\[-1 \leq x \land x \leq 1\]
\[\frac{x - \sin x}{\tan x} \]
\[x \cdot \left(0.16666666666666666 \cdot x\right) + {x}^{4} \cdot \left(\left(x \cdot x\right) \cdot -0.0007275132275132275 + -0.06388888888888888\right) \]
(FPCore (x) :precision binary64 (/ (- x (sin x)) (tan x)))
(FPCore (x)
 :precision binary64
 (+
  (* x (* 0.16666666666666666 x))
  (* (pow x 4.0) (+ (* (* x x) -0.0007275132275132275) -0.06388888888888888))))
double code(double x) {
	return (x - sin(x)) / tan(x);
}
double code(double x) {
	return (x * (0.16666666666666666 * x)) + (pow(x, 4.0) * (((x * x) * -0.0007275132275132275) + -0.06388888888888888));
}
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 * (0.16666666666666666d0 * x)) + ((x ** 4.0d0) * (((x * x) * (-0.0007275132275132275d0)) + (-0.06388888888888888d0)))
end function
public static double code(double x) {
	return (x - Math.sin(x)) / Math.tan(x);
}
public static double code(double x) {
	return (x * (0.16666666666666666 * x)) + (Math.pow(x, 4.0) * (((x * x) * -0.0007275132275132275) + -0.06388888888888888));
}
def code(x):
	return (x - math.sin(x)) / math.tan(x)
def code(x):
	return (x * (0.16666666666666666 * x)) + (math.pow(x, 4.0) * (((x * x) * -0.0007275132275132275) + -0.06388888888888888))
function code(x)
	return Float64(Float64(x - sin(x)) / tan(x))
end
function code(x)
	return Float64(Float64(x * Float64(0.16666666666666666 * x)) + Float64((x ^ 4.0) * Float64(Float64(Float64(x * x) * -0.0007275132275132275) + -0.06388888888888888)))
end
function tmp = code(x)
	tmp = (x - sin(x)) / tan(x);
end
function tmp = code(x)
	tmp = (x * (0.16666666666666666 * x)) + ((x ^ 4.0) * (((x * x) * -0.0007275132275132275) + -0.06388888888888888));
end
code[x_] := N[(N[(x - N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[Tan[x], $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[(x * N[(0.16666666666666666 * x), $MachinePrecision]), $MachinePrecision] + N[(N[Power[x, 4.0], $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * -0.0007275132275132275), $MachinePrecision] + -0.06388888888888888), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x - \sin x}{\tan x}
x \cdot \left(0.16666666666666666 \cdot x\right) + {x}^{4} \cdot \left(\left(x \cdot x\right) \cdot -0.0007275132275132275 + -0.06388888888888888\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original53.6%
Target98.6%
Herbie99.4%
\[0.16666666666666666 \cdot \left(x \cdot x\right) \]

Derivation?

  1. Initial program 53.6%

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

    \[\leadsto \color{blue}{0.16666666666666666 \cdot {x}^{2} + \left(-0.0007275132275132275 \cdot {x}^{6} + -0.06388888888888888 \cdot {x}^{4}\right)} \]
  3. Applied egg-rr99.4%

    \[\leadsto 0.16666666666666666 \cdot {x}^{2} + \color{blue}{{x}^{4} \cdot \left(\left(x \cdot x\right) \cdot -0.0007275132275132275 + -0.06388888888888888\right)} \]
    Proof

    [Start]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \left(-0.0007275132275132275 \cdot {x}^{6} + -0.06388888888888888 \cdot {x}^{4}\right) \]

    *-commutative [=>]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \left(\color{blue}{{x}^{6} \cdot -0.0007275132275132275} + -0.06388888888888888 \cdot {x}^{4}\right) \]

    add-cube-cbrt [=>]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \left(\color{blue}{\left(\left(\sqrt[3]{{x}^{6}} \cdot \sqrt[3]{{x}^{6}}\right) \cdot \sqrt[3]{{x}^{6}}\right)} \cdot -0.0007275132275132275 + -0.06388888888888888 \cdot {x}^{4}\right) \]

    associate-*l* [=>]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \left(\color{blue}{\left(\sqrt[3]{{x}^{6}} \cdot \sqrt[3]{{x}^{6}}\right) \cdot \left(\sqrt[3]{{x}^{6}} \cdot -0.0007275132275132275\right)} + -0.06388888888888888 \cdot {x}^{4}\right) \]

    pow2 [=>]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \left(\color{blue}{{\left(\sqrt[3]{{x}^{6}}\right)}^{2}} \cdot \left(\sqrt[3]{{x}^{6}} \cdot -0.0007275132275132275\right) + -0.06388888888888888 \cdot {x}^{4}\right) \]

    metadata-eval [<=]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \left({\left(\sqrt[3]{{x}^{\color{blue}{\left(4 + 2\right)}}}\right)}^{2} \cdot \left(\sqrt[3]{{x}^{6}} \cdot -0.0007275132275132275\right) + -0.06388888888888888 \cdot {x}^{4}\right) \]

    pow-prod-up [<=]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \left({\left(\sqrt[3]{\color{blue}{{x}^{4} \cdot {x}^{2}}}\right)}^{2} \cdot \left(\sqrt[3]{{x}^{6}} \cdot -0.0007275132275132275\right) + -0.06388888888888888 \cdot {x}^{4}\right) \]

    metadata-eval [<=]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \left({\left(\sqrt[3]{{x}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot {x}^{2}}\right)}^{2} \cdot \left(\sqrt[3]{{x}^{6}} \cdot -0.0007275132275132275\right) + -0.06388888888888888 \cdot {x}^{4}\right) \]

    pow-sqr [<=]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \left({\left(\sqrt[3]{\color{blue}{\left({x}^{2} \cdot {x}^{2}\right)} \cdot {x}^{2}}\right)}^{2} \cdot \left(\sqrt[3]{{x}^{6}} \cdot -0.0007275132275132275\right) + -0.06388888888888888 \cdot {x}^{4}\right) \]

    add-cbrt-cube [<=]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \left({\color{blue}{\left({x}^{2}\right)}}^{2} \cdot \left(\sqrt[3]{{x}^{6}} \cdot -0.0007275132275132275\right) + -0.06388888888888888 \cdot {x}^{4}\right) \]

    pow2 [<=]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \left(\color{blue}{\left({x}^{2} \cdot {x}^{2}\right)} \cdot \left(\sqrt[3]{{x}^{6}} \cdot -0.0007275132275132275\right) + -0.06388888888888888 \cdot {x}^{4}\right) \]

    pow-sqr [=>]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \left(\color{blue}{{x}^{\left(2 \cdot 2\right)}} \cdot \left(\sqrt[3]{{x}^{6}} \cdot -0.0007275132275132275\right) + -0.06388888888888888 \cdot {x}^{4}\right) \]

    metadata-eval [=>]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \left({x}^{\color{blue}{4}} \cdot \left(\sqrt[3]{{x}^{6}} \cdot -0.0007275132275132275\right) + -0.06388888888888888 \cdot {x}^{4}\right) \]

    *-commutative [=>]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \left({x}^{4} \cdot \left(\sqrt[3]{{x}^{6}} \cdot -0.0007275132275132275\right) + \color{blue}{{x}^{4} \cdot -0.06388888888888888}\right) \]

    distribute-lft-out [=>]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + \color{blue}{{x}^{4} \cdot \left(\sqrt[3]{{x}^{6}} \cdot -0.0007275132275132275 + -0.06388888888888888\right)} \]
  4. Applied egg-rr53.1%

    \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right)\right)} - 1\right)} + {x}^{4} \cdot \left(\left(x \cdot x\right) \cdot -0.0007275132275132275 + -0.06388888888888888\right) \]
    Proof

    [Start]99.4

    \[ 0.16666666666666666 \cdot {x}^{2} + {x}^{4} \cdot \left(\left(x \cdot x\right) \cdot -0.0007275132275132275 + -0.06388888888888888\right) \]

    expm1-log1p-u [=>]99.4

    \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(0.16666666666666666 \cdot {x}^{2}\right)\right)} + {x}^{4} \cdot \left(\left(x \cdot x\right) \cdot -0.0007275132275132275 + -0.06388888888888888\right) \]

    expm1-udef [=>]53.1

    \[ \color{blue}{\left(e^{\mathsf{log1p}\left(0.16666666666666666 \cdot {x}^{2}\right)} - 1\right)} + {x}^{4} \cdot \left(\left(x \cdot x\right) \cdot -0.0007275132275132275 + -0.06388888888888888\right) \]

    unpow2 [=>]53.1

    \[ \left(e^{\mathsf{log1p}\left(0.16666666666666666 \cdot \color{blue}{\left(x \cdot x\right)}\right)} - 1\right) + {x}^{4} \cdot \left(\left(x \cdot x\right) \cdot -0.0007275132275132275 + -0.06388888888888888\right) \]
  5. Simplified99.4%

    \[\leadsto \color{blue}{\left(0.16666666666666666 \cdot x\right) \cdot x} + {x}^{4} \cdot \left(\left(x \cdot x\right) \cdot -0.0007275132275132275 + -0.06388888888888888\right) \]
    Proof

    [Start]53.1

    \[ \left(e^{\mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right)\right)} - 1\right) + {x}^{4} \cdot \left(\left(x \cdot x\right) \cdot -0.0007275132275132275 + -0.06388888888888888\right) \]

    expm1-def [=>]99.4

    \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(0.16666666666666666 \cdot \left(x \cdot x\right)\right)\right)} + {x}^{4} \cdot \left(\left(x \cdot x\right) \cdot -0.0007275132275132275 + -0.06388888888888888\right) \]

    expm1-log1p [=>]99.4

    \[ \color{blue}{0.16666666666666666 \cdot \left(x \cdot x\right)} + {x}^{4} \cdot \left(\left(x \cdot x\right) \cdot -0.0007275132275132275 + -0.06388888888888888\right) \]

    associate-*r* [=>]99.4

    \[ \color{blue}{\left(0.16666666666666666 \cdot x\right) \cdot x} + {x}^{4} \cdot \left(\left(x \cdot x\right) \cdot -0.0007275132275132275 + -0.06388888888888888\right) \]
  6. Final simplification99.4%

    \[\leadsto x \cdot \left(0.16666666666666666 \cdot x\right) + {x}^{4} \cdot \left(\left(x \cdot x\right) \cdot -0.0007275132275132275 + -0.06388888888888888\right) \]

Alternatives

Alternative 1
Accuracy99.3%
Cost7040
\[x \cdot \left(0.16666666666666666 \cdot x\right) + {x}^{4} \cdot -0.06388888888888888 \]
Alternative 2
Accuracy98.7%
Cost6976
\[x \cdot \left(x \cdot \frac{0.16666666666666666}{\frac{\tan x}{x}}\right) \]
Alternative 3
Accuracy98.7%
Cost6976
\[\left(x \cdot \left(0.16666666666666666 \cdot x\right)\right) \cdot \frac{x}{\tan x} \]
Alternative 4
Accuracy98.8%
Cost6976
\[\frac{x}{\tan x} \cdot \left(x \cdot \frac{x}{6}\right) \]
Alternative 5
Accuracy98.6%
Cost320
\[0.16666666666666666 \cdot \left(x \cdot x\right) \]
Alternative 6
Accuracy98.6%
Cost320
\[x \cdot \left(0.16666666666666666 \cdot x\right) \]
Alternative 7
Accuracy98.7%
Cost320
\[\frac{x}{\frac{6}{x}} \]
Alternative 8
Accuracy98.7%
Cost320
\[\frac{x \cdot x}{6} \]

Error

Reproduce?

herbie shell --seed 2023131 
(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)))