
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((eh / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $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]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((eh / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $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]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ eh (* ew (tan t)))))) (fabs (fma (* ew (sin t)) (cos t_1) (* eh (* (cos t) (sin t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh / (ew * tan(t))));
return fabs(fma((ew * sin(t)), cos(t_1), (eh * (cos(t) * sin(t_1)))));
}
function code(eh, ew, t) t_1 = atan(Float64(eh / Float64(ew * tan(t)))) return abs(fma(Float64(ew * sin(t)), cos(t_1), Float64(eh * Float64(cos(t) * sin(t_1))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision] + N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\
\left|\mathsf{fma}\left(ew \cdot \sin t, \cos t\_1, eh \cdot \left(\cos t \cdot \sin t\_1\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
fma-define99.8%
associate-/l/99.8%
associate-*l*99.8%
associate-/l/99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh ew) (tan t))))
(fabs
(+
(* (* ew (sin t)) (/ 1.0 (hypot 1.0 t_1)))
(* (* eh (cos t)) (sin (atan t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / tan(t);
return fabs((((ew * sin(t)) * (1.0 / hypot(1.0, t_1))) + ((eh * cos(t)) * sin(atan(t_1)))));
}
public static double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / Math.tan(t);
return Math.abs((((ew * Math.sin(t)) * (1.0 / Math.hypot(1.0, t_1))) + ((eh * Math.cos(t)) * Math.sin(Math.atan(t_1)))));
}
def code(eh, ew, t): t_1 = (eh / ew) / math.tan(t) return math.fabs((((ew * math.sin(t)) * (1.0 / math.hypot(1.0, t_1))) + ((eh * math.cos(t)) * math.sin(math.atan(t_1)))))
function code(eh, ew, t) t_1 = Float64(Float64(eh / ew) / tan(t)) return abs(Float64(Float64(Float64(ew * sin(t)) * Float64(1.0 / hypot(1.0, t_1))) + Float64(Float64(eh * cos(t)) * sin(atan(t_1))))) end
function tmp = code(eh, ew, t) t_1 = (eh / ew) / tan(t); tmp = abs((((ew * sin(t)) * (1.0 / hypot(1.0, t_1))) + ((eh * cos(t)) * sin(atan(t_1))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{ew}}{\tan t}\\
\left|\left(ew \cdot \sin t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, t\_1\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t\_1\right|
\end{array}
\end{array}
Initial program 99.8%
associate-/l/99.8%
cos-atan99.8%
hypot-1-def99.8%
*-commutative99.8%
Applied egg-rr99.8%
associate-/r*99.8%
Simplified99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* (* ew (sin t)) (cos (atan (/ eh (* ew t))))))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t)))))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + ((ew * Math.sin(t)) * Math.cos(Math.atan((eh / (ew * t)))))));
}
def code(eh, ew, t): return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + ((ew * math.sin(t)) * math.cos(math.atan((eh / (ew * t)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(Float64(ew * sin(t)) * cos(atan(Float64(eh / Float64(ew * t))))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(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] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 99.4%
Final simplification99.4%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* ew (sin t)) (cos (atan (/ eh (* ew (tan t))))) (* (cos t) (- eh)))))
double code(double eh, double ew, double t) {
return fabs(fma((ew * sin(t)), cos(atan((eh / (ew * tan(t))))), (cos(t) * -eh)));
}
function code(eh, ew, t) return abs(fma(Float64(ew * sin(t)), cos(atan(Float64(eh / Float64(ew * tan(t))))), Float64(cos(t) * Float64(-eh)))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(N[Cos[t], $MachinePrecision] * (-eh)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), \cos t \cdot \left(-eh\right)\right)\right|
\end{array}
Initial program 99.8%
fma-define99.8%
associate-/l/99.8%
associate-*l*99.8%
associate-/l/99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan59.0%
associate-*r/56.9%
*-commutative56.9%
hypot-1-def63.8%
*-commutative63.8%
Applied egg-rr63.8%
Taylor expanded in eh around -inf 98.9%
mul-1-neg98.9%
*-commutative98.9%
distribute-rgt-neg-in98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* ew (sin t)) (cos (atan (/ eh (* ew (tan t))))) (* eh (cos t)))))
double code(double eh, double ew, double t) {
return fabs(fma((ew * sin(t)), cos(atan((eh / (ew * tan(t))))), (eh * cos(t))));
}
function code(eh, ew, t) return abs(fma(Float64(ew * sin(t)), cos(atan(Float64(eh / Float64(ew * tan(t))))), Float64(eh * cos(t)))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh \cdot \cos t\right)\right|
\end{array}
Initial program 99.8%
fma-define99.8%
associate-/l/99.8%
associate-*l*99.8%
associate-/l/99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan59.0%
associate-*r/56.9%
*-commutative56.9%
hypot-1-def63.8%
*-commutative63.8%
Applied egg-rr63.8%
Taylor expanded in eh around inf 98.9%
Final simplification98.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (cos (atan (/ eh (* ew (tan t)))))))
(if (<= eh -8.2e+107)
(fabs (fma (* ew t) t_1 (* eh (cos t))))
(if (<= eh 2.8e+101)
(fabs (+ (* ew (sin t)) (* eh (sin (atan (/ (/ eh ew) (tan t)))))))
(fabs (fma (* ew t) t_1 (* (cos t) (- eh))))))))
double code(double eh, double ew, double t) {
double t_1 = cos(atan((eh / (ew * tan(t)))));
double tmp;
if (eh <= -8.2e+107) {
tmp = fabs(fma((ew * t), t_1, (eh * cos(t))));
} else if (eh <= 2.8e+101) {
tmp = fabs(((ew * sin(t)) + (eh * sin(atan(((eh / ew) / tan(t)))))));
} else {
tmp = fabs(fma((ew * t), t_1, (cos(t) * -eh)));
}
return tmp;
}
function code(eh, ew, t) t_1 = cos(atan(Float64(eh / Float64(ew * tan(t))))) tmp = 0.0 if (eh <= -8.2e+107) tmp = abs(fma(Float64(ew * t), t_1, Float64(eh * cos(t)))); elseif (eh <= 2.8e+101) tmp = abs(Float64(Float64(ew * sin(t)) + Float64(eh * sin(atan(Float64(Float64(eh / ew) / tan(t))))))); else tmp = abs(fma(Float64(ew * t), t_1, Float64(cos(t) * Float64(-eh)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Cos[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -8.2e+107], N[Abs[N[(N[(ew * t), $MachinePrecision] * t$95$1 + N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 2.8e+101], N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * t), $MachinePrecision] * t$95$1 + N[(N[Cos[t], $MachinePrecision] * (-eh)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\
\mathbf{if}\;eh \leq -8.2 \cdot 10^{+107}:\\
\;\;\;\;\left|\mathsf{fma}\left(ew \cdot t, t\_1, eh \cdot \cos t\right)\right|\\
\mathbf{elif}\;eh \leq 2.8 \cdot 10^{+101}:\\
\;\;\;\;\left|ew \cdot \sin t + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(ew \cdot t, t\_1, \cos t \cdot \left(-eh\right)\right)\right|\\
\end{array}
\end{array}
if eh < -8.1999999999999998e107Initial program 99.7%
fma-define99.7%
associate-/l/99.7%
associate-*l*99.7%
associate-/l/99.7%
Simplified99.7%
associate-*r*99.7%
sin-atan20.1%
associate-*r/12.7%
*-commutative12.7%
hypot-1-def14.1%
*-commutative14.1%
Applied egg-rr14.1%
Taylor expanded in t around 0 13.9%
Taylor expanded in eh around inf 97.2%
if -8.1999999999999998e107 < eh < 2.79999999999999981e101Initial program 99.8%
Taylor expanded in t around 0 89.4%
associate-/l/89.4%
cos-atan89.3%
metadata-eval89.3%
associate-/l/89.3%
associate-/l/89.3%
hypot-undefine89.4%
associate-/r*89.4%
un-div-inv89.4%
associate-/r*89.4%
Applied egg-rr89.4%
Taylor expanded in ew around inf 88.9%
if 2.79999999999999981e101 < eh Initial program 99.9%
fma-define99.9%
associate-/l/99.9%
associate-*l*99.9%
associate-/l/99.9%
Simplified99.9%
associate-*r*99.9%
sin-atan37.2%
associate-*r/32.0%
*-commutative32.0%
hypot-1-def33.7%
*-commutative33.7%
Applied egg-rr33.7%
Taylor expanded in t around 0 16.7%
Taylor expanded in eh around -inf 82.3%
mul-1-neg98.4%
*-commutative98.4%
distribute-rgt-neg-in98.4%
Simplified82.3%
Final simplification89.1%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -1.3e+105) (not (<= eh 1.55e+100))) (fabs (fma (* ew t) (cos (atan (/ eh (* ew (tan t))))) (* eh (cos t)))) (fabs (+ (* ew (sin t)) (* eh (sin (atan (/ (/ eh ew) (tan t)))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.3e+105) || !(eh <= 1.55e+100)) {
tmp = fabs(fma((ew * t), cos(atan((eh / (ew * tan(t))))), (eh * cos(t))));
} else {
tmp = fabs(((ew * sin(t)) + (eh * sin(atan(((eh / ew) / tan(t)))))));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((eh <= -1.3e+105) || !(eh <= 1.55e+100)) tmp = abs(fma(Float64(ew * t), cos(atan(Float64(eh / Float64(ew * tan(t))))), Float64(eh * cos(t)))); else tmp = abs(Float64(Float64(ew * sin(t)) + Float64(eh * sin(atan(Float64(Float64(eh / ew) / tan(t))))))); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -1.3e+105], N[Not[LessEqual[eh, 1.55e+100]], $MachinePrecision]], N[Abs[N[(N[(ew * t), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.3 \cdot 10^{+105} \lor \neg \left(eh \leq 1.55 \cdot 10^{+100}\right):\\
\;\;\;\;\left|\mathsf{fma}\left(ew \cdot t, \cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh \cdot \cos t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \sin t + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|\\
\end{array}
\end{array}
if eh < -1.3000000000000001e105 or 1.55000000000000003e100 < eh Initial program 99.8%
fma-define99.8%
associate-/l/99.8%
associate-*l*99.8%
associate-/l/99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan28.9%
associate-*r/22.7%
*-commutative22.7%
hypot-1-def24.2%
*-commutative24.2%
Applied egg-rr24.2%
Taylor expanded in t around 0 15.3%
Taylor expanded in eh around inf 89.5%
if -1.3000000000000001e105 < eh < 1.55000000000000003e100Initial program 99.8%
Taylor expanded in t around 0 89.4%
associate-/l/89.4%
cos-atan89.3%
metadata-eval89.3%
associate-/l/89.3%
associate-/l/89.3%
hypot-undefine89.4%
associate-/r*89.4%
un-div-inv89.4%
associate-/r*89.4%
Applied egg-rr89.4%
Taylor expanded in ew around inf 88.9%
Final simplification89.1%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* 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)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs(((ew * sin(t)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((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)) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(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)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $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]
\begin{array}{l}
\\
\left|ew \cdot \sin t + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\end{array}
Initial program 99.8%
associate-/l/99.8%
cos-atan99.8%
hypot-1-def99.8%
*-commutative99.8%
Applied egg-rr99.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in eh around 0 98.8%
Final simplification98.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (sin t)) (* eh (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * sin(t)) + (eh * sin(atan(((eh / ew) / tan(t)))))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs(((ew * sin(t)) + (eh * sin(atan(((eh / ew) / tan(t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.sin(t)) + (eh * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.sin(t)) + (eh * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * sin(t)) + Float64(eh * sin(atan(Float64(Float64(eh / ew) / tan(t))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * sin(t)) + (eh * sin(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \sin t + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 82.7%
associate-/l/82.7%
cos-atan82.7%
metadata-eval82.7%
associate-/l/82.7%
associate-/l/82.7%
hypot-undefine82.7%
associate-/r*82.7%
un-div-inv82.7%
associate-/r*82.7%
Applied egg-rr82.7%
Taylor expanded in ew around inf 82.0%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ (* ew (sin t)) (hypot 1.0 (/ (/ eh ew) (tan t)))) eh)))
double code(double eh, double ew, double t) {
return fabs((((ew * sin(t)) / hypot(1.0, ((eh / ew) / tan(t)))) - eh));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((ew * Math.sin(t)) / Math.hypot(1.0, ((eh / ew) / Math.tan(t)))) - eh));
}
def code(eh, ew, t): return math.fabs((((ew * math.sin(t)) / math.hypot(1.0, ((eh / ew) / math.tan(t)))) - eh))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * sin(t)) / hypot(1.0, Float64(Float64(eh / ew) / tan(t)))) - eh)) end
function tmp = code(eh, ew, t) tmp = abs((((ew * sin(t)) / hypot(1.0, ((eh / ew) / tan(t)))) - eh)); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] - eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)} - eh\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 82.7%
associate-/l/82.7%
cos-atan82.7%
metadata-eval82.7%
associate-/l/82.7%
associate-/l/82.7%
hypot-undefine82.7%
associate-/r*82.7%
un-div-inv82.7%
associate-/r*82.7%
Applied egg-rr82.7%
*-commutative82.7%
sin-atan53.3%
hypot-1-def66.0%
associate-*l/59.5%
associate-/l/55.1%
associate-/r*59.1%
associate-/l/55.0%
associate-/r*58.9%
Applied egg-rr58.9%
Taylor expanded in eh around -inf 81.8%
neg-mul-181.8%
Simplified81.8%
Final simplification81.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ eh (/ (* ew (sin t)) (hypot 1.0 (/ eh (* ew t)))))))
double code(double eh, double ew, double t) {
return fabs((eh + ((ew * sin(t)) / hypot(1.0, (eh / (ew * t))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((eh + ((ew * Math.sin(t)) / Math.hypot(1.0, (eh / (ew * t))))));
}
def code(eh, ew, t): return math.fabs((eh + ((ew * math.sin(t)) / math.hypot(1.0, (eh / (ew * t))))))
function code(eh, ew, t) return abs(Float64(eh + Float64(Float64(ew * sin(t)) / hypot(1.0, Float64(eh / Float64(ew * t)))))) end
function tmp = code(eh, ew, t) tmp = abs((eh + ((ew * sin(t)) / hypot(1.0, (eh / (ew * t)))))); end
code[eh_, ew_, t_] := N[Abs[N[(eh + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|eh + \frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot t}\right)}\right|
\end{array}
Initial program 99.8%
fma-define99.8%
associate-/l/99.8%
associate-*l*99.8%
associate-/l/99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan59.0%
associate-*r/56.9%
*-commutative56.9%
hypot-1-def63.8%
*-commutative63.8%
Applied egg-rr63.8%
Taylor expanded in t around 0 81.8%
Taylor expanded in t around 0 81.8%
*-commutative81.8%
Simplified81.8%
fma-undefine81.8%
cos-atan81.8%
un-div-inv81.8%
hypot-1-def81.8%
Applied egg-rr81.8%
Final simplification81.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ eh (* ew (* t (cos (atan (/ eh (* ew t)))))))))
double code(double eh, double ew, double t) {
return fabs((eh + (ew * (t * cos(atan((eh / (ew * t))))))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((eh + (ew * (t * cos(atan((eh / (ew * t))))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((eh + (ew * (t * Math.cos(Math.atan((eh / (ew * t))))))));
}
def code(eh, ew, t): return math.fabs((eh + (ew * (t * math.cos(math.atan((eh / (ew * t))))))))
function code(eh, ew, t) return abs(Float64(eh + Float64(ew * Float64(t * cos(atan(Float64(eh / Float64(ew * t)))))))) end
function tmp = code(eh, ew, t) tmp = abs((eh + (ew * (t * cos(atan((eh / (ew * t)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(eh + N[(ew * N[(t * N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|eh + ew \cdot \left(t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right)\right|
\end{array}
Initial program 99.8%
fma-define99.8%
associate-/l/99.8%
associate-*l*99.8%
associate-/l/99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan59.0%
associate-*r/56.9%
*-commutative56.9%
hypot-1-def63.8%
*-commutative63.8%
Applied egg-rr63.8%
Taylor expanded in t around 0 81.8%
Taylor expanded in t around 0 81.8%
*-commutative81.8%
Simplified81.8%
Taylor expanded in t around 0 58.1%
*-commutative58.1%
Simplified58.1%
Final simplification58.1%
(FPCore (eh ew t) :precision binary64 (fabs eh))
double code(double eh, double ew, double t) {
return fabs(eh);
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs(eh)
end function
public static double code(double eh, double ew, double t) {
return Math.abs(eh);
}
def code(eh, ew, t): return math.fabs(eh)
function code(eh, ew, t) return abs(eh) end
function tmp = code(eh, ew, t) tmp = abs(eh); end
code[eh_, ew_, t_] := N[Abs[eh], $MachinePrecision]
\begin{array}{l}
\\
\left|eh\right|
\end{array}
Initial program 99.8%
fma-define99.8%
associate-/l/99.8%
associate-*l*99.8%
associate-/l/99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan59.0%
associate-*r/56.9%
*-commutative56.9%
hypot-1-def63.8%
*-commutative63.8%
Applied egg-rr63.8%
Taylor expanded in t around 0 81.8%
Taylor expanded in t around 0 81.8%
*-commutative81.8%
Simplified81.8%
Taylor expanded in ew around 0 44.2%
herbie shell --seed 2024093
(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))))))))