| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 52544 |
\[\left|\frac{ew}{\frac{\mathsf{hypot}\left(1, \frac{\tan t}{\frac{ew}{eh}}\right)}{\cos t}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot \left(-eh\right)}{ew}\right)\right|
\]
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* ew (cos t)) (cos (atan (/ (* (- eh) (tan t)) ew)))) (* (* eh (sin t)) (sin (atan (/ (* (- eh) (tan t)) ew)))))))
(FPCore (eh ew t)
:precision binary64
(fabs
(-
(* (* eh (sin t)) (sin (atan (/ (* (tan t) (- eh)) ew))))
(*
(+ (exp (log1p (cos (atan (* eh (/ (tan t) ew)))))) -1.0)
(* ew (cos t))))))double code(double eh, double ew, double t) {
return fabs((((ew * cos(t)) * cos(atan(((-eh * tan(t)) / ew)))) - ((eh * sin(t)) * sin(atan(((-eh * tan(t)) / ew))))));
}
double code(double eh, double ew, double t) {
return fabs((((eh * sin(t)) * sin(atan(((tan(t) * -eh) / ew)))) - ((exp(log1p(cos(atan((eh * (tan(t) / ew)))))) + -1.0) * (ew * cos(t)))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((ew * Math.cos(t)) * Math.cos(Math.atan(((-eh * Math.tan(t)) / ew)))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((-eh * Math.tan(t)) / ew))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.sin(t)) * Math.sin(Math.atan(((Math.tan(t) * -eh) / ew)))) - ((Math.exp(Math.log1p(Math.cos(Math.atan((eh * (Math.tan(t) / ew)))))) + -1.0) * (ew * Math.cos(t)))));
}
def code(eh, ew, t): return math.fabs((((ew * math.cos(t)) * math.cos(math.atan(((-eh * math.tan(t)) / ew)))) - ((eh * math.sin(t)) * math.sin(math.atan(((-eh * math.tan(t)) / ew))))))
def code(eh, ew, t): return math.fabs((((eh * math.sin(t)) * math.sin(math.atan(((math.tan(t) * -eh) / ew)))) - ((math.exp(math.log1p(math.cos(math.atan((eh * (math.tan(t) / ew)))))) + -1.0) * (ew * math.cos(t)))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)))))) end
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * Float64(-eh)) / ew)))) - Float64(Float64(exp(log1p(cos(atan(Float64(eh * Float64(tan(t) / ew)))))) + -1.0) * Float64(ew * cos(t))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Exp[N[Log[1 + N[Cos[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision] * N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot \left(-eh\right)}{ew}\right) - \left(e^{\mathsf{log1p}\left(\cos \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)\right)} + -1\right) \cdot \left(ew \cdot \cos t\right)\right|
Results
Initial program 99.8%
Applied egg-rr99.8%
[Start]99.8 | \[ \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\] |
|---|---|
expm1-log1p-u [=>]99.8 | \[ \left|\left(ew \cdot \cos t\right) \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right)} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\] |
expm1-udef [=>]99.8 | \[ \left|\left(ew \cdot \cos t\right) \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)} - 1\right)} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\] |
div-inv [=>]99.8 | \[ \left|\left(ew \cdot \cos t\right) \cdot \left(e^{\mathsf{log1p}\left(\cos \tan^{-1} \color{blue}{\left(\left(\left(-eh\right) \cdot \tan t\right) \cdot \frac{1}{ew}\right)}\right)} - 1\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\] |
associate-*l* [=>]99.8 | \[ \left|\left(ew \cdot \cos t\right) \cdot \left(e^{\mathsf{log1p}\left(\cos \tan^{-1} \color{blue}{\left(\left(-eh\right) \cdot \left(\tan t \cdot \frac{1}{ew}\right)\right)}\right)} - 1\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\] |
add-sqr-sqrt [=>]50.2 | \[ \left|\left(ew \cdot \cos t\right) \cdot \left(e^{\mathsf{log1p}\left(\cos \tan^{-1} \left(\color{blue}{\left(\sqrt{-eh} \cdot \sqrt{-eh}\right)} \cdot \left(\tan t \cdot \frac{1}{ew}\right)\right)\right)} - 1\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\] |
sqrt-unprod [=>]92.7 | \[ \left|\left(ew \cdot \cos t\right) \cdot \left(e^{\mathsf{log1p}\left(\cos \tan^{-1} \left(\color{blue}{\sqrt{\left(-eh\right) \cdot \left(-eh\right)}} \cdot \left(\tan t \cdot \frac{1}{ew}\right)\right)\right)} - 1\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\] |
sqr-neg [=>]92.7 | \[ \left|\left(ew \cdot \cos t\right) \cdot \left(e^{\mathsf{log1p}\left(\cos \tan^{-1} \left(\sqrt{\color{blue}{eh \cdot eh}} \cdot \left(\tan t \cdot \frac{1}{ew}\right)\right)\right)} - 1\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\] |
sqrt-unprod [<=]49.6 | \[ \left|\left(ew \cdot \cos t\right) \cdot \left(e^{\mathsf{log1p}\left(\cos \tan^{-1} \left(\color{blue}{\left(\sqrt{eh} \cdot \sqrt{eh}\right)} \cdot \left(\tan t \cdot \frac{1}{ew}\right)\right)\right)} - 1\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\] |
add-sqr-sqrt [<=]99.8 | \[ \left|\left(ew \cdot \cos t\right) \cdot \left(e^{\mathsf{log1p}\left(\cos \tan^{-1} \left(\color{blue}{eh} \cdot \left(\tan t \cdot \frac{1}{ew}\right)\right)\right)} - 1\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\] |
associate-*r/ [=>]99.8 | \[ \left|\left(ew \cdot \cos t\right) \cdot \left(e^{\mathsf{log1p}\left(\cos \tan^{-1} \left(eh \cdot \color{blue}{\frac{\tan t \cdot 1}{ew}}\right)\right)} - 1\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\] |
*-commutative [<=]99.8 | \[ \left|\left(ew \cdot \cos t\right) \cdot \left(e^{\mathsf{log1p}\left(\cos \tan^{-1} \left(eh \cdot \frac{\color{blue}{1 \cdot \tan t}}{ew}\right)\right)} - 1\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\] |
*-un-lft-identity [<=]99.8 | \[ \left|\left(ew \cdot \cos t\right) \cdot \left(e^{\mathsf{log1p}\left(\cos \tan^{-1} \left(eh \cdot \frac{\color{blue}{\tan t}}{ew}\right)\right)} - 1\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\] |
Final simplification99.8%
| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 52544 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 52544 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.0% |
| Cost | 46144 |
| Alternative 4 | |
|---|---|
| Accuracy | 98.5% |
| Cost | 39296 |
| Alternative 5 | |
|---|---|
| Accuracy | 98.3% |
| Cost | 32896 |
| Alternative 6 | |
|---|---|
| Accuracy | 79.8% |
| Cost | 32768 |
| Alternative 7 | |
|---|---|
| Accuracy | 79.8% |
| Cost | 26368 |
| Alternative 8 | |
|---|---|
| Accuracy | 79.5% |
| Cost | 13120 |
| Alternative 9 | |
|---|---|
| Accuracy | 79.5% |
| Cost | 13120 |
| Alternative 10 | |
|---|---|
| Accuracy | 43.2% |
| Cost | 6464 |
herbie shell --seed 2023131
(FPCore (eh ew t)
:name "Example 2 from Robby"
:precision binary64
(fabs (- (* (* ew (cos t)) (cos (atan (/ (* (- eh) (tan t)) ew)))) (* (* eh (sin t)) (sin (atan (/ (* (- eh) (tan t)) ew)))))))