| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 58816 |
\[\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\cos t_1 \cdot \left(ew \cdot \sin t\right) + \left(eh \cdot \cos t\right) \cdot \sin t_1\right|
\end{array}
\]
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh (tan t)) ew)))) (fabs (fma ew (* (sin t) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
return fabs((((ew * sin(t)) * cos(atan(((eh / ew) / tan(t))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / tan(t)) / ew));
return fabs(fma(ew, (sin(t) * cos(t_1)), ((eh * cos(t)) * sin(t_1))));
}
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))))) end
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / tan(t)) / ew)) return abs(fma(ew, Float64(sin(t) * cos(t_1)), Float64(Float64(eh * cos(t)) * sin(t_1)))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(ew * N[(N[Sin[t], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)\\
\left|\mathsf{fma}\left(ew, \sin t \cdot \cos t_1, \left(eh \cdot \cos t\right) \cdot \sin t_1\right)\right|
\end{array}
Initial program 99.8%
Simplified99.8%
[Start]99.8 | \[ \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\] |
|---|---|
associate-*l* [=>]99.8 | \[ \left|\color{blue}{ew \cdot \left(\sin t \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\] |
fma-def [=>]99.8 | \[ \left|\color{blue}{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right), \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)}\right|
\] |
associate-/l/ [=>]99.8 | \[ \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \color{blue}{\left(\frac{eh}{\tan t \cdot ew}\right)}, \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right|
\] |
associate-/r* [=>]99.8 | \[ \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \color{blue}{\left(\frac{\frac{eh}{\tan t}}{ew}\right)}, \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right|
\] |
associate-/l/ [=>]99.8 | \[ \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right), \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{\tan t \cdot ew}\right)}\right)\right|
\] |
associate-/r* [=>]99.8 | \[ \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right), \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right)\right|
\] |
Final simplification99.8%
| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 58816 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.0% |
| Cost | 52416 |
| Alternative 3 | |
|---|---|
| Accuracy | 98.9% |
| Cost | 46080 |
| Alternative 4 | |
|---|---|
| Accuracy | 98.5% |
| Cost | 39232 |
| Alternative 5 | |
|---|---|
| Accuracy | 82.5% |
| Cost | 32969 |
| Alternative 6 | |
|---|---|
| Accuracy | 88.9% |
| Cost | 32960 |
| Alternative 7 | |
|---|---|
| Accuracy | 72.1% |
| Cost | 27460 |
| Alternative 8 | |
|---|---|
| Accuracy | 59.6% |
| Cost | 27213 |
| Alternative 9 | |
|---|---|
| Accuracy | 65.6% |
| Cost | 26816 |
| Alternative 10 | |
|---|---|
| Accuracy | 56.1% |
| Cost | 26688 |
| Alternative 11 | |
|---|---|
| Accuracy | 32.7% |
| Cost | 20288 |
herbie shell --seed 2023141
(FPCore (eh ew t)
:name "Example from Robby"
:precision binary64
(fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))