
(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 8 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 (/ eh (* ew (tan t)))))
(fabs
(+
(* ew (/ (sin t) (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) / 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) / 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) / math.hypot(1.0, t_1))) + (eh * (math.cos(t) * math.sin(math.atan(t_1))))))
function code(eh, ew, t) t_1 = Float64(eh / Float64(ew * tan(t))) return abs(Float64(Float64(ew * Float64(sin(t) / hypot(1.0, t_1))) + Float64(eh * Float64(cos(t) * sin(atan(t_1)))))) end
function tmp = code(eh, ew, t) t_1 = eh / (ew * tan(t)); tmp = abs(((ew * (sin(t) / hypot(1.0, t_1))) + (eh * (cos(t) * sin(atan(t_1)))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(ew * N[(N[Sin[t], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot \tan t}\\
\left|ew \cdot \frac{\sin t}{\mathsf{hypot}\left(1, t\_1\right)} + eh \cdot \left(\cos t \cdot \sin \tan^{-1} t\_1\right)\right|
\end{array}
\end{array}
Initial program 99.8%
associate-*l*99.9%
fma-define99.9%
associate-*l*99.9%
Simplified99.9%
fma-undefine99.9%
cos-atan99.8%
un-div-inv99.8%
hypot-1-def99.9%
associate-/l/99.9%
*-commutative99.9%
associate-/l/99.9%
*-commutative99.9%
Applied egg-rr99.9%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* ew (sin t)) (cos (atan (/ eh (* ew 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 * 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)) * cos(atan((eh / (ew * 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)) * Math.cos(Math.atan((eh / (ew * 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 * 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(eh / Float64(ew * 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 * 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[(eh / N[(ew * 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]
\begin{array}{l}
\\
\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\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%
Taylor expanded in t around 0 98.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* eh (* (cos t) (sin (atan (/ eh (* ew (tan t))))))) (* ew (sin t)))))
double code(double eh, double ew, double t) {
return fabs(((eh * (cos(t) * sin(atan((eh / (ew * tan(t))))))) + (ew * sin(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))))
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))));
}
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))))
function code(eh, ew, t) return abs(Float64(Float64(eh * Float64(cos(t) * sin(atan(Float64(eh / Float64(ew * tan(t))))))) + Float64(ew * sin(t)))) end
function tmp = code(eh, ew, t) tmp = abs(((eh * (cos(t) * sin(atan((eh / (ew * tan(t))))))) + (ew * sin(t)))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right) + ew \cdot \sin t\right|
\end{array}
Initial program 99.8%
associate-*l*99.9%
fma-define99.9%
associate-*l*99.9%
Simplified99.9%
fma-undefine99.9%
cos-atan99.8%
un-div-inv99.8%
hypot-1-def99.9%
associate-/l/99.9%
*-commutative99.9%
associate-/l/99.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in ew around inf 97.8%
Final simplification97.8%
(FPCore (eh ew t)
:precision binary64
(if (or (<= ew -2.1e+29)
(not
(or (<= ew -1.25e-78)
(and (not (<= ew -1.35e-90)) (<= ew 5.4e+37)))))
(fabs (* (* ew (sin t)) (cos (atan (/ eh (* ew t))))))
(fabs (* eh (* (cos t) (sin (atan (/ (/ eh ew) (tan t)))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -2.1e+29) || !((ew <= -1.25e-78) || (!(ew <= -1.35e-90) && (ew <= 5.4e+37)))) {
tmp = fabs(((ew * sin(t)) * cos(atan((eh / (ew * t))))));
} else {
tmp = fabs((eh * (cos(t) * sin(atan(((eh / ew) / tan(t)))))));
}
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) :: tmp
if ((ew <= (-2.1d+29)) .or. (.not. (ew <= (-1.25d-78)) .or. (.not. (ew <= (-1.35d-90))) .and. (ew <= 5.4d+37))) then
tmp = abs(((ew * sin(t)) * cos(atan((eh / (ew * t))))))
else
tmp = abs((eh * (cos(t) * sin(atan(((eh / ew) / tan(t)))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -2.1e+29) || !((ew <= -1.25e-78) || (!(ew <= -1.35e-90) && (ew <= 5.4e+37)))) {
tmp = Math.abs(((ew * Math.sin(t)) * Math.cos(Math.atan((eh / (ew * t))))));
} else {
tmp = Math.abs((eh * (Math.cos(t) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -2.1e+29) or not ((ew <= -1.25e-78) or (not (ew <= -1.35e-90) and (ew <= 5.4e+37))): tmp = math.fabs(((ew * math.sin(t)) * math.cos(math.atan((eh / (ew * t)))))) else: tmp = math.fabs((eh * (math.cos(t) * math.sin(math.atan(((eh / ew) / math.tan(t))))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -2.1e+29) || !((ew <= -1.25e-78) || (!(ew <= -1.35e-90) && (ew <= 5.4e+37)))) tmp = abs(Float64(Float64(ew * sin(t)) * cos(atan(Float64(eh / Float64(ew * t)))))); else tmp = abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(Float64(eh / ew) / tan(t))))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -2.1e+29) || ~(((ew <= -1.25e-78) || (~((ew <= -1.35e-90)) && (ew <= 5.4e+37))))) tmp = abs(((ew * sin(t)) * cos(atan((eh / (ew * t)))))); else tmp = abs((eh * (cos(t) * sin(atan(((eh / ew) / tan(t))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -2.1e+29], N[Not[Or[LessEqual[ew, -1.25e-78], And[N[Not[LessEqual[ew, -1.35e-90]], $MachinePrecision], LessEqual[ew, 5.4e+37]]]], $MachinePrecision]], N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * 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}\;ew \leq -2.1 \cdot 10^{+29} \lor \neg \left(ew \leq -1.25 \cdot 10^{-78} \lor \neg \left(ew \leq -1.35 \cdot 10^{-90}\right) \land ew \leq 5.4 \cdot 10^{+37}\right):\\
\;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right|\\
\end{array}
\end{array}
if ew < -2.1000000000000002e29 or -1.2499999999999999e-78 < ew < -1.34999999999999998e-90 or 5.39999999999999973e37 < ew Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in ew around inf 75.9%
*-commutative75.9%
associate-*l*75.9%
associate-/r*75.9%
*-commutative75.9%
Simplified75.9%
Taylor expanded in t around 0 76.0%
if -2.1000000000000002e29 < ew < -1.2499999999999999e-78 or -1.34999999999999998e-90 < ew < 5.39999999999999973e37Initial program 99.9%
associate-*l*99.9%
fma-define99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in ew around 0 87.2%
associate-/r*87.2%
Simplified87.2%
Final simplification81.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* (* ew (sin t)) (cos (atan (/ eh (* ew t))))))))
(if (<= ew -8e+26)
t_1
(if (<= ew -8.6e-79)
(fabs
(*
eh
(*
(cos t)
(sin
(atan
(/
(+ (/ eh ew) (* -0.3333333333333333 (/ (* eh (pow t 2.0)) ew)))
t))))))
(if (or (<= ew -1.35e-90) (not (<= ew 4.2e+38)))
t_1
(fabs (* eh (* (cos t) (sin (atan (/ (/ eh ew) (tan t))))))))))))
double code(double eh, double ew, double t) {
double t_1 = fabs(((ew * sin(t)) * cos(atan((eh / (ew * t))))));
double tmp;
if (ew <= -8e+26) {
tmp = t_1;
} else if (ew <= -8.6e-79) {
tmp = fabs((eh * (cos(t) * sin(atan((((eh / ew) + (-0.3333333333333333 * ((eh * pow(t, 2.0)) / ew))) / t))))));
} else if ((ew <= -1.35e-90) || !(ew <= 4.2e+38)) {
tmp = t_1;
} else {
tmp = fabs((eh * (cos(t) * sin(atan(((eh / ew) / tan(t)))))));
}
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) :: tmp
t_1 = abs(((ew * sin(t)) * cos(atan((eh / (ew * t))))))
if (ew <= (-8d+26)) then
tmp = t_1
else if (ew <= (-8.6d-79)) then
tmp = abs((eh * (cos(t) * sin(atan((((eh / ew) + ((-0.3333333333333333d0) * ((eh * (t ** 2.0d0)) / ew))) / t))))))
else if ((ew <= (-1.35d-90)) .or. (.not. (ew <= 4.2d+38))) then
tmp = t_1
else
tmp = abs((eh * (cos(t) * sin(atan(((eh / ew) / tan(t)))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs(((ew * Math.sin(t)) * Math.cos(Math.atan((eh / (ew * t))))));
double tmp;
if (ew <= -8e+26) {
tmp = t_1;
} else if (ew <= -8.6e-79) {
tmp = Math.abs((eh * (Math.cos(t) * Math.sin(Math.atan((((eh / ew) + (-0.3333333333333333 * ((eh * Math.pow(t, 2.0)) / ew))) / t))))));
} else if ((ew <= -1.35e-90) || !(ew <= 4.2e+38)) {
tmp = t_1;
} else {
tmp = Math.abs((eh * (Math.cos(t) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs(((ew * math.sin(t)) * math.cos(math.atan((eh / (ew * t)))))) tmp = 0 if ew <= -8e+26: tmp = t_1 elif ew <= -8.6e-79: tmp = math.fabs((eh * (math.cos(t) * math.sin(math.atan((((eh / ew) + (-0.3333333333333333 * ((eh * math.pow(t, 2.0)) / ew))) / t)))))) elif (ew <= -1.35e-90) or not (ew <= 4.2e+38): tmp = t_1 else: tmp = math.fabs((eh * (math.cos(t) * math.sin(math.atan(((eh / ew) / math.tan(t))))))) return tmp
function code(eh, ew, t) t_1 = abs(Float64(Float64(ew * sin(t)) * cos(atan(Float64(eh / Float64(ew * t)))))) tmp = 0.0 if (ew <= -8e+26) tmp = t_1; elseif (ew <= -8.6e-79) tmp = abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(Float64(Float64(eh / ew) + Float64(-0.3333333333333333 * Float64(Float64(eh * (t ^ 2.0)) / ew))) / t)))))); elseif ((ew <= -1.35e-90) || !(ew <= 4.2e+38)) tmp = t_1; else tmp = abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(Float64(eh / ew) / tan(t))))))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs(((ew * sin(t)) * cos(atan((eh / (ew * t)))))); tmp = 0.0; if (ew <= -8e+26) tmp = t_1; elseif (ew <= -8.6e-79) tmp = abs((eh * (cos(t) * sin(atan((((eh / ew) + (-0.3333333333333333 * ((eh * (t ^ 2.0)) / ew))) / t)))))); elseif ((ew <= -1.35e-90) || ~((ew <= 4.2e+38))) tmp = t_1; else tmp = abs((eh * (cos(t) * sin(atan(((eh / ew) / tan(t))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -8e+26], t$95$1, If[LessEqual[ew, -8.6e-79], N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[(eh / ew), $MachinePrecision] + N[(-0.3333333333333333 * N[(N[(eh * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[ew, -1.35e-90], N[Not[LessEqual[ew, 4.2e+38]], $MachinePrecision]], t$95$1, N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * 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}
t_1 := \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\
\mathbf{if}\;ew \leq -8 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq -8.6 \cdot 10^{-79}:\\
\;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew} + -0.3333333333333333 \cdot \frac{eh \cdot {t}^{2}}{ew}}{t}\right)\right)\right|\\
\mathbf{elif}\;ew \leq -1.35 \cdot 10^{-90} \lor \neg \left(ew \leq 4.2 \cdot 10^{+38}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right|\\
\end{array}
\end{array}
if ew < -8.00000000000000038e26 or -8.59999999999999963e-79 < ew < -1.34999999999999998e-90 or 4.2e38 < ew Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in ew around inf 75.9%
*-commutative75.9%
associate-*l*75.9%
associate-/r*75.9%
*-commutative75.9%
Simplified75.9%
Taylor expanded in t around 0 76.0%
if -8.00000000000000038e26 < ew < -8.59999999999999963e-79Initial program 99.9%
associate-*l*99.9%
fma-define99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in ew around 0 76.0%
associate-/r*76.0%
Simplified76.0%
Taylor expanded in t around 0 76.1%
if -1.34999999999999998e-90 < ew < 4.2e38Initial program 99.9%
associate-*l*99.9%
fma-define99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in ew around 0 88.9%
associate-/r*88.9%
Simplified88.9%
Final simplification81.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (atan (/ eh (* ew t)))))
(if (or (<= ew -5.5e+25)
(and (not (<= ew -8.6e-79))
(or (<= ew -1.35e-90) (not (<= ew 6.1e+41)))))
(fabs (* (* ew (sin t)) (cos t_1)))
(fabs (* eh (* (cos t) (sin t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh / (ew * t)));
double tmp;
if ((ew <= -5.5e+25) || (!(ew <= -8.6e-79) && ((ew <= -1.35e-90) || !(ew <= 6.1e+41)))) {
tmp = fabs(((ew * sin(t)) * cos(t_1)));
} else {
tmp = fabs((eh * (cos(t) * sin(t_1))));
}
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) :: tmp
t_1 = atan((eh / (ew * t)))
if ((ew <= (-5.5d+25)) .or. (.not. (ew <= (-8.6d-79))) .and. (ew <= (-1.35d-90)) .or. (.not. (ew <= 6.1d+41))) then
tmp = abs(((ew * sin(t)) * cos(t_1)))
else
tmp = abs((eh * (cos(t) * sin(t_1))))
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 tmp;
if ((ew <= -5.5e+25) || (!(ew <= -8.6e-79) && ((ew <= -1.35e-90) || !(ew <= 6.1e+41)))) {
tmp = Math.abs(((ew * Math.sin(t)) * Math.cos(t_1)));
} else {
tmp = Math.abs((eh * (Math.cos(t) * Math.sin(t_1))));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.atan((eh / (ew * t))) tmp = 0 if (ew <= -5.5e+25) or (not (ew <= -8.6e-79) and ((ew <= -1.35e-90) or not (ew <= 6.1e+41))): tmp = math.fabs(((ew * math.sin(t)) * math.cos(t_1))) else: tmp = math.fabs((eh * (math.cos(t) * math.sin(t_1)))) return tmp
function code(eh, ew, t) t_1 = atan(Float64(eh / Float64(ew * t))) tmp = 0.0 if ((ew <= -5.5e+25) || (!(ew <= -8.6e-79) && ((ew <= -1.35e-90) || !(ew <= 6.1e+41)))) tmp = abs(Float64(Float64(ew * sin(t)) * cos(t_1))); else tmp = abs(Float64(eh * Float64(cos(t) * sin(t_1)))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = atan((eh / (ew * t))); tmp = 0.0; if ((ew <= -5.5e+25) || (~((ew <= -8.6e-79)) && ((ew <= -1.35e-90) || ~((ew <= 6.1e+41))))) tmp = abs(((ew * sin(t)) * cos(t_1))); else tmp = abs((eh * (cos(t) * sin(t_1)))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[ew, -5.5e+25], And[N[Not[LessEqual[ew, -8.6e-79]], $MachinePrecision], Or[LessEqual[ew, -1.35e-90], N[Not[LessEqual[ew, 6.1e+41]], $MachinePrecision]]]], N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * 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)\\
\mathbf{if}\;ew \leq -5.5 \cdot 10^{+25} \lor \neg \left(ew \leq -8.6 \cdot 10^{-79}\right) \land \left(ew \leq -1.35 \cdot 10^{-90} \lor \neg \left(ew \leq 6.1 \cdot 10^{+41}\right)\right):\\
\;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin t\_1\right)\right|\\
\end{array}
\end{array}
if ew < -5.50000000000000018e25 or -8.59999999999999963e-79 < ew < -1.34999999999999998e-90 or 6.09999999999999998e41 < ew Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in ew around inf 75.9%
*-commutative75.9%
associate-*l*75.9%
associate-/r*75.9%
*-commutative75.9%
Simplified75.9%
Taylor expanded in t around 0 76.0%
if -5.50000000000000018e25 < ew < -8.59999999999999963e-79 or -1.34999999999999998e-90 < ew < 6.09999999999999998e41Initial program 99.9%
associate-*l*99.9%
fma-define99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in ew around 0 87.2%
associate-/r*87.2%
Simplified87.2%
Taylor expanded in t around 0 78.6%
Final simplification77.2%
(FPCore (eh ew t) :precision binary64 (fabs (* eh (* (cos t) (sin (atan (/ eh (* ew t))))))))
double code(double eh, double ew, double t) {
return fabs((eh * (cos(t) * sin(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 * 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 * t)))))));
}
def code(eh, ew, t): return math.fabs((eh * (math.cos(t) * math.sin(math.atan((eh / (ew * t)))))))
function code(eh, ew, t) return abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(eh / Float64(ew * t))))))) end
function tmp = code(eh, ew, t) tmp = abs((eh * (cos(t) * sin(atan((eh / (ew * t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right)\right|
\end{array}
Initial program 99.8%
associate-*l*99.9%
fma-define99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in ew around 0 54.7%
associate-/r*54.7%
Simplified54.7%
Taylor expanded in t around 0 48.9%
(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%
associate-*l*99.9%
fma-define99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in t around 0 42.5%
Taylor expanded in t around 0 41.1%
*-commutative41.1%
Simplified41.1%
*-commutative41.1%
sin-atan12.1%
associate-*l/11.5%
*-commutative11.5%
associate-/r*11.5%
hypot-1-def14.5%
*-commutative14.5%
associate-/r*20.7%
Applied egg-rr20.7%
Taylor expanded in eh around inf 43.1%
herbie shell --seed 2024096
(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))))))))