
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((eh / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (/ (sin t) (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.8%
associate-/r*99.8%
cos-atan99.8%
un-div-inv99.8%
hypot-1-def99.8%
associate-/r*99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-/l*99.8%
associate-/r*99.8%
Simplified99.8%
clear-num99.7%
un-div-inv99.7%
associate-/r*99.7%
Applied egg-rr99.7%
associate-/r/99.8%
associate-/r*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* (sin t) (/ ew (hypot 1.0 (/ eh (* ew (tan t)))))))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (sin(t) * (ew / hypot(1.0, (eh / (ew * tan(t))))))));
}
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.sin(t) * (ew / Math.hypot(1.0, (eh / (ew * Math.tan(t))))))));
}
def code(eh, ew, t): return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (math.sin(t) * (ew / math.hypot(1.0, (eh / (ew * math.tan(t))))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(sin(t) * Float64(ew / hypot(1.0, Float64(eh / Float64(ew * tan(t)))))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (sin(t) * (ew / hypot(1.0, (eh / (ew * tan(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[Sin[t], $MachinePrecision] * N[(ew / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \sin t \cdot \frac{ew}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right|
\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%
*-commutative99.8%
associate-/l*99.8%
associate-/r*99.8%
Simplified99.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)))) (* (sin t) ew)))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (cos(atan((eh / (t * ew)))) * (sin(t) * 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) / tan(t))))) + (cos(atan((eh / (t * ew)))) * (sin(t) * 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) / Math.tan(t))))) + (Math.cos(Math.atan((eh / (t * ew)))) * (Math.sin(t) * ew))));
}
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)))) * (math.sin(t) * ew))))
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(t * ew)))) * Float64(sin(t) * ew)))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (cos(atan((eh / (t * ew)))) * (sin(t) * ew)))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * ew), $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}{t \cdot ew}\right) \cdot \left(\sin t \cdot ew\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 99.3%
Final simplification99.3%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* (sin t) ew))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (sin(t) * 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) / tan(t))))) + (sin(t) * 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) / Math.tan(t))))) + (Math.sin(t) * ew)));
}
def code(eh, ew, t): return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (math.sin(t) * ew)))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(sin(t) * ew))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (sin(t) * ew))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[t], $MachinePrecision] * ew), $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) + \sin t \cdot ew\right|
\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%
*-commutative99.8%
associate-/l*99.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in ew around inf 99.2%
Final simplification99.2%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -5.5e+64) (not (<= ew 6e-18))) (fabs (* (sin t) ew)) (fabs (* (cos t) (* eh (sin (atan (/ eh (* ew (tan t))))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -5.5e+64) || !(ew <= 6e-18)) {
tmp = fabs((sin(t) * ew));
} 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 <= (-5.5d+64)) .or. (.not. (ew <= 6d-18))) then
tmp = abs((sin(t) * ew))
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 <= -5.5e+64) || !(ew <= 6e-18)) {
tmp = Math.abs((Math.sin(t) * ew));
} 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 <= -5.5e+64) or not (ew <= 6e-18): tmp = math.fabs((math.sin(t) * ew)) 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 <= -5.5e+64) || !(ew <= 6e-18)) tmp = abs(Float64(sin(t) * ew)); 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 <= -5.5e+64) || ~((ew <= 6e-18))) tmp = abs((sin(t) * ew)); 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, -5.5e+64], N[Not[LessEqual[ew, 6e-18]], $MachinePrecision]], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $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 -5.5 \cdot 10^{+64} \lor \neg \left(ew \leq 6 \cdot 10^{-18}\right):\\
\;\;\;\;\left|\sin t \cdot ew\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 < -5.4999999999999996e64 or 5.99999999999999966e-18 < 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-sqrt99.1%
pow299.1%
Applied egg-rr49.0%
Taylor expanded in ew around inf 36.9%
unpow236.9%
sqrt-unprod44.7%
pow244.7%
*-commutative44.7%
Applied egg-rr44.7%
unpow244.7%
rem-sqrt-square77.9%
*-commutative77.9%
Simplified77.9%
if -5.4999999999999996e64 < ew < 5.99999999999999966e-18Initial 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 88.5%
associate-*r*88.5%
*-commutative88.5%
associate-*r*88.5%
Simplified88.5%
Final simplification84.1%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -5.4e+26) (not (<= ew 2.35e-79))) (fabs (* (sin t) ew)) (fabs eh)))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -5.4e+26) || !(ew <= 2.35e-79)) {
tmp = fabs((sin(t) * ew));
} else {
tmp = fabs(eh);
}
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 <= (-5.4d+26)) .or. (.not. (ew <= 2.35d-79))) then
tmp = abs((sin(t) * ew))
else
tmp = abs(eh)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -5.4e+26) || !(ew <= 2.35e-79)) {
tmp = Math.abs((Math.sin(t) * ew));
} else {
tmp = Math.abs(eh);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -5.4e+26) or not (ew <= 2.35e-79): tmp = math.fabs((math.sin(t) * ew)) else: tmp = math.fabs(eh) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -5.4e+26) || !(ew <= 2.35e-79)) tmp = abs(Float64(sin(t) * ew)); else tmp = abs(eh); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -5.4e+26) || ~((ew <= 2.35e-79))) tmp = abs((sin(t) * ew)); else tmp = abs(eh); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -5.4e+26], N[Not[LessEqual[ew, 2.35e-79]], $MachinePrecision]], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[Abs[eh], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -5.4 \cdot 10^{+26} \lor \neg \left(ew \leq 2.35 \cdot 10^{-79}\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh\right|\\
\end{array}
\end{array}
if ew < -5.4e26 or 2.3500000000000001e-79 < 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-sqrt99.1%
pow299.1%
Applied egg-rr50.3%
Taylor expanded in ew around inf 34.4%
unpow234.4%
sqrt-unprod42.9%
pow242.9%
*-commutative42.9%
Applied egg-rr42.9%
unpow242.9%
rem-sqrt-square72.1%
*-commutative72.1%
Simplified72.1%
if -5.4e26 < ew < 2.3500000000000001e-79Initial 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 58.5%
sin-atan7.0%
hypot-1-def14.5%
div-inv14.5%
associate-/r*15.1%
associate-/r*25.6%
Applied egg-rr25.6%
associate-*r/25.6%
*-rgt-identity25.6%
associate-/l/26.1%
*-commutative26.1%
associate-/r*15.5%
Simplified15.5%
Taylor expanded in eh around inf 58.7%
Final simplification65.1%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -1.75e+31) (not (<= ew 2e+104))) (* (sin t) ew) (fabs eh)))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -1.75e+31) || !(ew <= 2e+104)) {
tmp = sin(t) * ew;
} else {
tmp = fabs(eh);
}
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.75d+31)) .or. (.not. (ew <= 2d+104))) then
tmp = sin(t) * ew
else
tmp = abs(eh)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -1.75e+31) || !(ew <= 2e+104)) {
tmp = Math.sin(t) * ew;
} else {
tmp = Math.abs(eh);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -1.75e+31) or not (ew <= 2e+104): tmp = math.sin(t) * ew else: tmp = math.fabs(eh) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -1.75e+31) || !(ew <= 2e+104)) tmp = Float64(sin(t) * ew); else tmp = abs(eh); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -1.75e+31) || ~((ew <= 2e+104))) tmp = sin(t) * ew; else tmp = abs(eh); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -1.75e+31], N[Not[LessEqual[ew, 2e+104]], $MachinePrecision]], N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision], N[Abs[eh], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.75 \cdot 10^{+31} \lor \neg \left(ew \leq 2 \cdot 10^{+104}\right):\\
\;\;\;\;\sin t \cdot ew\\
\mathbf{else}:\\
\;\;\;\;\left|eh\right|\\
\end{array}
\end{array}
if ew < -1.75e31 or 2e104 < 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-sqrt99.0%
pow299.0%
Applied egg-rr56.4%
Taylor expanded in ew around inf 42.4%
unpow242.4%
add-sqr-sqrt43.1%
*-commutative43.1%
Applied egg-rr43.1%
if -1.75e31 < ew < 2e104Initial 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 52.8%
sin-atan10.1%
hypot-1-def17.5%
div-inv17.5%
associate-/r*17.9%
associate-/r*26.2%
Applied egg-rr26.2%
associate-*r/26.3%
*-rgt-identity26.3%
associate-/l/26.6%
*-commutative26.6%
associate-/r*18.3%
Simplified18.3%
Taylor expanded in eh around inf 53.0%
Final simplification49.7%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -1.6e+167) (not (<= ew 1.8e+188))) (fabs (* t ew)) (fabs eh)))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -1.6e+167) || !(ew <= 1.8e+188)) {
tmp = fabs((t * ew));
} else {
tmp = fabs(eh);
}
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.6d+167)) .or. (.not. (ew <= 1.8d+188))) then
tmp = abs((t * ew))
else
tmp = abs(eh)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -1.6e+167) || !(ew <= 1.8e+188)) {
tmp = Math.abs((t * ew));
} else {
tmp = Math.abs(eh);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -1.6e+167) or not (ew <= 1.8e+188): tmp = math.fabs((t * ew)) else: tmp = math.fabs(eh) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -1.6e+167) || !(ew <= 1.8e+188)) tmp = abs(Float64(t * ew)); else tmp = abs(eh); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -1.6e+167) || ~((ew <= 1.8e+188))) tmp = abs((t * ew)); else tmp = abs(eh); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -1.6e+167], N[Not[LessEqual[ew, 1.8e+188]], $MachinePrecision]], N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision], N[Abs[eh], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.6 \cdot 10^{+167} \lor \neg \left(ew \leq 1.8 \cdot 10^{+188}\right):\\
\;\;\;\;\left|t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh\right|\\
\end{array}
\end{array}
if ew < -1.5999999999999999e167 or 1.8000000000000001e188 < 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-sqrt99.1%
pow299.1%
Applied egg-rr52.2%
Taylor expanded in ew around inf 47.3%
Taylor expanded in t around 0 22.7%
add-sqr-sqrt22.2%
sqrt-unprod34.0%
pow234.0%
Applied egg-rr34.0%
unpow234.0%
rem-sqrt-square44.6%
*-commutative44.6%
Simplified44.6%
if -1.5999999999999999e167 < ew < 1.8000000000000001e188Initial 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 48.4%
sin-atan10.6%
hypot-1-def18.5%
div-inv18.5%
associate-/r*18.9%
associate-/r*25.9%
Applied egg-rr25.9%
associate-*r/26.0%
*-rgt-identity26.0%
associate-/l/26.2%
*-commutative26.2%
associate-/r*19.1%
Simplified19.1%
Taylor expanded in eh around inf 48.6%
Final simplification47.8%
(FPCore (eh ew t) :precision binary64 (if (<= ew -1.7e+209) (* t ew) (fabs eh)))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -1.7e+209) {
tmp = t * ew;
} else {
tmp = fabs(eh);
}
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+209)) then
tmp = t * ew
else
tmp = abs(eh)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (ew <= -1.7e+209) {
tmp = t * ew;
} else {
tmp = Math.abs(eh);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if ew <= -1.7e+209: tmp = t * ew else: tmp = math.fabs(eh) return tmp
function code(eh, ew, t) tmp = 0.0 if (ew <= -1.7e+209) tmp = Float64(t * ew); else tmp = abs(eh); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (ew <= -1.7e+209) tmp = t * ew; else tmp = abs(eh); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[ew, -1.7e+209], N[(t * ew), $MachinePrecision], N[Abs[eh], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.7 \cdot 10^{+209}:\\
\;\;\;\;t \cdot ew\\
\mathbf{else}:\\
\;\;\;\;\left|eh\right|\\
\end{array}
\end{array}
if ew < -1.6999999999999998e209Initial 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-sqrt99.0%
pow299.0%
Applied egg-rr64.6%
Taylor expanded in ew around inf 60.6%
Taylor expanded in t around 0 32.6%
if -1.6999999999999998e209 < 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%
Taylor expanded in t around 0 43.1%
sin-atan10.4%
hypot-1-def17.3%
div-inv17.3%
associate-/r*17.6%
associate-/r*23.7%
Applied egg-rr23.7%
associate-*r/23.7%
*-rgt-identity23.7%
associate-/l/23.9%
*-commutative23.9%
associate-/r*17.8%
Simplified17.8%
Taylor expanded in eh around inf 43.4%
Final simplification42.5%
(FPCore (eh ew t) :precision binary64 (if (<= eh -5e-310) (- eh) eh))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -5e-310) {
tmp = -eh;
} else {
tmp = eh;
}
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 (eh <= (-5d-310)) then
tmp = -eh
else
tmp = eh
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (eh <= -5e-310) {
tmp = -eh;
} else {
tmp = eh;
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= -5e-310: tmp = -eh else: tmp = eh return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= -5e-310) tmp = Float64(-eh); else tmp = eh; end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (eh <= -5e-310) tmp = -eh; else tmp = eh; end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, -5e-310], (-eh), eh]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-eh\\
\mathbf{else}:\\
\;\;\;\;eh\\
\end{array}
\end{array}
if eh < -4.999999999999985e-310Initial 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 37.7%
sin-atan8.0%
hypot-1-def13.7%
div-inv13.7%
associate-/r*14.1%
associate-/r*20.0%
Applied egg-rr20.0%
associate-*r/20.0%
*-rgt-identity20.0%
associate-/l/20.2%
*-commutative20.2%
associate-/r*14.3%
Simplified14.3%
add-sqr-sqrt9.4%
fabs-sqr9.4%
add-sqr-sqrt9.8%
associate-*r/8.8%
times-frac8.3%
Applied egg-rr8.3%
associate-*r/7.8%
Simplified7.8%
Taylor expanded in eh around -inf 38.2%
neg-mul-138.2%
Simplified38.2%
if -4.999999999999985e-310 < eh 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%
Taylor expanded in t around 0 41.5%
sin-atan11.9%
hypot-1-def18.6%
div-inv18.6%
associate-/r*18.8%
associate-/r*24.0%
Applied egg-rr24.0%
associate-*r/24.0%
*-rgt-identity24.0%
associate-/l/24.2%
*-commutative24.2%
associate-/r*19.0%
Simplified19.0%
add-sqr-sqrt7.4%
fabs-sqr7.4%
add-sqr-sqrt8.0%
associate-*r/7.6%
times-frac7.2%
Applied egg-rr7.2%
associate-*r/6.7%
Simplified6.7%
Taylor expanded in eh around inf 42.0%
(FPCore (eh ew t) :precision binary64 eh)
double code(double eh, double ew, double t) {
return eh;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = eh
end function
public static double code(double eh, double ew, double t) {
return eh;
}
def code(eh, ew, t): return eh
function code(eh, ew, t) return eh end
function tmp = code(eh, ew, t) tmp = eh; end
code[eh_, ew_, t_] := eh
\begin{array}{l}
\\
eh
\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%
Taylor expanded in t around 0 39.6%
sin-atan9.9%
hypot-1-def16.2%
div-inv16.1%
associate-/r*16.4%
associate-/r*22.0%
Applied egg-rr22.0%
associate-*r/22.0%
*-rgt-identity22.0%
associate-/l/22.2%
*-commutative22.2%
associate-/r*16.7%
Simplified16.7%
add-sqr-sqrt8.4%
fabs-sqr8.4%
add-sqr-sqrt8.9%
associate-*r/8.2%
times-frac7.8%
Applied egg-rr7.8%
associate-*r/7.3%
Simplified7.3%
Taylor expanded in eh around inf 21.8%
herbie shell --seed 2024172
(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))))))))