Average Error: 35.7 → 28.1
Time: 12.6s
Precision: binary64
Cost: 45824
\[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
\[\begin{array}{l} t_0 := \sqrt[3]{x \cdot \frac{0.5}{y}}\\ \frac{1}{\cos \left({\left({\left({t_0}^{2}\right)}^{0.3333333333333333} \cdot \sqrt[3]{t_0}\right)}^{3}\right)} \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 (cbrt (* x (/ 0.5 y)))))
   (/
    1.0
    (cos (pow (* (pow (pow t_0 2.0) 0.3333333333333333) (cbrt t_0)) 3.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 = cbrt((x * (0.5 / y)));
	return 1.0 / cos(pow((pow(pow(t_0, 2.0), 0.3333333333333333) * cbrt(t_0)), 3.0));
}
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.cbrt((x * (0.5 / y)));
	return 1.0 / Math.cos(Math.pow((Math.pow(Math.pow(t_0, 2.0), 0.3333333333333333) * Math.cbrt(t_0)), 3.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 = cbrt(Float64(x * Float64(0.5 / y)))
	return Float64(1.0 / cos((Float64(((t_0 ^ 2.0) ^ 0.3333333333333333) * cbrt(t_0)) ^ 3.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[Power[N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 / N[Cos[N[Power[N[(N[Power[N[Power[t$95$0, 2.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision] * N[Power[t$95$0, 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}
\begin{array}{l}
t_0 := \sqrt[3]{x \cdot \frac{0.5}{y}}\\
\frac{1}{\cos \left({\left({\left({t_0}^{2}\right)}^{0.3333333333333333} \cdot \sqrt[3]{t_0}\right)}^{3}\right)}
\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original35.7
Target28.5
Herbie28.1
\[\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 35.7

    \[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \]
  2. Applied egg-rr29.8

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\cos \left(x \cdot \frac{0.5}{y}\right)}\right)\right)} \]
  3. Taylor expanded in x around inf 28.1

    \[\leadsto \color{blue}{\frac{1}{\cos \left(0.5 \cdot \frac{x}{y}\right)}} \]
  4. Simplified28.1

    \[\leadsto \color{blue}{\frac{1}{\cos \left(x \cdot \frac{0.5}{y}\right)}} \]
    Proof
    (/.f64 1 (cos.f64 (*.f64 x (/.f64 1/2 y)))): 0 points increase in error, 0 points decrease in error
    (/.f64 1 (cos.f64 (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 x 1/2) y)))): 10 points increase in error, 13 points decrease in error
    (/.f64 1 (cos.f64 (/.f64 (Rewrite=> *-commutative_binary64 (*.f64 1/2 x)) y))): 0 points increase in error, 0 points decrease in error
    (/.f64 1 (cos.f64 (Rewrite<= associate-*r/_binary64 (*.f64 1/2 (/.f64 x y))))): 0 points increase in error, 0 points decrease in error
  5. Applied egg-rr28.1

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

    \[\leadsto \frac{1}{\cos \left({\color{blue}{\left({\left({\left(\sqrt[3]{x \cdot \frac{0.5}{y}}\right)}^{2}\right)}^{0.3333333333333333} \cdot \sqrt[3]{\sqrt[3]{x \cdot \frac{0.5}{y}}}\right)}}^{3}\right)} \]
  7. Final simplification28.1

    \[\leadsto \frac{1}{\cos \left({\left({\left({\left(\sqrt[3]{x \cdot \frac{0.5}{y}}\right)}^{2}\right)}^{0.3333333333333333} \cdot \sqrt[3]{\sqrt[3]{x \cdot \frac{0.5}{y}}}\right)}^{3}\right)} \]

Alternatives

Alternative 1
Error28.1
Cost26240
\[\frac{1}{\cos \left(\sqrt[3]{x} \cdot \left(\frac{0.5}{y} \cdot {\left(\sqrt[3]{x}\right)}^{2}\right)\right)} \]
Alternative 2
Error28.1
Cost19712
\[\frac{1}{\cos \left({\left(\sqrt[3]{x \cdot \frac{0.5}{y}}\right)}^{3}\right)} \]
Alternative 3
Error28.1
Cost64
\[1 \]

Error

Reproduce

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