
(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 12 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 (fabs (+ (* (* ew (sin t)) (/ 1.0 (hypot 1.0 (/ (/ eh (tan t)) ew)))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs((((ew * sin(t)) * (1.0 / hypot(1.0, ((eh / tan(t)) / ew)))) + ((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)) * (1.0 / Math.hypot(1.0, ((eh / Math.tan(t)) / ew)))) + ((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)) * (1.0 / math.hypot(1.0, ((eh / math.tan(t)) / ew)))) + ((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)) * Float64(1.0 / hypot(1.0, Float64(Float64(eh / tan(t)) / ew)))) + 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)) * (1.0 / hypot(1.0, ((eh / tan(t)) / ew)))) + ((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[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] ^ 2], $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]
\begin{array}{l}
\\
\left|\left(ew \cdot \sin t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, \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|
\end{array}
Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l/99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* (* ew (sin t)) (/ 1.0 (hypot 1.0 (/ (/ eh t) ew)))))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * (1.0 / hypot(1.0, ((eh / t) / ew))))));
}
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)) * (1.0 / Math.hypot(1.0, ((eh / t) / ew))))));
}
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)) * (1.0 / math.hypot(1.0, ((eh / t) / ew))))))
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)) * Float64(1.0 / hypot(1.0, Float64(Float64(eh / t) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * (1.0 / hypot(1.0, ((eh / t) / ew)))))); 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[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision] ^ 2], $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 \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)}\right|
\end{array}
Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l/99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 99.0%
Final simplification99.0%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (sin (atan (/ (/ eh ew) (tan t))))) (t_2 (* ew (sin t))))
(if (or (<= ew -8.5e-43) (not (<= ew 1.65e-85)))
(fabs (+ (* t_2 (/ 1.0 (hypot 1.0 (/ (/ eh t) ew)))) (* eh t_1)))
(fabs (+ (* (* eh (cos t)) t_1) (* t_2 (/ (* ew t) eh)))))))
double code(double eh, double ew, double t) {
double t_1 = sin(atan(((eh / ew) / tan(t))));
double t_2 = ew * sin(t);
double tmp;
if ((ew <= -8.5e-43) || !(ew <= 1.65e-85)) {
tmp = fabs(((t_2 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * t_1)));
} else {
tmp = fabs((((eh * cos(t)) * t_1) + (t_2 * ((ew * t) / eh))));
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double t_1 = Math.sin(Math.atan(((eh / ew) / Math.tan(t))));
double t_2 = ew * Math.sin(t);
double tmp;
if ((ew <= -8.5e-43) || !(ew <= 1.65e-85)) {
tmp = Math.abs(((t_2 * (1.0 / Math.hypot(1.0, ((eh / t) / ew)))) + (eh * t_1)));
} else {
tmp = Math.abs((((eh * Math.cos(t)) * t_1) + (t_2 * ((ew * t) / eh))));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.sin(math.atan(((eh / ew) / math.tan(t)))) t_2 = ew * math.sin(t) tmp = 0 if (ew <= -8.5e-43) or not (ew <= 1.65e-85): tmp = math.fabs(((t_2 * (1.0 / math.hypot(1.0, ((eh / t) / ew)))) + (eh * t_1))) else: tmp = math.fabs((((eh * math.cos(t)) * t_1) + (t_2 * ((ew * t) / eh)))) return tmp
function code(eh, ew, t) t_1 = sin(atan(Float64(Float64(eh / ew) / tan(t)))) t_2 = Float64(ew * sin(t)) tmp = 0.0 if ((ew <= -8.5e-43) || !(ew <= 1.65e-85)) tmp = abs(Float64(Float64(t_2 * Float64(1.0 / hypot(1.0, Float64(Float64(eh / t) / ew)))) + Float64(eh * t_1))); else tmp = abs(Float64(Float64(Float64(eh * cos(t)) * t_1) + Float64(t_2 * Float64(Float64(ew * t) / eh)))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = sin(atan(((eh / ew) / tan(t)))); t_2 = ew * sin(t); tmp = 0.0; if ((ew <= -8.5e-43) || ~((ew <= 1.65e-85))) tmp = abs(((t_2 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * t_1))); else tmp = abs((((eh * cos(t)) * t_1) + (t_2 * ((ew * t) / eh)))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[ew, -8.5e-43], N[Not[LessEqual[ew, 1.65e-85]], $MachinePrecision]], N[Abs[N[(N[(t$95$2 * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] + N[(t$95$2 * N[(N[(ew * t), $MachinePrecision] / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
t_2 := ew \cdot \sin t\\
\mathbf{if}\;ew \leq -8.5 \cdot 10^{-43} \lor \neg \left(ew \leq 1.65 \cdot 10^{-85}\right):\\
\;\;\;\;\left|t\_2 \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)} + eh \cdot t\_1\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot t\_1 + t\_2 \cdot \frac{ew \cdot t}{eh}\right|\\
\end{array}
\end{array}
if ew < -8.50000000000000056e-43 or 1.64999999999999986e-85 < ew Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l/99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 99.2%
Taylor expanded in t around 0 90.2%
if -8.50000000000000056e-43 < ew < 1.64999999999999986e-85Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l/99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 98.9%
Taylor expanded in eh around inf 85.9%
Final simplification88.5%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (sin t))))
(if (or (<= ew -3.2e-43) (not (<= ew 7.2e-86)))
(fabs
(+
(* t_1 (/ 1.0 (hypot 1.0 (/ (/ eh t) ew))))
(* eh (sin (atan (/ eh (* ew t)))))))
(fabs
(+
(* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t)))))
(* t_1 (* ew (/ t eh))))))))
double code(double eh, double ew, double t) {
double t_1 = ew * sin(t);
double tmp;
if ((ew <= -3.2e-43) || !(ew <= 7.2e-86)) {
tmp = fabs(((t_1 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * sin(atan((eh / (ew * t)))))));
} else {
tmp = fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (t_1 * (ew * (t / eh)))));
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double t_1 = ew * Math.sin(t);
double tmp;
if ((ew <= -3.2e-43) || !(ew <= 7.2e-86)) {
tmp = Math.abs(((t_1 * (1.0 / Math.hypot(1.0, ((eh / t) / ew)))) + (eh * Math.sin(Math.atan((eh / (ew * t)))))));
} else {
tmp = Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + (t_1 * (ew * (t / eh)))));
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.sin(t) tmp = 0 if (ew <= -3.2e-43) or not (ew <= 7.2e-86): tmp = math.fabs(((t_1 * (1.0 / math.hypot(1.0, ((eh / t) / ew)))) + (eh * math.sin(math.atan((eh / (ew * t))))))) else: tmp = math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (t_1 * (ew * (t / eh))))) return tmp
function code(eh, ew, t) t_1 = Float64(ew * sin(t)) tmp = 0.0 if ((ew <= -3.2e-43) || !(ew <= 7.2e-86)) tmp = abs(Float64(Float64(t_1 * Float64(1.0 / hypot(1.0, Float64(Float64(eh / t) / ew)))) + Float64(eh * sin(atan(Float64(eh / Float64(ew * t))))))); else tmp = abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(t_1 * Float64(ew * Float64(t / eh))))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * sin(t); tmp = 0.0; if ((ew <= -3.2e-43) || ~((ew <= 7.2e-86))) tmp = abs(((t_1 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * sin(atan((eh / (ew * t))))))); else tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (t_1 * (ew * (t / eh))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[ew, -3.2e-43], N[Not[LessEqual[ew, 7.2e-86]], $MachinePrecision]], N[Abs[N[(N[(t$95$1 * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 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[(t$95$1 * N[(ew * N[(t / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \sin t\\
\mathbf{if}\;ew \leq -3.2 \cdot 10^{-43} \lor \neg \left(ew \leq 7.2 \cdot 10^{-86}\right):\\
\;\;\;\;\left|t\_1 \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)} + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + t\_1 \cdot \left(ew \cdot \frac{t}{eh}\right)\right|\\
\end{array}
\end{array}
if ew < -3.19999999999999985e-43 or 7.19999999999999932e-86 < ew Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l/99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 99.2%
Taylor expanded in t around 0 93.5%
Taylor expanded in t around 0 89.3%
*-commutative89.3%
Simplified89.3%
if -3.19999999999999985e-43 < ew < 7.19999999999999932e-86Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l/99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 98.9%
Taylor expanded in eh around inf 85.9%
associate-*r/77.0%
Simplified84.8%
Final simplification87.5%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (sin t))))
(if (or (<= ew -1.4e-43) (not (<= ew 1.65e-87)))
(fabs
(+
(* t_1 (/ 1.0 (hypot 1.0 (/ (/ eh t) ew))))
(* eh (sin (atan (/ eh (* ew t)))))))
(fabs
(+
(* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t)))))
(* t_1 (/ (* ew t) eh)))))))
double code(double eh, double ew, double t) {
double t_1 = ew * sin(t);
double tmp;
if ((ew <= -1.4e-43) || !(ew <= 1.65e-87)) {
tmp = fabs(((t_1 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * sin(atan((eh / (ew * t)))))));
} else {
tmp = fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (t_1 * ((ew * t) / eh))));
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double t_1 = ew * Math.sin(t);
double tmp;
if ((ew <= -1.4e-43) || !(ew <= 1.65e-87)) {
tmp = Math.abs(((t_1 * (1.0 / Math.hypot(1.0, ((eh / t) / ew)))) + (eh * Math.sin(Math.atan((eh / (ew * t)))))));
} else {
tmp = Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + (t_1 * ((ew * t) / eh))));
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.sin(t) tmp = 0 if (ew <= -1.4e-43) or not (ew <= 1.65e-87): tmp = math.fabs(((t_1 * (1.0 / math.hypot(1.0, ((eh / t) / ew)))) + (eh * math.sin(math.atan((eh / (ew * t))))))) else: tmp = math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (t_1 * ((ew * t) / eh)))) return tmp
function code(eh, ew, t) t_1 = Float64(ew * sin(t)) tmp = 0.0 if ((ew <= -1.4e-43) || !(ew <= 1.65e-87)) tmp = abs(Float64(Float64(t_1 * Float64(1.0 / hypot(1.0, Float64(Float64(eh / t) / ew)))) + Float64(eh * sin(atan(Float64(eh / Float64(ew * t))))))); else tmp = abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(t_1 * Float64(Float64(ew * t) / eh)))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * sin(t); tmp = 0.0; if ((ew <= -1.4e-43) || ~((ew <= 1.65e-87))) tmp = abs(((t_1 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * sin(atan((eh / (ew * t))))))); else tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (t_1 * ((ew * t) / eh)))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[ew, -1.4e-43], N[Not[LessEqual[ew, 1.65e-87]], $MachinePrecision]], N[Abs[N[(N[(t$95$1 * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 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[(t$95$1 * N[(N[(ew * t), $MachinePrecision] / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \sin t\\
\mathbf{if}\;ew \leq -1.4 \cdot 10^{-43} \lor \neg \left(ew \leq 1.65 \cdot 10^{-87}\right):\\
\;\;\;\;\left|t\_1 \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)} + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + t\_1 \cdot \frac{ew \cdot t}{eh}\right|\\
\end{array}
\end{array}
if ew < -1.3999999999999999e-43 or 1.65e-87 < ew Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l/99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 99.2%
Taylor expanded in t around 0 93.5%
Taylor expanded in t around 0 89.3%
*-commutative89.3%
Simplified89.3%
if -1.3999999999999999e-43 < ew < 1.65e-87Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l/99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 98.9%
Taylor expanded in eh around inf 85.9%
Final simplification88.0%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* ew (sin t)) (/ 1.0 (hypot 1.0 (/ (/ eh t) ew)))) (* (* eh (cos t)) (sin (atan (/ eh (* ew t))))))))
double code(double eh, double ew, double t) {
return fabs((((ew * sin(t)) * (1.0 / hypot(1.0, ((eh / t) / ew)))) + ((eh * cos(t)) * sin(atan((eh / (ew * t)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((ew * Math.sin(t)) * (1.0 / Math.hypot(1.0, ((eh / t) / ew)))) + ((eh * Math.cos(t)) * Math.sin(Math.atan((eh / (ew * t)))))));
}
def code(eh, ew, t): return math.fabs((((ew * math.sin(t)) * (1.0 / math.hypot(1.0, ((eh / t) / ew)))) + ((eh * math.cos(t)) * math.sin(math.atan((eh / (ew * t)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * sin(t)) * Float64(1.0 / hypot(1.0, Float64(Float64(eh / t) / ew)))) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * t))))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * sin(t)) * (1.0 / hypot(1.0, ((eh / t) / ew)))) + ((eh * cos(t)) * sin(atan((eh / (ew * t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(ew \cdot \sin t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|
\end{array}
Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l/99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 99.0%
Taylor expanded in t around 0 90.1%
Final simplification90.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (sin t)))
(t_2 (sin (atan (/ eh (* ew t)))))
(t_3 (* (* eh (cos t)) t_2)))
(if (<= eh -2.4e+237)
(fabs (+ t_3 (* t_1 (/ (* ew t) eh))))
(if (<= eh 5e+119)
(fabs (+ (* t_1 (/ 1.0 (hypot 1.0 (/ (/ eh t) ew)))) (* eh t_2)))
(fabs (+ t_3 (* t_1 (* ew (/ t eh)))))))))
double code(double eh, double ew, double t) {
double t_1 = ew * sin(t);
double t_2 = sin(atan((eh / (ew * t))));
double t_3 = (eh * cos(t)) * t_2;
double tmp;
if (eh <= -2.4e+237) {
tmp = fabs((t_3 + (t_1 * ((ew * t) / eh))));
} else if (eh <= 5e+119) {
tmp = fabs(((t_1 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * t_2)));
} else {
tmp = fabs((t_3 + (t_1 * (ew * (t / eh)))));
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double t_1 = ew * Math.sin(t);
double t_2 = Math.sin(Math.atan((eh / (ew * t))));
double t_3 = (eh * Math.cos(t)) * t_2;
double tmp;
if (eh <= -2.4e+237) {
tmp = Math.abs((t_3 + (t_1 * ((ew * t) / eh))));
} else if (eh <= 5e+119) {
tmp = Math.abs(((t_1 * (1.0 / Math.hypot(1.0, ((eh / t) / ew)))) + (eh * t_2)));
} else {
tmp = Math.abs((t_3 + (t_1 * (ew * (t / eh)))));
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.sin(t) t_2 = math.sin(math.atan((eh / (ew * t)))) t_3 = (eh * math.cos(t)) * t_2 tmp = 0 if eh <= -2.4e+237: tmp = math.fabs((t_3 + (t_1 * ((ew * t) / eh)))) elif eh <= 5e+119: tmp = math.fabs(((t_1 * (1.0 / math.hypot(1.0, ((eh / t) / ew)))) + (eh * t_2))) else: tmp = math.fabs((t_3 + (t_1 * (ew * (t / eh))))) return tmp
function code(eh, ew, t) t_1 = Float64(ew * sin(t)) t_2 = sin(atan(Float64(eh / Float64(ew * t)))) t_3 = Float64(Float64(eh * cos(t)) * t_2) tmp = 0.0 if (eh <= -2.4e+237) tmp = abs(Float64(t_3 + Float64(t_1 * Float64(Float64(ew * t) / eh)))); elseif (eh <= 5e+119) tmp = abs(Float64(Float64(t_1 * Float64(1.0 / hypot(1.0, Float64(Float64(eh / t) / ew)))) + Float64(eh * t_2))); else tmp = abs(Float64(t_3 + Float64(t_1 * Float64(ew * Float64(t / eh))))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * sin(t); t_2 = sin(atan((eh / (ew * t)))); t_3 = (eh * cos(t)) * t_2; tmp = 0.0; if (eh <= -2.4e+237) tmp = abs((t_3 + (t_1 * ((ew * t) / eh)))); elseif (eh <= 5e+119) tmp = abs(((t_1 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * t_2))); else tmp = abs((t_3 + (t_1 * (ew * (t / eh))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]}, If[LessEqual[eh, -2.4e+237], N[Abs[N[(t$95$3 + N[(t$95$1 * N[(N[(ew * t), $MachinePrecision] / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 5e+119], N[Abs[N[(N[(t$95$1 * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(t$95$3 + N[(t$95$1 * N[(ew * N[(t / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \sin t\\
t_2 := \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\\
t_3 := \left(eh \cdot \cos t\right) \cdot t\_2\\
\mathbf{if}\;eh \leq -2.4 \cdot 10^{+237}:\\
\;\;\;\;\left|t\_3 + t\_1 \cdot \frac{ew \cdot t}{eh}\right|\\
\mathbf{elif}\;eh \leq 5 \cdot 10^{+119}:\\
\;\;\;\;\left|t\_1 \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)} + eh \cdot t\_2\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t\_3 + t\_1 \cdot \left(ew \cdot \frac{t}{eh}\right)\right|\\
\end{array}
\end{array}
if eh < -2.3999999999999999e237Initial program 99.6%
cos-atan99.6%
hypot-1-def99.6%
associate-/l/99.6%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in t around 0 99.6%
Taylor expanded in t around 0 85.3%
Taylor expanded in eh around inf 85.7%
if -2.3999999999999999e237 < eh < 4.9999999999999999e119Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/l/99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 99.3%
Taylor expanded in t around 0 91.4%
Taylor expanded in t around 0 85.5%
*-commutative85.5%
Simplified85.5%
if 4.9999999999999999e119 < eh Initial program 99.9%
cos-atan99.9%
hypot-1-def99.9%
associate-/l/99.9%
associate-/r*99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 97.5%
Taylor expanded in t around 0 85.6%
Taylor expanded in eh around inf 85.4%
associate-*r/85.4%
Simplified85.4%
Final simplification85.5%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (atan (/ eh (* ew t)))) (t_2 (sin t_1)))
(if (or (<= t -70.0) (not (<= t 31000.0)))
(fabs (+ (* (* eh (cos t)) t_2) (* (* ew (sin t)) (* ew (/ t eh)))))
(fabs (+ (* ew (* t (cos t_1))) (* eh t_2))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh / (ew * t)));
double t_2 = sin(t_1);
double tmp;
if ((t <= -70.0) || !(t <= 31000.0)) {
tmp = fabs((((eh * cos(t)) * t_2) + ((ew * sin(t)) * (ew * (t / eh)))));
} else {
tmp = fabs(((ew * (t * cos(t_1))) + (eh * t_2)));
}
return tmp;
}
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
real(8) :: t_2
real(8) :: tmp
t_1 = atan((eh / (ew * t)))
t_2 = sin(t_1)
if ((t <= (-70.0d0)) .or. (.not. (t <= 31000.0d0))) then
tmp = abs((((eh * cos(t)) * t_2) + ((ew * sin(t)) * (ew * (t / eh)))))
else
tmp = abs(((ew * (t * cos(t_1))) + (eh * t_2)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan((eh / (ew * t)));
double t_2 = Math.sin(t_1);
double tmp;
if ((t <= -70.0) || !(t <= 31000.0)) {
tmp = Math.abs((((eh * Math.cos(t)) * t_2) + ((ew * Math.sin(t)) * (ew * (t / eh)))));
} else {
tmp = Math.abs(((ew * (t * Math.cos(t_1))) + (eh * t_2)));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.atan((eh / (ew * t))) t_2 = math.sin(t_1) tmp = 0 if (t <= -70.0) or not (t <= 31000.0): tmp = math.fabs((((eh * math.cos(t)) * t_2) + ((ew * math.sin(t)) * (ew * (t / eh))))) else: tmp = math.fabs(((ew * (t * math.cos(t_1))) + (eh * t_2))) return tmp
function code(eh, ew, t) t_1 = atan(Float64(eh / Float64(ew * t))) t_2 = sin(t_1) tmp = 0.0 if ((t <= -70.0) || !(t <= 31000.0)) tmp = abs(Float64(Float64(Float64(eh * cos(t)) * t_2) + Float64(Float64(ew * sin(t)) * Float64(ew * Float64(t / eh))))); else tmp = abs(Float64(Float64(ew * Float64(t * cos(t_1))) + Float64(eh * t_2))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = atan((eh / (ew * t))); t_2 = sin(t_1); tmp = 0.0; if ((t <= -70.0) || ~((t <= 31000.0))) tmp = abs((((eh * cos(t)) * t_2) + ((ew * sin(t)) * (ew * (t / eh))))); else tmp = abs(((ew * (t * cos(t_1))) + (eh * t_2))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$1], $MachinePrecision]}, If[Or[LessEqual[t, -70.0], N[Not[LessEqual[t, 31000.0]], $MachinePrecision]], N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(ew * N[(t / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * N[(t * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\\
t_2 := \sin t\_1\\
\mathbf{if}\;t \leq -70 \lor \neg \left(t \leq 31000\right):\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot t\_2 + \left(ew \cdot \sin t\right) \cdot \left(ew \cdot \frac{t}{eh}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \left(t \cdot \cos t\_1\right) + eh \cdot t\_2\right|\\
\end{array}
\end{array}
if t < -70 or 31000 < t Initial program 99.6%
cos-atan99.6%
hypot-1-def99.6%
associate-/l/99.6%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in t around 0 97.9%
Taylor expanded in t around 0 78.6%
Taylor expanded in eh around inf 31.1%
associate-*r/30.9%
Simplified30.9%
if -70 < t < 31000Initial program 100.0%
Taylor expanded in t around 0 99.8%
Taylor expanded in t around 0 96.9%
Taylor expanded in t around 0 96.9%
Taylor expanded in t around 0 96.9%
*-commutative96.9%
Simplified96.9%
Final simplification66.5%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (atan (/ eh (* ew t)))) (t_2 (sin t_1)))
(if (or (<= t -70.0) (not (<= t 31000.0)))
(fabs (+ (* (* eh (cos t)) t_2) (* (* ew (sin t)) (/ (* ew t) eh))))
(fabs (+ (* ew (* t (cos t_1))) (* eh t_2))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh / (ew * t)));
double t_2 = sin(t_1);
double tmp;
if ((t <= -70.0) || !(t <= 31000.0)) {
tmp = fabs((((eh * cos(t)) * t_2) + ((ew * sin(t)) * ((ew * t) / eh))));
} else {
tmp = fabs(((ew * (t * cos(t_1))) + (eh * t_2)));
}
return tmp;
}
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
real(8) :: t_2
real(8) :: tmp
t_1 = atan((eh / (ew * t)))
t_2 = sin(t_1)
if ((t <= (-70.0d0)) .or. (.not. (t <= 31000.0d0))) then
tmp = abs((((eh * cos(t)) * t_2) + ((ew * sin(t)) * ((ew * t) / eh))))
else
tmp = abs(((ew * (t * cos(t_1))) + (eh * t_2)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan((eh / (ew * t)));
double t_2 = Math.sin(t_1);
double tmp;
if ((t <= -70.0) || !(t <= 31000.0)) {
tmp = Math.abs((((eh * Math.cos(t)) * t_2) + ((ew * Math.sin(t)) * ((ew * t) / eh))));
} else {
tmp = Math.abs(((ew * (t * Math.cos(t_1))) + (eh * t_2)));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.atan((eh / (ew * t))) t_2 = math.sin(t_1) tmp = 0 if (t <= -70.0) or not (t <= 31000.0): tmp = math.fabs((((eh * math.cos(t)) * t_2) + ((ew * math.sin(t)) * ((ew * t) / eh)))) else: tmp = math.fabs(((ew * (t * math.cos(t_1))) + (eh * t_2))) return tmp
function code(eh, ew, t) t_1 = atan(Float64(eh / Float64(ew * t))) t_2 = sin(t_1) tmp = 0.0 if ((t <= -70.0) || !(t <= 31000.0)) tmp = abs(Float64(Float64(Float64(eh * cos(t)) * t_2) + Float64(Float64(ew * sin(t)) * Float64(Float64(ew * t) / eh)))); else tmp = abs(Float64(Float64(ew * Float64(t * cos(t_1))) + Float64(eh * t_2))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = atan((eh / (ew * t))); t_2 = sin(t_1); tmp = 0.0; if ((t <= -70.0) || ~((t <= 31000.0))) tmp = abs((((eh * cos(t)) * t_2) + ((ew * sin(t)) * ((ew * t) / eh)))); else tmp = abs(((ew * (t * cos(t_1))) + (eh * t_2))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$1], $MachinePrecision]}, If[Or[LessEqual[t, -70.0], N[Not[LessEqual[t, 31000.0]], $MachinePrecision]], N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(N[(ew * t), $MachinePrecision] / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * N[(t * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\\
t_2 := \sin t\_1\\
\mathbf{if}\;t \leq -70 \lor \neg \left(t \leq 31000\right):\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot t\_2 + \left(ew \cdot \sin t\right) \cdot \frac{ew \cdot t}{eh}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \left(t \cdot \cos t\_1\right) + eh \cdot t\_2\right|\\
\end{array}
\end{array}
if t < -70 or 31000 < t Initial program 99.6%
cos-atan99.6%
hypot-1-def99.6%
associate-/l/99.6%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in t around 0 97.9%
Taylor expanded in t around 0 78.6%
Taylor expanded in eh around inf 31.1%
if -70 < t < 31000Initial program 100.0%
Taylor expanded in t around 0 99.8%
Taylor expanded in t around 0 96.9%
Taylor expanded in t around 0 96.9%
Taylor expanded in t around 0 96.9%
*-commutative96.9%
Simplified96.9%
Final simplification66.6%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* eh (sin (atan (/ eh (* ew t))))) (* t (/ ew (hypot 1.0 (/ eh (* ew (tan t)))))))))
double code(double eh, double ew, double t) {
return fabs(((eh * sin(atan((eh / (ew * t))))) + (t * (ew / hypot(1.0, (eh / (ew * tan(t))))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((eh * Math.sin(Math.atan((eh / (ew * t))))) + (t * (ew / Math.hypot(1.0, (eh / (ew * Math.tan(t))))))));
}
def code(eh, ew, t): return math.fabs(((eh * math.sin(math.atan((eh / (ew * t))))) + (t * (ew / math.hypot(1.0, (eh / (ew * math.tan(t))))))))
function code(eh, ew, t) return abs(Float64(Float64(eh * sin(atan(Float64(eh / Float64(ew * t))))) + Float64(t * Float64(ew / hypot(1.0, Float64(eh / Float64(ew * tan(t)))))))) end
function tmp = code(eh, ew, t) tmp = abs(((eh * sin(atan((eh / (ew * t))))) + (t * (ew / hypot(1.0, (eh / (ew * tan(t)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t * N[(ew / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) + t \cdot \frac{ew}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 81.6%
Taylor expanded in t around 0 57.3%
Taylor expanded in t around 0 57.2%
associate-*r*57.2%
associate-/l/57.2%
cos-atan57.2%
hypot-1-def57.2%
un-div-inv57.2%
*-commutative57.2%
associate-/l/57.2%
associate-/r*57.2%
Applied egg-rr57.2%
associate-/l*57.2%
associate-/l/57.2%
*-commutative57.2%
Simplified57.2%
Final simplification57.2%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* eh (sin (atan (/ eh (* ew t))))) (/ (* ew t) (hypot 1.0 (/ (/ eh ew) (tan t)))))))
double code(double eh, double ew, double t) {
return fabs(((eh * sin(atan((eh / (ew * t))))) + ((ew * t) / hypot(1.0, ((eh / ew) / tan(t))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((eh * Math.sin(Math.atan((eh / (ew * t))))) + ((ew * t) / Math.hypot(1.0, ((eh / ew) / Math.tan(t))))));
}
def code(eh, ew, t): return math.fabs(((eh * math.sin(math.atan((eh / (ew * t))))) + ((ew * t) / math.hypot(1.0, ((eh / ew) / math.tan(t))))))
function code(eh, ew, t) return abs(Float64(Float64(eh * sin(atan(Float64(eh / Float64(ew * t))))) + Float64(Float64(ew * t) / hypot(1.0, Float64(Float64(eh / ew) / tan(t)))))) end
function tmp = code(eh, ew, t) tmp = abs(((eh * sin(atan((eh / (ew * t))))) + ((ew * t) / hypot(1.0, ((eh / ew) / tan(t)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(ew * t), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) + \frac{ew \cdot t}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 81.6%
Taylor expanded in t around 0 57.3%
Taylor expanded in t around 0 57.2%
associate-*r*57.2%
associate-/l/57.2%
cos-atan57.2%
hypot-1-def57.2%
un-div-inv57.2%
*-commutative57.2%
associate-/l/57.2%
associate-/r*57.2%
Applied egg-rr57.2%
Final simplification57.2%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ eh (* ew t))))) (fabs (+ (* ew (* t (cos t_1))) (* eh (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh / (ew * t)));
return fabs(((ew * (t * cos(t_1))) + (eh * 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 * t)))
code = abs(((ew * (t * cos(t_1))) + (eh * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan((eh / (ew * t)));
return Math.abs(((ew * (t * Math.cos(t_1))) + (eh * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan((eh / (ew * t))) return math.fabs(((ew * (t * math.cos(t_1))) + (eh * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(eh / Float64(ew * t))) return abs(Float64(Float64(ew * Float64(t * cos(t_1))) + Float64(eh * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan((eh / (ew * t))); tmp = abs(((ew * (t * cos(t_1))) + (eh * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(ew * N[(t * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\\
\left|ew \cdot \left(t \cdot \cos t\_1\right) + eh \cdot \sin t\_1\right|
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 81.6%
Taylor expanded in t around 0 57.3%
Taylor expanded in t around 0 57.2%
Taylor expanded in t around 0 57.1%
*-commutative57.1%
Simplified57.1%
Final simplification57.1%
herbie shell --seed 2024077
(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))))))))