
(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 (/ (/ eh ew) (tan t))))
(fabs
(+
(* (/ 1.0 (hypot 1.0 t_1)) (* ew (sin t)))
(* (* eh (cos t)) (sin (atan t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / tan(t);
return fabs((((1.0 / hypot(1.0, t_1)) * (ew * sin(t))) + ((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((((1.0 / Math.hypot(1.0, t_1)) * (ew * Math.sin(t))) + ((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((((1.0 / math.hypot(1.0, t_1)) * (ew * math.sin(t))) + ((eh * math.cos(t)) * math.sin(math.atan(t_1)))))
function code(eh, ew, t) t_1 = Float64(Float64(eh / ew) / tan(t)) return abs(Float64(Float64(Float64(1.0 / hypot(1.0, t_1)) * Float64(ew * sin(t))) + Float64(Float64(eh * cos(t)) * sin(atan(t_1))))) end
function tmp = code(eh, ew, t) t_1 = (eh / ew) / tan(t); tmp = abs((((1.0 / hypot(1.0, t_1)) * (ew * sin(t))) + ((eh * cos(t)) * sin(atan(t_1))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision] * N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{ew}}{\tan t}\\
\left|\frac{1}{\mathsf{hypot}\left(1, t_1\right)} \cdot \left(ew \cdot \sin t\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t_1\right|
\end{array}
\end{array}
Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* (cos (atan (/ (/ eh t) ew))) (* 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 / t) / ew))) * (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 / t) / ew))) * (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 / t) / ew))) * (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 / t) / ew))) * (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(Float64(eh / t) / ew))) * 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 / t) / ew))) * (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[(N[(eh / t), $MachinePrecision] / ew), $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{\frac{eh}{t}}{ew}\right) \cdot \left(ew \cdot \sin t\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 98.6%
associate-/r*89.5%
Simplified98.6%
Final simplification98.6%
(FPCore (eh ew t) :precision binary64 (fabs (fma ew (sin t) (* (cos t) (* eh (sin (atan (/ (/ eh (tan t)) ew))))))))
double code(double eh, double ew, double t) {
return fabs(fma(ew, sin(t), (cos(t) * (eh * sin(atan(((eh / tan(t)) / ew)))))));
}
function code(eh, ew, t) return abs(fma(ew, sin(t), Float64(cos(t) * Float64(eh * sin(atan(Float64(Float64(eh / tan(t)) / ew))))))) end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[Sin[t], $MachinePrecision] + N[(N[Cos[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(ew, \sin t, \cos t \cdot \left(eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)\right)\right)\right|
\end{array}
Initial program 99.8%
associate-*l*99.8%
fma-def99.8%
associate-/l/99.8%
associate-/r*99.8%
*-commutative99.8%
associate-*l*99.8%
associate-/l/99.8%
associate-/r*99.8%
Simplified99.8%
add-exp-log47.2%
cos-atan67.1%
un-div-inv67.1%
hypot-1-def64.0%
associate-/l/64.7%
associate-/r*63.2%
Applied egg-rr63.2%
Taylor expanded in eh around 0 98.3%
Final simplification98.3%
(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.8%
cos-atan99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
Taylor expanded in eh around 0 98.3%
Final simplification98.3%
(FPCore (eh ew t)
:precision binary64
(fabs
(+
(* ew (sin t))
(*
(* eh (cos t))
(sin
(atan (+ (* -0.3333333333333333 (/ (* t eh) ew)) (/ eh (* ew t)))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * sin(t)) + ((eh * cos(t)) * sin(atan(((-0.3333333333333333 * ((t * eh) / ew)) + (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 * sin(t)) + ((eh * cos(t)) * sin(atan((((-0.3333333333333333d0) * ((t * eh) / ew)) + (eh / (ew * t))))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.sin(t)) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((-0.3333333333333333 * ((t * eh) / ew)) + (eh / (ew * t))))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.sin(t)) + ((eh * math.cos(t)) * math.sin(math.atan(((-0.3333333333333333 * ((t * eh) / ew)) + (eh / (ew * t))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * sin(t)) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(-0.3333333333333333 * Float64(Float64(t * eh) / ew)) + Float64(eh / Float64(ew * t)))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * sin(t)) + ((eh * cos(t)) * sin(atan(((-0.3333333333333333 * ((t * eh) / ew)) + (eh / (ew * t)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(-0.3333333333333333 * N[(N[(t * eh), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] + N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \sin t + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(-0.3333333333333333 \cdot \frac{t \cdot eh}{ew} + \frac{eh}{ew \cdot t}\right)\right|
\end{array}
Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
Taylor expanded in eh around 0 98.3%
Taylor expanded in t around 0 95.2%
Final simplification95.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t))))
(if (or (<= ew -1.05e-157) (not (<= ew 4.5e-144)))
(fabs (+ (* ew (sin t)) (* t_1 (sin (atan (/ (/ eh t) ew))))))
(fabs (* t_1 (sin (atan (/ eh (* ew (tan t))))))))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double tmp;
if ((ew <= -1.05e-157) || !(ew <= 4.5e-144)) {
tmp = fabs(((ew * sin(t)) + (t_1 * sin(atan(((eh / t) / ew))))));
} else {
tmp = fabs((t_1 * 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 = eh * cos(t)
if ((ew <= (-1.05d-157)) .or. (.not. (ew <= 4.5d-144))) then
tmp = abs(((ew * sin(t)) + (t_1 * sin(atan(((eh / t) / ew))))))
else
tmp = abs((t_1 * 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 = eh * Math.cos(t);
double tmp;
if ((ew <= -1.05e-157) || !(ew <= 4.5e-144)) {
tmp = Math.abs(((ew * Math.sin(t)) + (t_1 * Math.sin(Math.atan(((eh / t) / ew))))));
} else {
tmp = Math.abs((t_1 * Math.sin(Math.atan((eh / (ew * Math.tan(t)))))));
}
return tmp;
}
def code(eh, ew, t): t_1 = eh * math.cos(t) tmp = 0 if (ew <= -1.05e-157) or not (ew <= 4.5e-144): tmp = math.fabs(((ew * math.sin(t)) + (t_1 * math.sin(math.atan(((eh / t) / ew)))))) else: tmp = math.fabs((t_1 * math.sin(math.atan((eh / (ew * math.tan(t))))))) return tmp
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) tmp = 0.0 if ((ew <= -1.05e-157) || !(ew <= 4.5e-144)) tmp = abs(Float64(Float64(ew * sin(t)) + Float64(t_1 * sin(atan(Float64(Float64(eh / t) / ew)))))); else tmp = abs(Float64(t_1 * sin(atan(Float64(eh / Float64(ew * tan(t))))))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh * cos(t); tmp = 0.0; if ((ew <= -1.05e-157) || ~((ew <= 4.5e-144))) tmp = abs(((ew * sin(t)) + (t_1 * sin(atan(((eh / t) / ew)))))); else tmp = abs((t_1 * sin(atan((eh / (ew * tan(t))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[ew, -1.05e-157], N[Not[LessEqual[ew, 4.5e-144]], $MachinePrecision]], N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[Sin[N[ArcTan[N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(t$95$1 * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
\mathbf{if}\;ew \leq -1.05 \cdot 10^{-157} \lor \neg \left(ew \leq 4.5 \cdot 10^{-144}\right):\\
\;\;\;\;\left|ew \cdot \sin t + t_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{t}}{ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t_1 \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\end{array}
\end{array}
if ew < -1.05e-157 or 4.4999999999999998e-144 < ew Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
Taylor expanded in eh around 0 98.5%
Taylor expanded in t around 0 92.8%
associate-/r*92.9%
Simplified92.9%
if -1.05e-157 < ew < 4.4999999999999998e-144Initial program 99.9%
associate-*l*99.9%
fma-def99.9%
associate-/l/99.9%
associate-/r*99.9%
*-commutative99.9%
associate-*l*99.8%
associate-/l/99.8%
associate-/r*99.8%
Simplified99.8%
add-exp-log50.5%
cos-atan77.2%
un-div-inv77.2%
hypot-1-def75.9%
associate-/l/81.2%
associate-/r*75.9%
Applied egg-rr75.9%
Taylor expanded in eh around 0 97.7%
Taylor expanded in ew around 0 92.2%
associate-*r*92.2%
*-commutative92.2%
associate-*r*92.2%
Simplified92.2%
Final simplification92.7%
(FPCore (eh ew t)
:precision binary64
(if (or (<= ew -2.65e-18) (not (<= ew 7.4e-13)))
(fabs
(+
(* ew (sin t))
(*
eh
(sin
(atan (+ (* -0.3333333333333333 (/ (* t eh) ew)) (/ eh (* ew t))))))))
(fabs (* (cos t) (* eh (sin (atan (/ eh (* ew (tan t))))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -2.65e-18) || !(ew <= 7.4e-13)) {
tmp = fabs(((ew * sin(t)) + (eh * sin(atan(((-0.3333333333333333 * ((t * eh) / ew)) + (eh / (ew * t))))))));
} else {
tmp = fabs((cos(t) * (eh * 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.65d-18)) .or. (.not. (ew <= 7.4d-13))) then
tmp = abs(((ew * sin(t)) + (eh * sin(atan((((-0.3333333333333333d0) * ((t * eh) / ew)) + (eh / (ew * t))))))))
else
tmp = abs((cos(t) * (eh * 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.65e-18) || !(ew <= 7.4e-13)) {
tmp = Math.abs(((ew * Math.sin(t)) + (eh * Math.sin(Math.atan(((-0.3333333333333333 * ((t * eh) / ew)) + (eh / (ew * t))))))));
} else {
tmp = Math.abs((Math.cos(t) * (eh * Math.sin(Math.atan((eh / (ew * Math.tan(t))))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -2.65e-18) or not (ew <= 7.4e-13): tmp = math.fabs(((ew * math.sin(t)) + (eh * math.sin(math.atan(((-0.3333333333333333 * ((t * eh) / ew)) + (eh / (ew * t)))))))) else: tmp = math.fabs((math.cos(t) * (eh * math.sin(math.atan((eh / (ew * math.tan(t)))))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -2.65e-18) || !(ew <= 7.4e-13)) tmp = abs(Float64(Float64(ew * sin(t)) + Float64(eh * sin(atan(Float64(Float64(-0.3333333333333333 * Float64(Float64(t * eh) / ew)) + Float64(eh / Float64(ew * t)))))))); else tmp = abs(Float64(cos(t) * Float64(eh * sin(atan(Float64(eh / Float64(ew * tan(t)))))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -2.65e-18) || ~((ew <= 7.4e-13))) tmp = abs(((ew * sin(t)) + (eh * sin(atan(((-0.3333333333333333 * ((t * eh) / ew)) + (eh / (ew * t)))))))); else tmp = abs((cos(t) * (eh * sin(atan((eh / (ew * tan(t)))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -2.65e-18], N[Not[LessEqual[ew, 7.4e-13]], $MachinePrecision]], N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(N[(-0.3333333333333333 * N[(N[(t * eh), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] + N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Cos[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -2.65 \cdot 10^{-18} \lor \neg \left(ew \leq 7.4 \cdot 10^{-13}\right):\\
\;\;\;\;\left|ew \cdot \sin t + eh \cdot \sin \tan^{-1} \left(-0.3333333333333333 \cdot \frac{t \cdot eh}{ew} + \frac{eh}{ew \cdot t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\cos t \cdot \left(eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right|\\
\end{array}
\end{array}
if ew < -2.65000000000000015e-18 or 7.39999999999999977e-13 < ew Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
Taylor expanded in eh around 0 98.9%
Taylor expanded in t around 0 92.3%
Taylor expanded in t around 0 92.3%
if -2.65000000000000015e-18 < ew < 7.39999999999999977e-13Initial program 99.8%
associate-*l*99.8%
fma-def99.8%
associate-/l/99.8%
associate-/r*99.8%
*-commutative99.8%
associate-*l*99.8%
associate-/l/99.8%
associate-/r*99.8%
Simplified99.8%
add-exp-log49.8%
cos-atan77.1%
un-div-inv77.1%
hypot-1-def72.5%
associate-/l/75.5%
associate-/r*72.5%
Applied egg-rr72.5%
Taylor expanded in eh around 0 97.7%
Taylor expanded in ew around 0 86.9%
Final simplification89.5%
(FPCore (eh ew t)
:precision binary64
(if (or (<= ew -5e-18) (not (<= ew 4.4e-18)))
(fabs
(+
(* ew (sin t))
(*
eh
(sin
(atan (+ (* -0.3333333333333333 (/ (* t eh) ew)) (/ 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 <= -5e-18) || !(ew <= 4.4e-18)) {
tmp = fabs(((ew * sin(t)) + (eh * sin(atan(((-0.3333333333333333 * ((t * eh) / ew)) + (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 <= (-5d-18)) .or. (.not. (ew <= 4.4d-18))) then
tmp = abs(((ew * sin(t)) + (eh * sin(atan((((-0.3333333333333333d0) * ((t * eh) / ew)) + (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 <= -5e-18) || !(ew <= 4.4e-18)) {
tmp = Math.abs(((ew * Math.sin(t)) + (eh * Math.sin(Math.atan(((-0.3333333333333333 * ((t * eh) / ew)) + (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 <= -5e-18) or not (ew <= 4.4e-18): tmp = math.fabs(((ew * math.sin(t)) + (eh * math.sin(math.atan(((-0.3333333333333333 * ((t * eh) / ew)) + (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 <= -5e-18) || !(ew <= 4.4e-18)) tmp = abs(Float64(Float64(ew * sin(t)) + Float64(eh * sin(atan(Float64(Float64(-0.3333333333333333 * Float64(Float64(t * eh) / ew)) + Float64(eh / Float64(ew * t)))))))); else tmp = abs(Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * tan(t))))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -5e-18) || ~((ew <= 4.4e-18))) tmp = abs(((ew * sin(t)) + (eh * sin(atan(((-0.3333333333333333 * ((t * eh) / ew)) + (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, -5e-18], N[Not[LessEqual[ew, 4.4e-18]], $MachinePrecision]], N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(N[(-0.3333333333333333 * N[(N[(t * eh), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] + N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -5 \cdot 10^{-18} \lor \neg \left(ew \leq 4.4 \cdot 10^{-18}\right):\\
\;\;\;\;\left|ew \cdot \sin t + eh \cdot \sin \tan^{-1} \left(-0.3333333333333333 \cdot \frac{t \cdot eh}{ew} + \frac{eh}{ew \cdot t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\end{array}
\end{array}
if ew < -5.00000000000000036e-18 or 4.3999999999999997e-18 < ew Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
Taylor expanded in eh around 0 98.9%
Taylor expanded in t around 0 92.3%
Taylor expanded in t around 0 92.3%
if -5.00000000000000036e-18 < ew < 4.3999999999999997e-18Initial program 99.8%
associate-*l*99.8%
fma-def99.8%
associate-/l/99.8%
associate-/r*99.8%
*-commutative99.8%
associate-*l*99.8%
associate-/l/99.8%
associate-/r*99.8%
Simplified99.8%
add-exp-log49.8%
cos-atan77.1%
un-div-inv77.1%
hypot-1-def72.5%
associate-/l/75.5%
associate-/r*72.5%
Applied egg-rr72.5%
Taylor expanded in eh around 0 97.7%
Taylor expanded in ew around 0 86.9%
associate-*r*86.9%
*-commutative86.9%
associate-*r*86.9%
Simplified86.9%
Final simplification89.5%
(FPCore (eh ew t)
:precision binary64
(if (or (<= t -0.0049) (not (<= t 0.04)))
(fabs (* ew (sin t)))
(fabs
(+
(* ew t)
(* (* eh (sin (atan (/ (/ eh ew) (tan t))))) (+ 1.0 (* t (* t -0.5))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -0.0049) || !(t <= 0.04)) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs(((ew * t) + ((eh * sin(atan(((eh / ew) / tan(t))))) * (1.0 + (t * (t * -0.5))))));
}
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 ((t <= (-0.0049d0)) .or. (.not. (t <= 0.04d0))) then
tmp = abs((ew * sin(t)))
else
tmp = abs(((ew * t) + ((eh * sin(atan(((eh / ew) / tan(t))))) * (1.0d0 + (t * (t * (-0.5d0)))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -0.0049) || !(t <= 0.04)) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = Math.abs(((ew * t) + ((eh * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) * (1.0 + (t * (t * -0.5))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -0.0049) or not (t <= 0.04): tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs(((ew * t) + ((eh * math.sin(math.atan(((eh / ew) / math.tan(t))))) * (1.0 + (t * (t * -0.5)))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -0.0049) || !(t <= 0.04)) tmp = abs(Float64(ew * sin(t))); else tmp = abs(Float64(Float64(ew * t) + Float64(Float64(eh * sin(atan(Float64(Float64(eh / ew) / tan(t))))) * Float64(1.0 + Float64(t * Float64(t * -0.5)))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -0.0049) || ~((t <= 0.04))) tmp = abs((ew * sin(t))); else tmp = abs(((ew * t) + ((eh * sin(atan(((eh / ew) / tan(t))))) * (1.0 + (t * (t * -0.5)))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -0.0049], N[Not[LessEqual[t, 0.04]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * t), $MachinePrecision] + N[(N[(eh * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(t * N[(t * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.0049 \lor \neg \left(t \leq 0.04\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot t + \left(eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right) \cdot \left(1 + t \cdot \left(t \cdot -0.5\right)\right)\right|\\
\end{array}
\end{array}
if t < -0.0048999999999999998 or 0.0400000000000000008 < t Initial program 99.7%
associate-*l*99.7%
fma-def99.7%
associate-/l/99.7%
associate-/r*99.7%
*-commutative99.7%
associate-*l*99.7%
associate-/l/99.7%
associate-/r*99.7%
Simplified99.7%
add-exp-log45.3%
cos-atan58.8%
un-div-inv58.8%
hypot-1-def52.8%
associate-/l/52.8%
associate-/r*52.8%
Applied egg-rr52.8%
Taylor expanded in eh around 0 97.3%
Taylor expanded in ew around inf 53.2%
if -0.0048999999999999998 < t < 0.0400000000000000008Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
associate-/l/100.0%
associate-/r*100.0%
*-commutative100.0%
associate-*l*100.0%
associate-/l/100.0%
associate-/r*100.0%
Simplified100.0%
add-exp-log49.2%
cos-atan76.2%
un-div-inv76.2%
hypot-1-def76.2%
associate-/l/77.9%
associate-/r*74.6%
Applied egg-rr74.6%
Taylor expanded in eh around 0 99.3%
Taylor expanded in t around 0 99.3%
associate-+r+99.3%
+-commutative99.3%
*-lft-identity99.3%
associate-*r*99.3%
distribute-rgt-out99.3%
*-commutative99.3%
associate-/l/99.3%
unpow299.3%
associate-*r*99.3%
Simplified99.3%
Final simplification75.2%
(FPCore (eh ew t)
:precision binary64
(fabs
(+
(* ew (sin t))
(*
eh
(sin
(atan (+ (* -0.3333333333333333 (/ (* t eh) ew)) (/ eh (* ew t)))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * sin(t)) + (eh * sin(atan(((-0.3333333333333333 * ((t * eh) / ew)) + (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 * sin(t)) + (eh * sin(atan((((-0.3333333333333333d0) * ((t * eh) / ew)) + (eh / (ew * t))))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.sin(t)) + (eh * Math.sin(Math.atan(((-0.3333333333333333 * ((t * eh) / ew)) + (eh / (ew * t))))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.sin(t)) + (eh * math.sin(math.atan(((-0.3333333333333333 * ((t * eh) / ew)) + (eh / (ew * t))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * sin(t)) + Float64(eh * sin(atan(Float64(Float64(-0.3333333333333333 * Float64(Float64(t * eh) / ew)) + Float64(eh / Float64(ew * t)))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * sin(t)) + (eh * sin(atan(((-0.3333333333333333 * ((t * eh) / ew)) + (eh / (ew * t)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(N[(-0.3333333333333333 * N[(N[(t * eh), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] + N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \sin t + eh \cdot \sin \tan^{-1} \left(-0.3333333333333333 \cdot \frac{t \cdot eh}{ew} + \frac{eh}{ew \cdot t}\right)\right|
\end{array}
Initial program 99.8%
cos-atan99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
Taylor expanded in eh around 0 98.3%
Taylor expanded in t around 0 79.3%
Taylor expanded in t around 0 77.1%
Final simplification77.1%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -0.0125) (not (<= t 0.0015))) (fabs (* ew (sin t))) (fabs (+ (* ew t) (* eh (sin (atan (/ eh (* ew (tan t))))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -0.0125) || !(t <= 0.0015)) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs(((ew * t) + (eh * 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 ((t <= (-0.0125d0)) .or. (.not. (t <= 0.0015d0))) then
tmp = abs((ew * sin(t)))
else
tmp = abs(((ew * t) + (eh * 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 ((t <= -0.0125) || !(t <= 0.0015)) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = Math.abs(((ew * t) + (eh * Math.sin(Math.atan((eh / (ew * Math.tan(t))))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -0.0125) or not (t <= 0.0015): tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs(((ew * t) + (eh * math.sin(math.atan((eh / (ew * math.tan(t)))))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -0.0125) || !(t <= 0.0015)) tmp = abs(Float64(ew * sin(t))); else tmp = abs(Float64(Float64(ew * t) + Float64(eh * sin(atan(Float64(eh / Float64(ew * tan(t)))))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -0.0125) || ~((t <= 0.0015))) tmp = abs((ew * sin(t))); else tmp = abs(((ew * t) + (eh * sin(atan((eh / (ew * tan(t)))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -0.0125], N[Not[LessEqual[t, 0.0015]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * t), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.0125 \lor \neg \left(t \leq 0.0015\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot t + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\end{array}
\end{array}
if t < -0.012500000000000001 or 0.0015 < t Initial program 99.7%
associate-*l*99.7%
fma-def99.7%
associate-/l/99.7%
associate-/r*99.7%
*-commutative99.7%
associate-*l*99.7%
associate-/l/99.7%
associate-/r*99.7%
Simplified99.7%
add-exp-log45.3%
cos-atan58.8%
un-div-inv58.8%
hypot-1-def52.8%
associate-/l/52.8%
associate-/r*52.8%
Applied egg-rr52.8%
Taylor expanded in eh around 0 97.3%
Taylor expanded in ew around inf 53.2%
if -0.012500000000000001 < t < 0.0015Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
associate-/l/100.0%
associate-/r*100.0%
*-commutative100.0%
associate-*l*100.0%
associate-/l/100.0%
associate-/r*100.0%
Simplified100.0%
add-exp-log49.2%
cos-atan76.2%
un-div-inv76.2%
hypot-1-def76.2%
associate-/l/77.9%
associate-/r*74.6%
Applied egg-rr74.6%
Taylor expanded in eh around 0 99.3%
Taylor expanded in t around 0 99.1%
Final simplification75.1%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -6e-25) (not (<= t 4.2e-62))) (fabs (* ew (sin t))) (fabs (* eh (sin (atan (/ eh (* ew (tan t)))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -6e-25) || !(t <= 4.2e-62)) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs((eh * 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 ((t <= (-6d-25)) .or. (.not. (t <= 4.2d-62))) then
tmp = abs((ew * sin(t)))
else
tmp = abs((eh * 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 ((t <= -6e-25) || !(t <= 4.2e-62)) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = Math.abs((eh * Math.sin(Math.atan((eh / (ew * Math.tan(t)))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -6e-25) or not (t <= 4.2e-62): tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs((eh * math.sin(math.atan((eh / (ew * math.tan(t))))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -6e-25) || !(t <= 4.2e-62)) tmp = abs(Float64(ew * sin(t))); else tmp = abs(Float64(eh * sin(atan(Float64(eh / Float64(ew * tan(t))))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -6e-25) || ~((t <= 4.2e-62))) tmp = abs((ew * sin(t))); else tmp = abs((eh * sin(atan((eh / (ew * tan(t))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -6e-25], N[Not[LessEqual[t, 4.2e-62]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6 \cdot 10^{-25} \lor \neg \left(t \leq 4.2 \cdot 10^{-62}\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\end{array}
\end{array}
if t < -5.9999999999999995e-25 or 4.1999999999999998e-62 < t Initial program 99.7%
associate-*l*99.7%
fma-def99.7%
associate-/l/99.7%
associate-/r*99.7%
*-commutative99.7%
associate-*l*99.7%
associate-/l/99.7%
associate-/r*99.7%
Simplified99.7%
add-exp-log48.8%
cos-atan60.8%
un-div-inv60.8%
hypot-1-def55.5%
associate-/l/55.5%
associate-/r*55.5%
Applied egg-rr55.5%
Taylor expanded in eh around 0 97.6%
Taylor expanded in ew around inf 55.0%
if -5.9999999999999995e-25 < t < 4.1999999999999998e-62Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
associate-/l/100.0%
associate-/r*100.0%
*-commutative100.0%
associate-*l*100.0%
associate-/l/100.0%
associate-/r*100.0%
Simplified100.0%
add-exp-log44.8%
cos-atan75.9%
un-div-inv75.9%
hypot-1-def75.9%
associate-/l/77.8%
associate-/r*74.0%
Applied egg-rr74.0%
Taylor expanded in eh around 0 99.2%
Taylor expanded in t around 0 82.2%
Final simplification66.3%
(FPCore (eh ew t) :precision binary64 (fabs (* ew (sin t))))
double code(double eh, double ew, double t) {
return fabs((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((ew * sin(t)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * Math.sin(t)));
}
def code(eh, ew, t): return math.fabs((ew * math.sin(t)))
function code(eh, ew, t) return abs(Float64(ew * sin(t))) end
function tmp = code(eh, ew, t) tmp = abs((ew * sin(t))); end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \sin t\right|
\end{array}
Initial program 99.8%
associate-*l*99.8%
fma-def99.8%
associate-/l/99.8%
associate-/r*99.8%
*-commutative99.8%
associate-*l*99.8%
associate-/l/99.8%
associate-/r*99.8%
Simplified99.8%
add-exp-log47.2%
cos-atan67.1%
un-div-inv67.1%
hypot-1-def64.0%
associate-/l/64.7%
associate-/r*63.2%
Applied egg-rr63.2%
Taylor expanded in eh around 0 98.3%
Taylor expanded in ew around inf 41.2%
Final simplification41.2%
herbie shell --seed 2023199
(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))))))))