| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 52480 |
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \sin t \cdot \frac{ew}{\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)}\right|
\]
(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 (fabs (+ (* (/ 1.0 (hypot 1.0 (/ eh (* (tan t) ew)))) (* ew (sin t))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
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) {
return fabs((((1.0 / hypot(1.0, (eh / (tan(t) * ew)))) * (ew * sin(t))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((ew * Math.sin(t)) * Math.cos(Math.atan(((eh / ew) / Math.tan(t))))) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((1.0 / Math.hypot(1.0, (eh / (Math.tan(t) * ew)))) * (ew * Math.sin(t))) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t): return math.fabs((((ew * math.sin(t)) * math.cos(math.atan(((eh / ew) / math.tan(t))))) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
def code(eh, ew, t): return math.fabs((((1.0 / math.hypot(1.0, (eh / (math.tan(t) * ew)))) * (ew * math.sin(t))) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
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) return abs(Float64(Float64(Float64(1.0 / hypot(1.0, Float64(eh / Float64(tan(t) * ew)))) * Float64(ew * sin(t))) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * sin(t)) * cos(atan(((eh / ew) / tan(t))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))))); end
function tmp = code(eh, ew, t) tmp = abs((((1.0 / hypot(1.0, (eh / (tan(t) * ew)))) * (ew * sin(t))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))))); 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_] := N[Abs[N[(N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(ew * N[Sin[t], $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]
\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|
\left|\frac{1}{\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)} \cdot \left(ew \cdot \sin t\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
Results
Initial program 99.8%
Applied egg-rr99.7%
[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|
\] |
|---|---|
cos-atan [=>]99.8 | \[ \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\] |
associate-*r/ [=>]99.8 | \[ \left|\color{blue}{\frac{\left(ew \cdot \sin t\right) \cdot 1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\] |
*-commutative [<=]99.8 | \[ \left|\frac{\color{blue}{1 \cdot \left(ew \cdot \sin t\right)}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\] |
associate-/l* [=>]99.7 | \[ \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\] |
hypot-1-def [=>]99.7 | \[ \left|\frac{1}{\frac{\color{blue}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}{ew \cdot \sin t}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\] |
associate-/l/ [=>]99.7 | \[ \left|\frac{1}{\frac{\mathsf{hypot}\left(1, \color{blue}{\frac{eh}{\tan t \cdot ew}}\right)}{ew \cdot \sin t}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\] |
*-commutative [=>]99.7 | \[ \left|\frac{1}{\frac{\mathsf{hypot}\left(1, \frac{eh}{\color{blue}{ew \cdot \tan t}}\right)}{ew \cdot \sin t}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\] |
Simplified99.8%
[Start]99.7 | \[ \left|\frac{1}{\frac{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}{ew \cdot \sin t}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\] |
|---|---|
associate-/r/ [=>]99.8 | \[ \left|\color{blue}{\frac{1}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)} \cdot \left(ew \cdot \sin t\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\] |
*-commutative [=>]99.8 | \[ \left|\frac{1}{\mathsf{hypot}\left(1, \frac{eh}{\color{blue}{\tan t \cdot ew}}\right)} \cdot \left(ew \cdot \sin t\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\] |
Final simplification99.8%
| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 52480 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.0% |
| Cost | 52416 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.0% |
| Cost | 46208 |
| Alternative 4 | |
|---|---|
| Accuracy | 98.9% |
| Cost | 46080 |
| Alternative 5 | |
|---|---|
| Accuracy | 98.4% |
| Cost | 39232 |
| Alternative 6 | |
|---|---|
| Accuracy | 96.5% |
| Cost | 33737 |
| Alternative 7 | |
|---|---|
| Accuracy | 89.8% |
| Cost | 33481 |
| Alternative 8 | |
|---|---|
| Accuracy | 82.4% |
| Cost | 33097 |
| Alternative 9 | |
|---|---|
| Accuracy | 65.9% |
| Cost | 32964 |
| Alternative 10 | |
|---|---|
| Accuracy | 88.5% |
| Cost | 32960 |
| Alternative 11 | |
|---|---|
| Accuracy | 52.1% |
| Cost | 27593 |
| Alternative 12 | |
|---|---|
| Accuracy | 45.2% |
| Cost | 27081 |
| Alternative 13 | |
|---|---|
| Accuracy | 51.3% |
| Cost | 27081 |
| Alternative 14 | |
|---|---|
| Accuracy | 39.2% |
| Cost | 26953 |
| Alternative 15 | |
|---|---|
| Accuracy | 33.1% |
| Cost | 26688 |
| Alternative 16 | |
|---|---|
| Accuracy | 35.0% |
| Cost | 26688 |
| Alternative 17 | |
|---|---|
| Accuracy | 39.4% |
| Cost | 26688 |
| Alternative 18 | |
|---|---|
| Accuracy | 33.1% |
| Cost | 20288 |
herbie shell --seed 2023135
(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))))))))