
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((eh / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((eh / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ eh (* ew (tan t)))))) (fabs (fma ew (* (sin t) (cos t_1)) (* eh (* (cos t) (sin t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh / (ew * tan(t))));
return fabs(fma(ew, (sin(t) * cos(t_1)), (eh * (cos(t) * sin(t_1)))));
}
function code(eh, ew, t) t_1 = atan(Float64(eh / Float64(ew * tan(t)))) return abs(fma(ew, Float64(sin(t) * cos(t_1)), Float64(eh * Float64(cos(t) * sin(t_1))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(ew * N[(N[Sin[t], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\
\left|\mathsf{fma}\left(ew, \sin t \cdot \cos t\_1, eh \cdot \left(\cos t \cdot \sin t\_1\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh ew) (tan t))))
(fabs
(+
(* (* ew (sin t)) (/ 1.0 (hypot 1.0 t_1)))
(* (* eh (cos t)) (sin (atan t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / tan(t);
return fabs((((ew * sin(t)) * (1.0 / hypot(1.0, t_1))) + ((eh * cos(t)) * sin(atan(t_1)))));
}
public static double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / Math.tan(t);
return Math.abs((((ew * Math.sin(t)) * (1.0 / Math.hypot(1.0, t_1))) + ((eh * Math.cos(t)) * Math.sin(Math.atan(t_1)))));
}
def code(eh, ew, t): t_1 = (eh / ew) / math.tan(t) return math.fabs((((ew * math.sin(t)) * (1.0 / math.hypot(1.0, t_1))) + ((eh * math.cos(t)) * math.sin(math.atan(t_1)))))
function code(eh, ew, t) t_1 = Float64(Float64(eh / ew) / tan(t)) return abs(Float64(Float64(Float64(ew * sin(t)) * Float64(1.0 / hypot(1.0, t_1))) + Float64(Float64(eh * cos(t)) * sin(atan(t_1))))) end
function tmp = code(eh, ew, t) t_1 = (eh / ew) / tan(t); tmp = abs((((ew * sin(t)) * (1.0 / hypot(1.0, t_1))) + ((eh * cos(t)) * sin(atan(t_1))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{ew}}{\tan t}\\
\left|\left(ew \cdot \sin t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, t\_1\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t\_1\right|
\end{array}
\end{array}
Initial program 99.8%
associate-/r*99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/r*99.8%
Applied egg-rr99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh ew) (tan t))))
(fabs
(+
(* (* eh (cos t)) (sin (atan t_1)))
(/ (* ew (sin t)) (hypot 1.0 t_1))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / tan(t);
return fabs((((eh * cos(t)) * sin(atan(t_1))) + ((ew * sin(t)) / hypot(1.0, t_1))));
}
public static double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / Math.tan(t);
return Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(t_1))) + ((ew * Math.sin(t)) / Math.hypot(1.0, t_1))));
}
def code(eh, ew, t): t_1 = (eh / ew) / math.tan(t) return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(t_1))) + ((ew * math.sin(t)) / math.hypot(1.0, t_1))))
function code(eh, ew, t) t_1 = Float64(Float64(eh / ew) / tan(t)) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(t_1))) + Float64(Float64(ew * sin(t)) / hypot(1.0, t_1)))) end
function tmp = code(eh, ew, t) t_1 = (eh / ew) / tan(t); tmp = abs((((eh * cos(t)) * sin(atan(t_1))) + ((ew * sin(t)) / hypot(1.0, 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[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{ew}}{\tan t}\\
\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t\_1 + \frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, t\_1\right)}\right|
\end{array}
\end{array}
Initial program 99.8%
associate-/r*99.8%
cos-atan99.8%
un-div-inv99.8%
hypot-1-def99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* (* ew (sin t)) (cos (atan (/ eh (* ew t))))))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t)))))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + ((ew * Math.sin(t)) * Math.cos(Math.atan((eh / (ew * t)))))));
}
def code(eh, ew, t): return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + ((ew * math.sin(t)) * math.cos(math.atan((eh / (ew * t)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(Float64(ew * sin(t)) * cos(atan(Float64(eh / Float64(ew * t))))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 98.9%
Final simplification98.9%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (sin t)) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * sin(t)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs(((ew * sin(t)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.sin(t)) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.sin(t)) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * sin(t)) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * sin(t)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \sin t + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\end{array}
Initial program 99.8%
associate-/r*99.8%
cos-atan99.8%
hypot-1-def99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in ew around inf 98.3%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -1.7e+79) (not (<= ew 4.1e+128))) (fabs (* ew (sin t))) (fabs (* (cos t) (* eh (sin (atan (/ eh (* ew (tan t))))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -1.7e+79) || !(ew <= 4.1e+128)) {
tmp = fabs((ew * sin(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 <= (-1.7d+79)) .or. (.not. (ew <= 4.1d+128))) then
tmp = abs((ew * sin(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 <= -1.7e+79) || !(ew <= 4.1e+128)) {
tmp = Math.abs((ew * Math.sin(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 <= -1.7e+79) or not (ew <= 4.1e+128): tmp = math.fabs((ew * math.sin(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 <= -1.7e+79) || !(ew <= 4.1e+128)) tmp = abs(Float64(ew * sin(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 <= -1.7e+79) || ~((ew <= 4.1e+128))) tmp = abs((ew * sin(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, -1.7e+79], N[Not[LessEqual[ew, 4.1e+128]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $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 -1.7 \cdot 10^{+79} \lor \neg \left(ew \leq 4.1 \cdot 10^{+128}\right):\\
\;\;\;\;\left|ew \cdot \sin t\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 < -1.70000000000000016e79 or 4.10000000000000012e128 < ew Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
add-sqr-sqrt54.6%
fabs-sqr54.6%
add-sqr-sqrt55.3%
add-cbrt-cube19.0%
Applied egg-rr19.0%
Taylor expanded in ew around inf 4.0%
cube-prod16.8%
Simplified16.8%
rem-cbrt-cube46.0%
add-sqr-sqrt45.4%
sqrt-unprod36.0%
pow236.0%
Applied egg-rr36.0%
unpow236.0%
rem-sqrt-square74.1%
Simplified74.1%
if -1.70000000000000016e79 < ew < 4.10000000000000012e128Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in ew around 0 79.2%
associate-*r*79.2%
*-commutative79.2%
associate-*r*79.2%
Simplified79.2%
Final simplification77.6%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -2.9e+79) (not (<= ew 1.06e+96))) (fabs (* ew (sin t))) (fabs (* eh (sin (atan (/ eh (* ew (tan t)))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -2.9e+79) || !(ew <= 1.06e+96)) {
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 ((ew <= (-2.9d+79)) .or. (.not. (ew <= 1.06d+96))) 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 ((ew <= -2.9e+79) || !(ew <= 1.06e+96)) {
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 (ew <= -2.9e+79) or not (ew <= 1.06e+96): 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 ((ew <= -2.9e+79) || !(ew <= 1.06e+96)) 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 ((ew <= -2.9e+79) || ~((ew <= 1.06e+96))) 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[ew, -2.9e+79], N[Not[LessEqual[ew, 1.06e+96]], $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}\;ew \leq -2.9 \cdot 10^{+79} \lor \neg \left(ew \leq 1.06 \cdot 10^{+96}\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 ew < -2.89999999999999992e79 or 1.06e96 < ew Initial program 99.9%
associate-*l*99.9%
fma-define99.9%
associate-/r*99.9%
associate-*l*99.9%
associate-/r*99.9%
Simplified99.9%
add-sqr-sqrt53.6%
fabs-sqr53.6%
add-sqr-sqrt54.3%
add-cbrt-cube17.7%
Applied egg-rr17.7%
Taylor expanded in ew around inf 3.8%
cube-prod15.6%
Simplified15.6%
rem-cbrt-cube42.6%
add-sqr-sqrt41.9%
sqrt-unprod36.8%
pow236.8%
Applied egg-rr36.8%
unpow236.8%
rem-sqrt-square71.8%
Simplified71.8%
if -2.89999999999999992e79 < ew < 1.06e96Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in t around 0 54.9%
Final simplification60.6%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -4.4e-30) (not (<= t 1.4e-11))) (fabs (* ew (sin t))) (fabs (* eh (sin (atan (/ eh (* ew t))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -4.4e-30) || !(t <= 1.4e-11)) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs((eh * 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) :: tmp
if ((t <= (-4.4d-30)) .or. (.not. (t <= 1.4d-11))) then
tmp = abs((ew * sin(t)))
else
tmp = abs((eh * sin(atan((eh / (ew * t))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -4.4e-30) || !(t <= 1.4e-11)) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = Math.abs((eh * Math.sin(Math.atan((eh / (ew * t))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -4.4e-30) or not (t <= 1.4e-11): tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs((eh * math.sin(math.atan((eh / (ew * t)))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -4.4e-30) || !(t <= 1.4e-11)) tmp = abs(Float64(ew * sin(t))); else tmp = abs(Float64(eh * sin(atan(Float64(eh / Float64(ew * t)))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -4.4e-30) || ~((t <= 1.4e-11))) tmp = abs((ew * sin(t))); else tmp = abs((eh * sin(atan((eh / (ew * t)))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -4.4e-30], N[Not[LessEqual[t, 1.4e-11]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.4 \cdot 10^{-30} \lor \neg \left(t \leq 1.4 \cdot 10^{-11}\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\
\end{array}
\end{array}
if t < -4.39999999999999967e-30 or 1.4e-11 < t Initial program 99.7%
associate-*l*99.7%
fma-define99.7%
associate-/r*99.7%
associate-*l*99.7%
associate-/r*99.7%
Simplified99.7%
add-sqr-sqrt49.1%
fabs-sqr49.1%
add-sqr-sqrt50.0%
add-cbrt-cube15.3%
Applied egg-rr15.3%
Taylor expanded in ew around inf 8.0%
cube-prod8.0%
Simplified8.0%
rem-cbrt-cube25.4%
add-sqr-sqrt24.5%
sqrt-unprod23.6%
pow223.6%
Applied egg-rr23.6%
unpow223.6%
rem-sqrt-square47.3%
Simplified47.3%
if -4.39999999999999967e-30 < t < 1.4e-11Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
associate-/r*100.0%
associate-*l*100.0%
associate-/r*100.0%
Simplified100.0%
Taylor expanded in t around 0 72.4%
Taylor expanded in t around 0 72.4%
Final simplification59.7%
(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-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
add-sqr-sqrt46.5%
fabs-sqr46.5%
add-sqr-sqrt47.6%
add-cbrt-cube19.4%
Applied egg-rr19.4%
Taylor expanded in ew around inf 7.4%
cube-prod11.4%
Simplified11.4%
rem-cbrt-cube22.4%
add-sqr-sqrt21.5%
sqrt-unprod24.6%
pow224.6%
Applied egg-rr24.6%
unpow224.6%
rem-sqrt-square39.5%
Simplified39.5%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -8.0) (not (<= t 0.0042))) (* ew (sin t)) (fabs (* ew t))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -8.0) || !(t <= 0.0042)) {
tmp = ew * sin(t);
} else {
tmp = fabs((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) :: tmp
if ((t <= (-8.0d0)) .or. (.not. (t <= 0.0042d0))) then
tmp = ew * sin(t)
else
tmp = abs((ew * t))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -8.0) || !(t <= 0.0042)) {
tmp = ew * Math.sin(t);
} else {
tmp = Math.abs((ew * t));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -8.0) or not (t <= 0.0042): tmp = ew * math.sin(t) else: tmp = math.fabs((ew * t)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -8.0) || !(t <= 0.0042)) tmp = Float64(ew * sin(t)); else tmp = abs(Float64(ew * t)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -8.0) || ~((t <= 0.0042))) tmp = ew * sin(t); else tmp = abs((ew * t)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -8.0], N[Not[LessEqual[t, 0.0042]], $MachinePrecision]], N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \lor \neg \left(t \leq 0.0042\right):\\
\;\;\;\;ew \cdot \sin t\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot t\right|\\
\end{array}
\end{array}
if t < -8 or 0.00419999999999999974 < t Initial program 99.6%
associate-*l*99.6%
fma-define99.7%
associate-/r*99.7%
associate-*l*99.7%
associate-/r*99.7%
Simplified99.7%
add-sqr-sqrt49.5%
fabs-sqr49.5%
add-sqr-sqrt50.4%
add-cbrt-cube16.1%
Applied egg-rr16.1%
Taylor expanded in ew around inf 8.4%
cube-prod8.4%
Simplified8.4%
rem-cbrt-cube24.7%
*-commutative24.7%
Applied egg-rr24.7%
if -8 < t < 0.00419999999999999974Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
associate-/r*100.0%
associate-*l*100.0%
associate-/r*100.0%
Simplified100.0%
add-sqr-sqrt43.8%
fabs-sqr43.8%
add-sqr-sqrt45.1%
add-cbrt-cube22.2%
Applied egg-rr22.2%
Taylor expanded in ew around inf 6.5%
cube-prod14.1%
Simplified14.1%
Taylor expanded in t around 0 20.4%
add-sqr-sqrt19.4%
sqrt-unprod24.8%
pow224.8%
*-commutative24.8%
Applied egg-rr24.8%
unpow224.8%
rem-sqrt-square33.0%
Simplified33.0%
Final simplification29.1%
(FPCore (eh ew t) :precision binary64 (fabs (* ew t)))
double code(double eh, double ew, double t) {
return fabs((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))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * t));
}
def code(eh, ew, t): return math.fabs((ew * t))
function code(eh, ew, t) return abs(Float64(ew * t)) end
function tmp = code(eh, ew, t) tmp = abs((ew * t)); end
code[eh_, ew_, t_] := N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot t\right|
\end{array}
Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
add-sqr-sqrt46.5%
fabs-sqr46.5%
add-sqr-sqrt47.6%
add-cbrt-cube19.4%
Applied egg-rr19.4%
Taylor expanded in ew around inf 7.4%
cube-prod11.4%
Simplified11.4%
Taylor expanded in t around 0 12.7%
add-sqr-sqrt11.9%
sqrt-unprod16.1%
pow216.1%
*-commutative16.1%
Applied egg-rr16.1%
unpow216.1%
rem-sqrt-square20.6%
Simplified20.6%
Final simplification20.6%
(FPCore (eh ew t) :precision binary64 (* ew t))
double code(double eh, double ew, double t) {
return 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 = ew * t
end function
public static double code(double eh, double ew, double t) {
return ew * t;
}
def code(eh, ew, t): return ew * t
function code(eh, ew, t) return Float64(ew * t) end
function tmp = code(eh, ew, t) tmp = ew * t; end
code[eh_, ew_, t_] := N[(ew * t), $MachinePrecision]
\begin{array}{l}
\\
ew \cdot t
\end{array}
Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
add-sqr-sqrt46.5%
fabs-sqr46.5%
add-sqr-sqrt47.6%
add-cbrt-cube19.4%
Applied egg-rr19.4%
Taylor expanded in ew around inf 7.4%
cube-prod11.4%
Simplified11.4%
Taylor expanded in t around 0 12.7%
herbie shell --seed 2024185
(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))))))))