
(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 (tan t)) ew)))) (fabs (fma ew (* (sin t) (cos t_1)) (* (cos t) (* eh (sin t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / tan(t)) / ew));
return fabs(fma(ew, (sin(t) * cos(t_1)), (cos(t) * (eh * sin(t_1)))));
}
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / tan(t)) / ew)) return abs(fma(ew, Float64(sin(t) * cos(t_1)), Float64(cos(t) * Float64(eh * sin(t_1))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(ew * N[(N[Sin[t], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[t], $MachinePrecision] * N[(eh * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)\\
\left|\mathsf{fma}\left(ew, \sin t \cdot \cos t_1, \cos t \cdot \left(eh \cdot \sin t_1\right)\right)\right|
\end{array}
\end{array}
Initial program 99.9%
associate-*l*99.9%
fma-def99.9%
associate-/l/99.9%
associate-/r*99.9%
*-commutative99.9%
associate-*l*99.9%
associate-/l/99.9%
associate-/r*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (/ (sin t) (hypot 1.0 (/ eh (* ew (tan t)))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * (sin(t) / hypot(1.0, (eh / (ew * tan(t)))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * (Math.sin(t) / Math.hypot(1.0, (eh / (ew * Math.tan(t)))))) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t): return math.fabs(((ew * (math.sin(t) / math.hypot(1.0, (eh / (ew * math.tan(t)))))) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * Float64(sin(t) / hypot(1.0, Float64(eh / Float64(ew * tan(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) / hypot(1.0, (eh / (ew * tan(t)))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[(N[Sin[t], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $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|ew \cdot \frac{\sin t}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan 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.9%
expm1-log1p-u78.9%
expm1-udef70.0%
associate-*l*70.0%
cos-atan73.5%
un-div-inv73.5%
hypot-1-def73.5%
associate-/r*73.5%
Applied egg-rr73.5%
expm1-def82.4%
expm1-log1p99.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* (cos (atan (/ eh (* ew t)))) (* ew (sin t))))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (cos(atan((eh / (ew * 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))))) + (cos(atan((eh / (ew * 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))))) + (Math.cos(Math.atan((eh / (ew * 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))))) + (math.cos(math.atan((eh / (ew * t)))) * (ew * math.sin(t)))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(cos(atan(Float64(eh / Float64(ew * t)))) * Float64(ew * sin(t))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (cos(atan((eh / (ew * t)))) * (ew * sin(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[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(ew * N[Sin[t], $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) + \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot \left(ew \cdot \sin t\right)\right|
\end{array}
Initial program 99.9%
Taylor expanded in t around 0 99.2%
Final simplification99.2%
(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(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / 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[(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[(ew * N[Sin[t], $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) + ew \cdot \sin t\right|
\end{array}
Initial program 99.9%
expm1-log1p-u78.9%
expm1-udef70.0%
associate-*l*70.0%
cos-atan73.5%
un-div-inv73.5%
hypot-1-def73.5%
associate-/r*73.5%
Applied egg-rr73.5%
expm1-def82.4%
expm1-log1p99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in ew around inf 98.4%
Final simplification98.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t))))
(if (or (<= eh -8e+148) (not (<= eh 6.8e+72)))
(fabs
(+
(* t_1 (sin (atan (/ (/ eh ew) (tan t)))))
(/ 1.0 (+ (* 0.16666666666666666 (/ t ew)) (/ 1.0 (* ew t))))))
(fabs
(+
(/ 1.0 (/ 1.0 (* ew (sin t))))
(* t_1 (sin (atan (/ eh (* ew t))))))))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double tmp;
if ((eh <= -8e+148) || !(eh <= 6.8e+72)) {
tmp = fabs(((t_1 * sin(atan(((eh / ew) / tan(t))))) + (1.0 / ((0.16666666666666666 * (t / ew)) + (1.0 / (ew * t))))));
} else {
tmp = fabs(((1.0 / (1.0 / (ew * sin(t)))) + (t_1 * sin(atan((eh / (ew * 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 = eh * cos(t)
if ((eh <= (-8d+148)) .or. (.not. (eh <= 6.8d+72))) then
tmp = abs(((t_1 * sin(atan(((eh / ew) / tan(t))))) + (1.0d0 / ((0.16666666666666666d0 * (t / ew)) + (1.0d0 / (ew * t))))))
else
tmp = abs(((1.0d0 / (1.0d0 / (ew * sin(t)))) + (t_1 * sin(atan((eh / (ew * t)))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = eh * Math.cos(t);
double tmp;
if ((eh <= -8e+148) || !(eh <= 6.8e+72)) {
tmp = Math.abs(((t_1 * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + (1.0 / ((0.16666666666666666 * (t / ew)) + (1.0 / (ew * t))))));
} else {
tmp = Math.abs(((1.0 / (1.0 / (ew * Math.sin(t)))) + (t_1 * Math.sin(Math.atan((eh / (ew * t)))))));
}
return tmp;
}
def code(eh, ew, t): t_1 = eh * math.cos(t) tmp = 0 if (eh <= -8e+148) or not (eh <= 6.8e+72): tmp = math.fabs(((t_1 * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (1.0 / ((0.16666666666666666 * (t / ew)) + (1.0 / (ew * t)))))) else: tmp = math.fabs(((1.0 / (1.0 / (ew * math.sin(t)))) + (t_1 * math.sin(math.atan((eh / (ew * t))))))) return tmp
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) tmp = 0.0 if ((eh <= -8e+148) || !(eh <= 6.8e+72)) tmp = abs(Float64(Float64(t_1 * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(1.0 / Float64(Float64(0.16666666666666666 * Float64(t / ew)) + Float64(1.0 / Float64(ew * t)))))); else tmp = abs(Float64(Float64(1.0 / Float64(1.0 / Float64(ew * sin(t)))) + Float64(t_1 * sin(atan(Float64(eh / Float64(ew * t))))))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh * cos(t); tmp = 0.0; if ((eh <= -8e+148) || ~((eh <= 6.8e+72))) tmp = abs(((t_1 * sin(atan(((eh / ew) / tan(t))))) + (1.0 / ((0.16666666666666666 * (t / ew)) + (1.0 / (ew * t)))))); else tmp = abs(((1.0 / (1.0 / (ew * sin(t)))) + (t_1 * sin(atan((eh / (ew * t))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -8e+148], N[Not[LessEqual[eh, 6.8e+72]], $MachinePrecision]], N[Abs[N[(N[(t$95$1 * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[(0.16666666666666666 * N[(t / ew), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(ew * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(1.0 / N[(1.0 / N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
\mathbf{if}\;eh \leq -8 \cdot 10^{+148} \lor \neg \left(eh \leq 6.8 \cdot 10^{+72}\right):\\
\;\;\;\;\left|t_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \frac{1}{0.16666666666666666 \cdot \frac{t}{ew} + \frac{1}{ew \cdot t}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{1}{\frac{1}{ew \cdot \sin t}} + t_1 \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\
\end{array}
\end{array}
if eh < -8.0000000000000004e148 or 6.7999999999999997e72 < eh Initial program 99.8%
expm1-log1p-u75.7%
expm1-udef75.7%
associate-*l*75.7%
cos-atan86.3%
un-div-inv86.3%
hypot-1-def86.3%
associate-/r*86.3%
Applied egg-rr86.3%
expm1-def86.3%
expm1-log1p99.8%
*-commutative99.8%
Simplified99.8%
associate-*r/99.8%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in eh around 0 98.4%
Taylor expanded in t around 0 92.9%
if -8.0000000000000004e148 < eh < 6.7999999999999997e72Initial program 99.9%
expm1-log1p-u80.4%
expm1-udef67.2%
associate-*l*67.2%
cos-atan67.2%
un-div-inv67.2%
hypot-1-def67.2%
associate-/r*67.2%
Applied egg-rr67.2%
expm1-def80.4%
expm1-log1p99.9%
*-commutative99.9%
Simplified99.9%
associate-*r/99.9%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in eh around 0 98.4%
Taylor expanded in t around 0 91.7%
Final simplification92.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (sin (atan (/ (/ eh ew) (tan t))))))
(if (or (<= ew -3.05e-139) (not (<= ew 6.1e-173)))
(fabs (+ (/ 1.0 (/ 1.0 (* ew (sin t)))) (* eh t_1)))
(fabs (+ (* (* eh (cos t)) t_1) (* ew t))))))
double code(double eh, double ew, double t) {
double t_1 = sin(atan(((eh / ew) / tan(t))));
double tmp;
if ((ew <= -3.05e-139) || !(ew <= 6.1e-173)) {
tmp = fabs(((1.0 / (1.0 / (ew * sin(t)))) + (eh * t_1)));
} else {
tmp = fabs((((eh * cos(t)) * t_1) + (ew * 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 = sin(atan(((eh / ew) / tan(t))))
if ((ew <= (-3.05d-139)) .or. (.not. (ew <= 6.1d-173))) then
tmp = abs(((1.0d0 / (1.0d0 / (ew * sin(t)))) + (eh * t_1)))
else
tmp = abs((((eh * cos(t)) * t_1) + (ew * t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.sin(Math.atan(((eh / ew) / Math.tan(t))));
double tmp;
if ((ew <= -3.05e-139) || !(ew <= 6.1e-173)) {
tmp = Math.abs(((1.0 / (1.0 / (ew * Math.sin(t)))) + (eh * t_1)));
} else {
tmp = Math.abs((((eh * Math.cos(t)) * t_1) + (ew * t)));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.sin(math.atan(((eh / ew) / math.tan(t)))) tmp = 0 if (ew <= -3.05e-139) or not (ew <= 6.1e-173): tmp = math.fabs(((1.0 / (1.0 / (ew * math.sin(t)))) + (eh * t_1))) else: tmp = math.fabs((((eh * math.cos(t)) * t_1) + (ew * t))) return tmp
function code(eh, ew, t) t_1 = sin(atan(Float64(Float64(eh / ew) / tan(t)))) tmp = 0.0 if ((ew <= -3.05e-139) || !(ew <= 6.1e-173)) tmp = abs(Float64(Float64(1.0 / Float64(1.0 / Float64(ew * sin(t)))) + Float64(eh * t_1))); else tmp = abs(Float64(Float64(Float64(eh * cos(t)) * t_1) + Float64(ew * t))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = sin(atan(((eh / ew) / tan(t)))); tmp = 0.0; if ((ew <= -3.05e-139) || ~((ew <= 6.1e-173))) tmp = abs(((1.0 / (1.0 / (ew * sin(t)))) + (eh * t_1))); else tmp = abs((((eh * cos(t)) * t_1) + (ew * t))); 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]}, If[Or[LessEqual[ew, -3.05e-139], N[Not[LessEqual[ew, 6.1e-173]], $MachinePrecision]], N[Abs[N[(N[(1.0 / N[(1.0 / N[(ew * N[Sin[t], $MachinePrecision]), $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[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\mathbf{if}\;ew \leq -3.05 \cdot 10^{-139} \lor \neg \left(ew \leq 6.1 \cdot 10^{-173}\right):\\
\;\;\;\;\left|\frac{1}{\frac{1}{ew \cdot \sin t}} + eh \cdot t_1\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot t_1 + ew \cdot t\right|\\
\end{array}
\end{array}
if ew < -3.0499999999999999e-139 or 6.0999999999999998e-173 < ew Initial program 99.8%
expm1-log1p-u72.0%
expm1-udef61.7%
associate-*l*61.7%
cos-atan66.4%
un-div-inv66.4%
hypot-1-def66.4%
associate-/r*66.4%
Applied egg-rr66.4%
expm1-def76.7%
expm1-log1p99.8%
*-commutative99.8%
Simplified99.8%
associate-*r/99.8%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in eh around 0 97.9%
Taylor expanded in t around 0 85.0%
if -3.0499999999999999e-139 < ew < 6.0999999999999998e-173Initial program 99.9%
expm1-log1p-u99.9%
expm1-udef95.5%
associate-*l*95.5%
cos-atan95.5%
un-div-inv95.5%
hypot-1-def95.5%
associate-/r*95.5%
Applied egg-rr95.5%
expm1-def99.9%
expm1-log1p99.9%
*-commutative99.9%
Simplified99.9%
associate-*r/99.9%
clear-num99.9%
Applied egg-rr99.9%
Taylor expanded in eh around 0 99.8%
Taylor expanded in t around 0 84.9%
Final simplification85.0%
(FPCore (eh ew t) :precision binary64 (fabs (+ (/ 1.0 (/ 1.0 (* ew (sin t)))) (* (* eh (cos t)) (sin (atan (/ eh (* ew t))))))))
double code(double eh, double ew, double t) {
return fabs(((1.0 / (1.0 / (ew * sin(t)))) + ((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(((1.0d0 / (1.0d0 / (ew * sin(t)))) + ((eh * cos(t)) * sin(atan((eh / (ew * t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((1.0 / (1.0 / (ew * Math.sin(t)))) + ((eh * Math.cos(t)) * Math.sin(Math.atan((eh / (ew * t)))))));
}
def code(eh, ew, t): return math.fabs(((1.0 / (1.0 / (ew * math.sin(t)))) + ((eh * math.cos(t)) * math.sin(math.atan((eh / (ew * t)))))))
function code(eh, ew, t) return abs(Float64(Float64(1.0 / Float64(1.0 / Float64(ew * sin(t)))) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * t))))))) end
function tmp = code(eh, ew, t) tmp = abs(((1.0 / (1.0 / (ew * sin(t)))) + ((eh * cos(t)) * sin(atan((eh / (ew * t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(1.0 / N[(1.0 / N[(ew * N[Sin[t], $MachinePrecision]), $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|\frac{1}{\frac{1}{ew \cdot \sin t}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|
\end{array}
Initial program 99.9%
expm1-log1p-u78.9%
expm1-udef70.0%
associate-*l*70.0%
cos-atan73.5%
un-div-inv73.5%
hypot-1-def73.5%
associate-/r*73.5%
Applied egg-rr73.5%
expm1-def82.4%
expm1-log1p99.9%
*-commutative99.9%
Simplified99.9%
associate-*r/99.9%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in eh around 0 98.4%
Taylor expanded in t around 0 87.7%
Final simplification87.7%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* ew t))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (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 * 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 * t)));
}
def code(eh, ew, t): return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (ew * t)))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(ew * t))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (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[(ew * t), $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) + ew \cdot t\right|
\end{array}
Initial program 99.9%
expm1-log1p-u78.9%
expm1-udef70.0%
associate-*l*70.0%
cos-atan73.5%
un-div-inv73.5%
hypot-1-def73.5%
associate-/r*73.5%
Applied egg-rr73.5%
expm1-def82.4%
expm1-log1p99.9%
*-commutative99.9%
Simplified99.9%
associate-*r/99.9%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in eh around 0 98.4%
Taylor expanded in t around 0 63.3%
Final simplification63.3%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ eh (* ew t))))) (* ew (* t (/ 1.0 (/ (/ eh ew) t)))))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan((eh / (ew * t))))) + (ew * (t * (1.0 / ((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))))) + (ew * (t * (1.0d0 / ((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))))) + (ew * (t * (1.0 / ((eh / ew) / t))))));
}
def code(eh, ew, t): return math.fabs((((eh * math.cos(t)) * math.sin(math.atan((eh / (ew * t))))) + (ew * (t * (1.0 / ((eh / ew) / t))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * t))))) + Float64(ew * Float64(t * Float64(1.0 / Float64(Float64(eh / ew) / t)))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan((eh / (ew * t))))) + (ew * (t * (1.0 / ((eh / ew) / t)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(ew * N[(t * N[(1.0 / N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) + ew \cdot \left(t \cdot \frac{1}{\frac{\frac{eh}{ew}}{t}}\right)\right|
\end{array}
Initial program 99.9%
expm1-log1p-u78.9%
expm1-udef70.0%
associate-*l*70.0%
cos-atan73.5%
un-div-inv73.5%
hypot-1-def73.5%
associate-/r*73.5%
Applied egg-rr73.5%
expm1-def82.4%
expm1-log1p99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 47.5%
associate-/l*47.3%
unpow247.3%
Simplified47.3%
associate-/l*51.3%
div-inv51.3%
Applied egg-rr51.3%
Taylor expanded in t around 0 51.3%
Final simplification51.3%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ eh (* ew t))))) (* ew (/ (* t t) (/ eh ew))))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan((eh / (ew * t))))) + (ew * ((t * t) / (eh / ew)))));
}
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))))) + (ew * ((t * t) / (eh / ew)))))
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))))) + (ew * ((t * t) / (eh / ew)))));
}
def code(eh, ew, t): return math.fabs((((eh * math.cos(t)) * math.sin(math.atan((eh / (ew * t))))) + (ew * ((t * t) / (eh / ew)))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * t))))) + Float64(ew * Float64(Float64(t * t) / Float64(eh / ew))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan((eh / (ew * t))))) + (ew * ((t * t) / (eh / ew))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(ew * N[(N[(t * t), $MachinePrecision] / N[(eh / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) + ew \cdot \frac{t \cdot t}{\frac{eh}{ew}}\right|
\end{array}
Initial program 99.9%
expm1-log1p-u78.9%
expm1-udef70.0%
associate-*l*70.0%
cos-atan73.5%
un-div-inv73.5%
hypot-1-def73.5%
associate-/r*73.5%
Applied egg-rr73.5%
expm1-def82.4%
expm1-log1p99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 47.5%
associate-/l*47.3%
unpow247.3%
Simplified47.3%
Taylor expanded in t around 0 47.3%
Final simplification47.3%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* eh (sin (atan (/ (/ eh ew) (tan t))))) (* ew (* t (* ew (/ t eh)))))))
double code(double eh, double ew, double t) {
return fabs(((eh * sin(atan(((eh / ew) / tan(t))))) + (ew * (t * (ew * (t / 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 * sin(atan(((eh / ew) / tan(t))))) + (ew * (t * (ew * (t / eh))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((eh * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + (ew * (t * (ew * (t / eh))))));
}
def code(eh, ew, t): return math.fabs(((eh * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (ew * (t * (ew * (t / eh))))))
function code(eh, ew, t) return abs(Float64(Float64(eh * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(ew * Float64(t * Float64(ew * Float64(t / eh)))))) end
function tmp = code(eh, ew, t) tmp = abs(((eh * sin(atan(((eh / ew) / tan(t))))) + (ew * (t * (ew * (t / eh)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(eh * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(ew * N[(t * N[(ew * N[(t / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + ew \cdot \left(t \cdot \left(ew \cdot \frac{t}{eh}\right)\right)\right|
\end{array}
Initial program 99.9%
expm1-log1p-u78.9%
expm1-udef70.0%
associate-*l*70.0%
cos-atan73.5%
un-div-inv73.5%
hypot-1-def73.5%
associate-/r*73.5%
Applied egg-rr73.5%
expm1-def82.4%
expm1-log1p99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 47.5%
associate-/l*47.3%
unpow247.3%
Simplified47.3%
Taylor expanded in t around 0 41.7%
Taylor expanded in t around 0 41.9%
unpow241.9%
associate-/l*41.7%
associate-*r/42.7%
associate-/r/42.7%
Simplified42.7%
Final simplification42.7%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* eh (sin (atan (/ (/ eh ew) (tan t))))) (* ew (* t (/ t (/ eh ew)))))))
double code(double eh, double ew, double t) {
return fabs(((eh * sin(atan(((eh / ew) / tan(t))))) + (ew * (t * (t / (eh / ew))))));
}
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 * sin(atan(((eh / ew) / tan(t))))) + (ew * (t * (t / (eh / ew))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((eh * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + (ew * (t * (t / (eh / ew))))));
}
def code(eh, ew, t): return math.fabs(((eh * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (ew * (t * (t / (eh / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(eh * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(ew * Float64(t * Float64(t / Float64(eh / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs(((eh * sin(atan(((eh / ew) / tan(t))))) + (ew * (t * (t / (eh / ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(eh * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(ew * N[(t * N[(t / N[(eh / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + ew \cdot \left(t \cdot \frac{t}{\frac{eh}{ew}}\right)\right|
\end{array}
Initial program 99.9%
expm1-log1p-u78.9%
expm1-udef70.0%
associate-*l*70.0%
cos-atan73.5%
un-div-inv73.5%
hypot-1-def73.5%
associate-/r*73.5%
Applied egg-rr73.5%
expm1-def82.4%
expm1-log1p99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 47.5%
associate-/l*47.3%
unpow247.3%
Simplified47.3%
Taylor expanded in t around 0 41.7%
expm1-log1p-u40.3%
expm1-udef40.4%
associate-*r/40.4%
Applied egg-rr40.4%
expm1-def40.3%
expm1-log1p41.7%
associate-/r/41.9%
*-commutative41.9%
associate-/l*41.7%
associate-*r/42.7%
Simplified42.7%
Final simplification42.7%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (/ (* t t) (/ eh ew))) (* eh (sin (atan (/ eh (* ew t))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * ((t * t) / (eh / ew))) + (eh * 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(((ew * ((t * t) / (eh / ew))) + (eh * sin(atan((eh / (ew * t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * ((t * t) / (eh / ew))) + (eh * Math.sin(Math.atan((eh / (ew * t)))))));
}
def code(eh, ew, t): return math.fabs(((ew * ((t * t) / (eh / ew))) + (eh * math.sin(math.atan((eh / (ew * t)))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * Float64(Float64(t * t) / Float64(eh / ew))) + Float64(eh * sin(atan(Float64(eh / Float64(ew * t))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * ((t * t) / (eh / ew))) + (eh * sin(atan((eh / (ew * t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[(N[(t * t), $MachinePrecision] / N[(eh / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \frac{t \cdot t}{\frac{eh}{ew}} + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|
\end{array}
Initial program 99.9%
expm1-log1p-u78.9%
expm1-udef70.0%
associate-*l*70.0%
cos-atan73.5%
un-div-inv73.5%
hypot-1-def73.5%
associate-/r*73.5%
Applied egg-rr73.5%
expm1-def82.4%
expm1-log1p99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 47.5%
associate-/l*47.3%
unpow247.3%
Simplified47.3%
Taylor expanded in t around 0 41.7%
Taylor expanded in t around 0 41.7%
Final simplification41.7%
herbie shell --seed 2023240
(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))))))))