| Alternative 1 | |
|---|---|
| Error | 28.5 |
| Cost | 26240 |
\[\frac{1}{\cos \left({\left(\sqrt[3]{y}\right)}^{-2} \cdot \frac{x \cdot 0.5}{\sqrt[3]{y}}\right)}
\]
(FPCore (x y) :precision binary64 (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))))
(FPCore (x y) :precision binary64 (/ 1.0 (cos (/ (/ (* x 0.5) (pow (cbrt y) 2.0)) (cbrt y)))))
double code(double x, double y) {
return tan((x / (y * 2.0))) / sin((x / (y * 2.0)));
}
double code(double x, double y) {
return 1.0 / cos((((x * 0.5) / pow(cbrt(y), 2.0)) / cbrt(y)));
}
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) {
return 1.0 / Math.cos((((x * 0.5) / Math.pow(Math.cbrt(y), 2.0)) / Math.cbrt(y)));
}
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) return Float64(1.0 / cos(Float64(Float64(Float64(x * 0.5) / (cbrt(y) ^ 2.0)) / cbrt(y)))) 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_] := N[(1.0 / N[Cos[N[(N[(N[(x * 0.5), $MachinePrecision] / N[Power[N[Power[y, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[y, 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}
\frac{1}{\cos \left(\frac{\frac{x \cdot 0.5}{{\left(\sqrt[3]{y}\right)}^{2}}}{\sqrt[3]{y}}\right)}
Results
| Original | 35.5 |
|---|---|
| Target | 28.9 |
| Herbie | 28.5 |
Initial program 35.5
Applied egg-rr35.7
Taylor expanded in x around inf 28.4
Simplified28.4
[Start]28.4 | \[ \frac{1}{\cos \left(0.5 \cdot \frac{x}{y}\right)}
\] |
|---|---|
*-commutative [=>]28.4 | \[ \frac{1}{\cos \color{blue}{\left(\frac{x}{y} \cdot 0.5\right)}}
\] |
associate-*l/ [=>]28.4 | \[ \frac{1}{\cos \color{blue}{\left(\frac{x \cdot 0.5}{y}\right)}}
\] |
associate-*r/ [<=]28.4 | \[ \frac{1}{\cos \color{blue}{\left(x \cdot \frac{0.5}{y}\right)}}
\] |
Applied egg-rr28.5
Final simplification28.5
| Alternative 1 | |
|---|---|
| Error | 28.5 |
| Cost | 26240 |
| Alternative 2 | |
|---|---|
| Error | 28.4 |
| Cost | 26240 |
| Alternative 3 | |
|---|---|
| Error | 28.6 |
| Cost | 64 |
herbie shell --seed 2023039
(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)))))