?

Average Error: 36.0 → 28.5
Time: 16.4s
Precision: binary64
Cost: 40576

?

\[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
\[\begin{array}{l} t_0 := \cos \left(0.5 \cdot \frac{x}{y}\right)\\ \frac{1}{\left|\left(-t_0\right) \cdot \left(t_0 \cdot \frac{\frac{1}{t_0}}{t_0}\right)\right| \cdot t_0} \end{array} \]
(FPCore (x y)
 :precision binary64
 (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))))
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (cos (* 0.5 (/ x y)))))
   (/ 1.0 (* (fabs (* (- t_0) (* t_0 (/ (/ 1.0 t_0) t_0)))) t_0))))
double code(double x, double y) {
	return tan((x / (y * 2.0))) / sin((x / (y * 2.0)));
}
double code(double x, double y) {
	double t_0 = cos((0.5 * (x / y)));
	return 1.0 / (fabs((-t_0 * (t_0 * ((1.0 / t_0) / t_0)))) * t_0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = tan((x / (y * 2.0d0))) / sin((x / (y * 2.0d0)))
end function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    t_0 = cos((0.5d0 * (x / y)))
    code = 1.0d0 / (abs((-t_0 * (t_0 * ((1.0d0 / t_0) / t_0)))) * t_0)
end function
public static double code(double x, double y) {
	return Math.tan((x / (y * 2.0))) / Math.sin((x / (y * 2.0)));
}
public static double code(double x, double y) {
	double t_0 = Math.cos((0.5 * (x / y)));
	return 1.0 / (Math.abs((-t_0 * (t_0 * ((1.0 / t_0) / t_0)))) * t_0);
}
def code(x, y):
	return math.tan((x / (y * 2.0))) / math.sin((x / (y * 2.0)))
def code(x, y):
	t_0 = math.cos((0.5 * (x / y)))
	return 1.0 / (math.fabs((-t_0 * (t_0 * ((1.0 / t_0) / t_0)))) * t_0)
function code(x, y)
	return Float64(tan(Float64(x / Float64(y * 2.0))) / sin(Float64(x / Float64(y * 2.0))))
end
function code(x, y)
	t_0 = cos(Float64(0.5 * Float64(x / y)))
	return Float64(1.0 / Float64(abs(Float64(Float64(-t_0) * Float64(t_0 * Float64(Float64(1.0 / t_0) / t_0)))) * t_0))
end
function tmp = code(x, y)
	tmp = tan((x / (y * 2.0))) / sin((x / (y * 2.0)));
end
function tmp = code(x, y)
	t_0 = cos((0.5 * (x / y)));
	tmp = 1.0 / (abs((-t_0 * (t_0 * ((1.0 / t_0) / t_0)))) * t_0);
end
code[x_, y_] := N[(N[Tan[N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_, y_] := Block[{t$95$0 = N[Cos[N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(1.0 / N[(N[Abs[N[((-t$95$0) * N[(t$95$0 * N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]
\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}
\begin{array}{l}
t_0 := \cos \left(0.5 \cdot \frac{x}{y}\right)\\
\frac{1}{\left|\left(-t_0\right) \cdot \left(t_0 \cdot \frac{\frac{1}{t_0}}{t_0}\right)\right| \cdot t_0}
\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original36.0
Target28.9
Herbie28.5
\[\begin{array}{l} \mathbf{if}\;y < -1.2303690911306994 \cdot 10^{+114}:\\ \;\;\;\;1\\ \mathbf{elif}\;y < -9.102852406811914 \cdot 10^{-222}:\\ \;\;\;\;\frac{\sin \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right) \cdot \log \left(e^{\cos \left(\frac{x}{y \cdot 2}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Derivation?

  1. Initial program 36.0

    \[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
  2. Simplified36.0

    \[\leadsto \color{blue}{\frac{\tan \left(\frac{x}{y + y}\right)}{\sin \left(\frac{x}{y + y}\right)}} \]
    Proof

    [Start]36.0

    \[ \frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]

    metadata-eval [<=]36.0

    \[ \frac{\tan \left(\frac{x}{y \cdot \color{blue}{\left(1 + 1\right)}}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]

    metadata-eval [<=]36.0

    \[ \frac{\tan \left(\frac{x}{y \cdot \left(\color{blue}{\frac{2}{2}} + 1\right)}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]

    metadata-eval [<=]36.0

    \[ \frac{\tan \left(\frac{x}{y \cdot \left(\frac{2}{2} + \color{blue}{\frac{2}{2}}\right)}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-23 [<=]36.0

    \[ \frac{\tan \left(\frac{x}{\color{blue}{\frac{2}{2} \cdot y + y \cdot \frac{2}{2}}}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-74 [<=]36.0

    \[ \frac{\tan \left(\frac{x}{\color{blue}{y \cdot \frac{2}{2}} + y \cdot \frac{2}{2}}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]

    metadata-eval [=>]36.0

    \[ \frac{\tan \left(\frac{x}{y \cdot \color{blue}{1} + y \cdot \frac{2}{2}}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-52 [=>]36.0

    \[ \frac{\tan \left(\frac{x}{\color{blue}{y} + y \cdot \frac{2}{2}}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]

    metadata-eval [=>]36.0

    \[ \frac{\tan \left(\frac{x}{y + y \cdot \color{blue}{1}}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-52 [=>]36.0

    \[ \frac{\tan \left(\frac{x}{y + \color{blue}{y}}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]

    metadata-eval [<=]36.0

    \[ \frac{\tan \left(\frac{x}{y + y}\right)}{\sin \left(\frac{x}{y \cdot \color{blue}{\left(1 + 1\right)}}\right)} \]

    metadata-eval [<=]36.0

    \[ \frac{\tan \left(\frac{x}{y + y}\right)}{\sin \left(\frac{x}{y \cdot \left(\color{blue}{\frac{2}{2}} + 1\right)}\right)} \]

    metadata-eval [<=]36.0

    \[ \frac{\tan \left(\frac{x}{y + y}\right)}{\sin \left(\frac{x}{y \cdot \left(\frac{2}{2} + \color{blue}{\frac{2}{2}}\right)}\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-23 [<=]36.0

    \[ \frac{\tan \left(\frac{x}{y + y}\right)}{\sin \left(\frac{x}{\color{blue}{\frac{2}{2} \cdot y + y \cdot \frac{2}{2}}}\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-74 [<=]36.0

    \[ \frac{\tan \left(\frac{x}{y + y}\right)}{\sin \left(\frac{x}{\color{blue}{y \cdot \frac{2}{2}} + y \cdot \frac{2}{2}}\right)} \]

    metadata-eval [=>]36.0

    \[ \frac{\tan \left(\frac{x}{y + y}\right)}{\sin \left(\frac{x}{y \cdot \color{blue}{1} + y \cdot \frac{2}{2}}\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-52 [=>]36.0

    \[ \frac{\tan \left(\frac{x}{y + y}\right)}{\sin \left(\frac{x}{\color{blue}{y} + y \cdot \frac{2}{2}}\right)} \]

    metadata-eval [=>]36.0

    \[ \frac{\tan \left(\frac{x}{y + y}\right)}{\sin \left(\frac{x}{y + y \cdot \color{blue}{1}}\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-52 [=>]36.0

    \[ \frac{\tan \left(\frac{x}{y + y}\right)}{\sin \left(\frac{x}{y + \color{blue}{y}}\right)} \]
  3. Taylor expanded in x around inf 28.5

    \[\leadsto \color{blue}{\frac{1}{\cos \left(0.5 \cdot \frac{x}{y}\right)}} \]
  4. Applied egg-rr28.5

    \[\leadsto \frac{1}{\color{blue}{\left(\cos \left(0.5 \cdot \frac{x}{y}\right) \cdot \frac{1}{\cos \left(0.5 \cdot \frac{x}{y}\right)}\right) \cdot \cos \left(0.5 \cdot \frac{x}{y}\right)}} \]
  5. Applied egg-rr28.5

    \[\leadsto \frac{1}{\color{blue}{\left|\left(-\cos \left(0.5 \cdot \frac{x}{y}\right)\right) \cdot \left(\cos \left(0.5 \cdot \frac{x}{y}\right) \cdot \frac{\frac{1}{\cos \left(0.5 \cdot \frac{x}{y}\right)}}{\cos \left(0.5 \cdot \frac{x}{y}\right)}\right)\right|} \cdot \cos \left(0.5 \cdot \frac{x}{y}\right)} \]
  6. Final simplification28.5

    \[\leadsto \frac{1}{\left|\left(-\cos \left(0.5 \cdot \frac{x}{y}\right)\right) \cdot \left(\cos \left(0.5 \cdot \frac{x}{y}\right) \cdot \frac{\frac{1}{\cos \left(0.5 \cdot \frac{x}{y}\right)}}{\cos \left(0.5 \cdot \frac{x}{y}\right)}\right)\right| \cdot \cos \left(0.5 \cdot \frac{x}{y}\right)} \]

Alternatives

Alternative 1
Error28.5
Cost40256
\[\begin{array}{l} t_0 := \cos \left(0.5 \cdot \frac{x}{y}\right)\\ \frac{1}{\left|\left(-t_0\right) \cdot \left(t_0 \cdot \frac{1}{{t_0}^{2}}\right)\right| \cdot t_0} \end{array} \]
Alternative 2
Error28.5
Cost34240
\[\begin{array}{l} t_0 := \cos \left(0.5 \cdot \frac{x}{y}\right)\\ t_1 := \frac{1}{t_0}\\ \frac{1}{\left(\left(\left(t_0 \cdot t_1\right) \cdot t_0\right) \cdot t_1\right) \cdot t_0} \end{array} \]
Alternative 3
Error28.5
Cost20544
\[\begin{array}{l} t_0 := \cos \left(0.5 \cdot \frac{x}{y}\right)\\ \frac{1}{\left(t_0 \cdot \frac{1}{t_0}\right) \cdot t_0} \end{array} \]
Alternative 4
Error28.5
Cost6848
\[\frac{1}{\cos \left(0.5 \cdot \frac{x}{y}\right)} \]
Alternative 5
Error60.0
Cost64
\[-2 \]
Alternative 6
Error28.7
Cost64
\[1 \]

Error

Reproduce?

herbie shell --seed 2023090 
(FPCore (x y)
  :name "Diagrams.TwoD.Layout.CirclePacking:approxRadius from diagrams-contrib-1.3.0.5"
  :precision binary64

  :herbie-target
  (if (< y -1.2303690911306994e+114) 1.0 (if (< y -9.102852406811914e-222) (/ (sin (/ x (* y 2.0))) (* (sin (/ x (* y 2.0))) (log (exp (cos (/ x (* y 2.0))))))) 1.0))

  (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))))