
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(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 * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(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 * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* eh (tan t)) (- 0.0 ew))))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh * tan(t)) / (0.0 - ew)));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(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 * tan(t)) / (0.0d0 - ew)))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh * Math.tan(t)) / (0.0 - ew)));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh * math.tan(t)) / (0.0 - ew))) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh * tan(t)) / Float64(0.0 - ew))) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh * tan(t)) / (0.0 - ew))); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh \cdot \tan t}{0 - ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ (* ew (cos t)) (hypot 1.0 (/ eh (- 0.0 (/ ew (tan t)))))) (* (* eh (sin t)) (sin (atan (/ (* eh (tan t)) (- 0.0 ew))))))))
double code(double eh, double ew, double t) {
return fabs((((ew * cos(t)) / hypot(1.0, (eh / (0.0 - (ew / tan(t)))))) - ((eh * sin(t)) * sin(atan(((eh * tan(t)) / (0.0 - ew)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((ew * Math.cos(t)) / Math.hypot(1.0, (eh / (0.0 - (ew / Math.tan(t)))))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * Math.tan(t)) / (0.0 - ew)))))));
}
def code(eh, ew, t): return math.fabs((((ew * math.cos(t)) / math.hypot(1.0, (eh / (0.0 - (ew / math.tan(t)))))) - ((eh * math.sin(t)) * math.sin(math.atan(((eh * math.tan(t)) / (0.0 - ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * cos(t)) / hypot(1.0, Float64(eh / Float64(0.0 - Float64(ew / tan(t)))))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * tan(t)) / Float64(0.0 - ew))))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * cos(t)) / hypot(1.0, (eh / (0.0 - (ew / tan(t)))))) - ((eh * sin(t)) * sin(atan(((eh * tan(t)) / (0.0 - ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(eh / N[(0.0 - N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \frac{eh}{0 - \frac{ew}{\tan t}}\right)} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{0 - ew}\right)\right|
\end{array}
Initial program 99.8%
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
associate-/l*N/A
distribute-lft-neg-outN/A
neg-sub0N/A
remove-double-negN/A
distribute-lft-neg-outN/A
associate-/l*N/A
--lowering--.f64N/A
associate-/l*N/A
distribute-lft-neg-outN/A
remove-double-negN/A
clear-numN/A
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ ew (tan t))) (t_2 (* eh (sin t))))
(if (<= eh 1.25e+217)
(fabs
(/ (+ (* ew (cos t)) (* t_2 (/ eh t_1))) (hypot 1.0 (/ eh (- 0.0 t_1)))))
(fabs
(+ t_2 (* ew (* ew (* (+ 0.5 (* 0.5 (cos (* t 2.0)))) (/ 0.5 t_2)))))))))
double code(double eh, double ew, double t) {
double t_1 = ew / tan(t);
double t_2 = eh * sin(t);
double tmp;
if (eh <= 1.25e+217) {
tmp = fabs((((ew * cos(t)) + (t_2 * (eh / t_1))) / hypot(1.0, (eh / (0.0 - t_1)))));
} else {
tmp = fabs((t_2 + (ew * (ew * ((0.5 + (0.5 * cos((t * 2.0)))) * (0.5 / t_2))))));
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double t_1 = ew / Math.tan(t);
double t_2 = eh * Math.sin(t);
double tmp;
if (eh <= 1.25e+217) {
tmp = Math.abs((((ew * Math.cos(t)) + (t_2 * (eh / t_1))) / Math.hypot(1.0, (eh / (0.0 - t_1)))));
} else {
tmp = Math.abs((t_2 + (ew * (ew * ((0.5 + (0.5 * Math.cos((t * 2.0)))) * (0.5 / t_2))))));
}
return tmp;
}
def code(eh, ew, t): t_1 = ew / math.tan(t) t_2 = eh * math.sin(t) tmp = 0 if eh <= 1.25e+217: tmp = math.fabs((((ew * math.cos(t)) + (t_2 * (eh / t_1))) / math.hypot(1.0, (eh / (0.0 - t_1))))) else: tmp = math.fabs((t_2 + (ew * (ew * ((0.5 + (0.5 * math.cos((t * 2.0)))) * (0.5 / t_2)))))) return tmp
function code(eh, ew, t) t_1 = Float64(ew / tan(t)) t_2 = Float64(eh * sin(t)) tmp = 0.0 if (eh <= 1.25e+217) tmp = abs(Float64(Float64(Float64(ew * cos(t)) + Float64(t_2 * Float64(eh / t_1))) / hypot(1.0, Float64(eh / Float64(0.0 - t_1))))); else tmp = abs(Float64(t_2 + Float64(ew * Float64(ew * Float64(Float64(0.5 + Float64(0.5 * cos(Float64(t * 2.0)))) * Float64(0.5 / t_2)))))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew / tan(t); t_2 = eh * sin(t); tmp = 0.0; if (eh <= 1.25e+217) tmp = abs((((ew * cos(t)) + (t_2 * (eh / t_1))) / hypot(1.0, (eh / (0.0 - t_1))))); else tmp = abs((t_2 + (ew * (ew * ((0.5 + (0.5 * cos((t * 2.0)))) * (0.5 / t_2)))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, 1.25e+217], N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 * N[(eh / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(eh / N[(0.0 - t$95$1), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(t$95$2 + N[(ew * N[(ew * N[(N[(0.5 + N[(0.5 * N[Cos[N[(t * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{ew}{\tan t}\\
t_2 := eh \cdot \sin t\\
\mathbf{if}\;eh \leq 1.25 \cdot 10^{+217}:\\
\;\;\;\;\left|\frac{ew \cdot \cos t + t\_2 \cdot \frac{eh}{t\_1}}{\mathsf{hypot}\left(1, \frac{eh}{0 - t\_1}\right)}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t\_2 + ew \cdot \left(ew \cdot \left(\left(0.5 + 0.5 \cdot \cos \left(t \cdot 2\right)\right) \cdot \frac{0.5}{t\_2}\right)\right)\right|\\
\end{array}
\end{array}
if eh < 1.2500000000000001e217Initial program 99.8%
cos-atanN/A
un-div-invN/A
*-commutativeN/A
sin-atanN/A
associate-*l/N/A
sub-divN/A
/-lowering-/.f64N/A
Applied egg-rr89.5%
if 1.2500000000000001e217 < eh Initial program 99.8%
cos-atanN/A
un-div-invN/A
*-commutativeN/A
sin-atanN/A
associate-*l/N/A
sub-divN/A
/-lowering-/.f64N/A
Applied egg-rr39.5%
Taylor expanded in ew around 0
distribute-lft1-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6475.5%
Simplified75.5%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr94.9%
Final simplification89.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (sin t))))
(if (<= eh 2.2e+217)
(fabs
(/
(+ (* ew (cos t)) (* t_1 (/ eh (/ ew (tan t)))))
(hypot 1.0 (* eh (/ (tan t) ew)))))
(fabs
(+ t_1 (* ew (* ew (* (+ 0.5 (* 0.5 (cos (* t 2.0)))) (/ 0.5 t_1)))))))))
double code(double eh, double ew, double t) {
double t_1 = eh * sin(t);
double tmp;
if (eh <= 2.2e+217) {
tmp = fabs((((ew * cos(t)) + (t_1 * (eh / (ew / tan(t))))) / hypot(1.0, (eh * (tan(t) / ew)))));
} else {
tmp = fabs((t_1 + (ew * (ew * ((0.5 + (0.5 * cos((t * 2.0)))) * (0.5 / t_1))))));
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double t_1 = eh * Math.sin(t);
double tmp;
if (eh <= 2.2e+217) {
tmp = Math.abs((((ew * Math.cos(t)) + (t_1 * (eh / (ew / Math.tan(t))))) / Math.hypot(1.0, (eh * (Math.tan(t) / ew)))));
} else {
tmp = Math.abs((t_1 + (ew * (ew * ((0.5 + (0.5 * Math.cos((t * 2.0)))) * (0.5 / t_1))))));
}
return tmp;
}
def code(eh, ew, t): t_1 = eh * math.sin(t) tmp = 0 if eh <= 2.2e+217: tmp = math.fabs((((ew * math.cos(t)) + (t_1 * (eh / (ew / math.tan(t))))) / math.hypot(1.0, (eh * (math.tan(t) / ew))))) else: tmp = math.fabs((t_1 + (ew * (ew * ((0.5 + (0.5 * math.cos((t * 2.0)))) * (0.5 / t_1)))))) return tmp
function code(eh, ew, t) t_1 = Float64(eh * sin(t)) tmp = 0.0 if (eh <= 2.2e+217) tmp = abs(Float64(Float64(Float64(ew * cos(t)) + Float64(t_1 * Float64(eh / Float64(ew / tan(t))))) / hypot(1.0, Float64(eh * Float64(tan(t) / ew))))); else tmp = abs(Float64(t_1 + Float64(ew * Float64(ew * Float64(Float64(0.5 + Float64(0.5 * cos(Float64(t * 2.0)))) * Float64(0.5 / t_1)))))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh * sin(t); tmp = 0.0; if (eh <= 2.2e+217) tmp = abs((((ew * cos(t)) + (t_1 * (eh / (ew / tan(t))))) / hypot(1.0, (eh * (tan(t) / ew))))); else tmp = abs((t_1 + (ew * (ew * ((0.5 + (0.5 * cos((t * 2.0)))) * (0.5 / t_1)))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, 2.2e+217], N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(eh / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(t$95$1 + N[(ew * N[(ew * N[(N[(0.5 + N[(0.5 * N[Cos[N[(t * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \sin t\\
\mathbf{if}\;eh \leq 2.2 \cdot 10^{+217}:\\
\;\;\;\;\left|\frac{ew \cdot \cos t + t\_1 \cdot \frac{eh}{\frac{ew}{\tan t}}}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t\_1 + ew \cdot \left(ew \cdot \left(\left(0.5 + 0.5 \cdot \cos \left(t \cdot 2\right)\right) \cdot \frac{0.5}{t\_1}\right)\right)\right|\\
\end{array}
\end{array}
if eh < 2.2e217Initial program 99.8%
cos-atanN/A
un-div-invN/A
*-commutativeN/A
sin-atanN/A
associate-*l/N/A
sub-divN/A
/-lowering-/.f64N/A
Applied egg-rr89.5%
hypot-undefineN/A
div-invN/A
clear-numN/A
cancel-sign-sub-invN/A
associate-/l*N/A
+-lft-identityN/A
hypot-1-defN/A
square-defineN/A
+-lft-identityN/A
associate-/l*N/A
cancel-sign-sub-invN/A
clear-numN/A
div-invN/A
square-defineN/A
Applied egg-rr89.4%
if 2.2e217 < eh Initial program 99.8%
cos-atanN/A
un-div-invN/A
*-commutativeN/A
sin-atanN/A
associate-*l/N/A
sub-divN/A
/-lowering-/.f64N/A
Applied egg-rr39.5%
Taylor expanded in ew around 0
distribute-lft1-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6475.5%
Simplified75.5%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr94.9%
Final simplification89.8%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* ew (cos t))))) (if (<= ew -7.8e-81) t_1 (if (<= ew 5.8e-66) (fabs (* eh (sin t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * cos(t)));
double tmp;
if (ew <= -7.8e-81) {
tmp = t_1;
} else if (ew <= 5.8e-66) {
tmp = fabs((eh * sin(t)));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = abs((ew * cos(t)))
if (ew <= (-7.8d-81)) then
tmp = t_1
else if (ew <= 5.8d-66) then
tmp = abs((eh * sin(t)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs((ew * Math.cos(t)));
double tmp;
if (ew <= -7.8e-81) {
tmp = t_1;
} else if (ew <= 5.8e-66) {
tmp = Math.abs((eh * Math.sin(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((ew * math.cos(t))) tmp = 0 if ew <= -7.8e-81: tmp = t_1 elif ew <= 5.8e-66: tmp = math.fabs((eh * math.sin(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(ew * cos(t))) tmp = 0.0 if (ew <= -7.8e-81) tmp = t_1; elseif (ew <= 5.8e-66) tmp = abs(Float64(eh * sin(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((ew * cos(t))); tmp = 0.0; if (ew <= -7.8e-81) tmp = t_1; elseif (ew <= 5.8e-66) tmp = abs((eh * sin(t))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -7.8e-81], t$95$1, If[LessEqual[ew, 5.8e-66], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \cos t\right|\\
\mathbf{if}\;ew \leq -7.8 \cdot 10^{-81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 5.8 \cdot 10^{-66}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -7.7999999999999997e-81 or 5.80000000000000023e-66 < ew Initial program 99.8%
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
associate-/l*N/A
distribute-lft-neg-outN/A
neg-sub0N/A
remove-double-negN/A
distribute-lft-neg-outN/A
associate-/l*N/A
--lowering--.f64N/A
associate-/l*N/A
distribute-lft-neg-outN/A
remove-double-negN/A
clear-numN/A
Applied egg-rr99.8%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6482.6%
Simplified82.6%
if -7.7999999999999997e-81 < ew < 5.80000000000000023e-66Initial program 99.8%
cos-atanN/A
un-div-invN/A
*-commutativeN/A
sin-atanN/A
associate-*l/N/A
sub-divN/A
/-lowering-/.f64N/A
Applied egg-rr65.4%
Taylor expanded in ew around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6471.6%
Simplified71.6%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* eh (sin t))))) (if (<= eh -3.6e-57) t_1 (if (<= eh 3e+49) (fabs ew) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (eh <= -3.6e-57) {
tmp = t_1;
} else if (eh <= 3e+49) {
tmp = fabs(ew);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = abs((eh * sin(t)))
if (eh <= (-3.6d-57)) then
tmp = t_1
else if (eh <= 3d+49) then
tmp = abs(ew)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs((eh * Math.sin(t)));
double tmp;
if (eh <= -3.6e-57) {
tmp = t_1;
} else if (eh <= 3e+49) {
tmp = Math.abs(ew);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((eh * math.sin(t))) tmp = 0 if eh <= -3.6e-57: tmp = t_1 elif eh <= 3e+49: tmp = math.fabs(ew) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(eh * sin(t))) tmp = 0.0 if (eh <= -3.6e-57) tmp = t_1; elseif (eh <= 3e+49) tmp = abs(ew); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((eh * sin(t))); tmp = 0.0; if (eh <= -3.6e-57) tmp = t_1; elseif (eh <= 3e+49) tmp = abs(ew); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -3.6e-57], t$95$1, If[LessEqual[eh, 3e+49], N[Abs[ew], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;eh \leq -3.6 \cdot 10^{-57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 3 \cdot 10^{+49}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -3.6000000000000002e-57 or 3.0000000000000002e49 < eh Initial program 99.8%
cos-atanN/A
un-div-invN/A
*-commutativeN/A
sin-atanN/A
associate-*l/N/A
sub-divN/A
/-lowering-/.f64N/A
Applied egg-rr71.2%
Taylor expanded in ew around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6462.8%
Simplified62.8%
if -3.6000000000000002e-57 < eh < 3.0000000000000002e49Initial program 99.9%
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
associate-/l*N/A
distribute-lft-neg-outN/A
neg-sub0N/A
remove-double-negN/A
distribute-lft-neg-outN/A
associate-/l*N/A
--lowering--.f64N/A
associate-/l*N/A
distribute-lft-neg-outN/A
remove-double-negN/A
clear-numN/A
Applied egg-rr99.9%
Taylor expanded in t around 0
Simplified57.1%
(FPCore (eh ew t) :precision binary64 (if (<= eh -5.4e+82) (fabs (* t (+ eh (* -0.16666666666666666 (* eh (* t t)))))) (if (<= eh 6.8e+214) (fabs ew) (fabs (* t eh)))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -5.4e+82) {
tmp = fabs((t * (eh + (-0.16666666666666666 * (eh * (t * t))))));
} else if (eh <= 6.8e+214) {
tmp = fabs(ew);
} else {
tmp = fabs((t * 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 <= (-5.4d+82)) then
tmp = abs((t * (eh + ((-0.16666666666666666d0) * (eh * (t * t))))))
else if (eh <= 6.8d+214) then
tmp = abs(ew)
else
tmp = abs((t * eh))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (eh <= -5.4e+82) {
tmp = Math.abs((t * (eh + (-0.16666666666666666 * (eh * (t * t))))));
} else if (eh <= 6.8e+214) {
tmp = Math.abs(ew);
} else {
tmp = Math.abs((t * eh));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= -5.4e+82: tmp = math.fabs((t * (eh + (-0.16666666666666666 * (eh * (t * t)))))) elif eh <= 6.8e+214: tmp = math.fabs(ew) else: tmp = math.fabs((t * eh)) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= -5.4e+82) tmp = abs(Float64(t * Float64(eh + Float64(-0.16666666666666666 * Float64(eh * Float64(t * t)))))); elseif (eh <= 6.8e+214) tmp = abs(ew); else tmp = abs(Float64(t * eh)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (eh <= -5.4e+82) tmp = abs((t * (eh + (-0.16666666666666666 * (eh * (t * t)))))); elseif (eh <= 6.8e+214) tmp = abs(ew); else tmp = abs((t * eh)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, -5.4e+82], N[Abs[N[(t * N[(eh + N[(-0.16666666666666666 * N[(eh * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 6.8e+214], N[Abs[ew], $MachinePrecision], N[Abs[N[(t * eh), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -5.4 \cdot 10^{+82}:\\
\;\;\;\;\left|t \cdot \left(eh + -0.16666666666666666 \cdot \left(eh \cdot \left(t \cdot t\right)\right)\right)\right|\\
\mathbf{elif}\;eh \leq 6.8 \cdot 10^{+214}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t \cdot eh\right|\\
\end{array}
\end{array}
if eh < -5.3999999999999999e82Initial program 99.7%
Applied egg-rr32.5%
Taylor expanded in ew around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6466.3%
Simplified66.3%
Taylor expanded in t around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6438.8%
Simplified38.8%
if -5.3999999999999999e82 < eh < 6.7999999999999996e214Initial program 99.8%
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
associate-/l*N/A
distribute-lft-neg-outN/A
neg-sub0N/A
remove-double-negN/A
distribute-lft-neg-outN/A
associate-/l*N/A
--lowering--.f64N/A
associate-/l*N/A
distribute-lft-neg-outN/A
remove-double-negN/A
clear-numN/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified50.2%
if 6.7999999999999996e214 < eh Initial program 99.8%
Applied egg-rr16.1%
Taylor expanded in ew around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6490.5%
Simplified90.5%
Taylor expanded in t around 0
*-lowering-*.f6451.5%
Simplified51.5%
Final simplification48.3%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* t eh)))) (if (<= eh -1.2e+82) t_1 (if (<= eh 2.8e+215) (fabs ew) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((t * eh));
double tmp;
if (eh <= -1.2e+82) {
tmp = t_1;
} else if (eh <= 2.8e+215) {
tmp = fabs(ew);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = abs((t * eh))
if (eh <= (-1.2d+82)) then
tmp = t_1
else if (eh <= 2.8d+215) then
tmp = abs(ew)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs((t * eh));
double tmp;
if (eh <= -1.2e+82) {
tmp = t_1;
} else if (eh <= 2.8e+215) {
tmp = Math.abs(ew);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((t * eh)) tmp = 0 if eh <= -1.2e+82: tmp = t_1 elif eh <= 2.8e+215: tmp = math.fabs(ew) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(t * eh)) tmp = 0.0 if (eh <= -1.2e+82) tmp = t_1; elseif (eh <= 2.8e+215) tmp = abs(ew); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((t * eh)); tmp = 0.0; if (eh <= -1.2e+82) tmp = t_1; elseif (eh <= 2.8e+215) tmp = abs(ew); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(t * eh), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -1.2e+82], t$95$1, If[LessEqual[eh, 2.8e+215], N[Abs[ew], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|t \cdot eh\right|\\
\mathbf{if}\;eh \leq -1.2 \cdot 10^{+82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 2.8 \cdot 10^{+215}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -1.19999999999999999e82 or 2.8e215 < eh Initial program 99.7%
Applied egg-rr27.3%
Taylor expanded in ew around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6473.9%
Simplified73.9%
Taylor expanded in t around 0
*-lowering-*.f6442.5%
Simplified42.5%
if -1.19999999999999999e82 < eh < 2.8e215Initial program 99.8%
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
associate-/l*N/A
distribute-lft-neg-outN/A
neg-sub0N/A
remove-double-negN/A
distribute-lft-neg-outN/A
associate-/l*N/A
--lowering--.f64N/A
associate-/l*N/A
distribute-lft-neg-outN/A
remove-double-negN/A
clear-numN/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified50.2%
Final simplification48.2%
(FPCore (eh ew t) :precision binary64 (fabs ew))
double code(double eh, double ew, double t) {
return fabs(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(ew)
end function
public static double code(double eh, double ew, double t) {
return Math.abs(ew);
}
def code(eh, ew, t): return math.fabs(ew)
function code(eh, ew, t) return abs(ew) end
function tmp = code(eh, ew, t) tmp = abs(ew); end
code[eh_, ew_, t_] := N[Abs[ew], $MachinePrecision]
\begin{array}{l}
\\
\left|ew\right|
\end{array}
Initial program 99.8%
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
associate-/l*N/A
distribute-lft-neg-outN/A
neg-sub0N/A
remove-double-negN/A
distribute-lft-neg-outN/A
associate-/l*N/A
--lowering--.f64N/A
associate-/l*N/A
distribute-lft-neg-outN/A
remove-double-negN/A
clear-numN/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified42.9%
herbie shell --seed 2024161
(FPCore (eh ew t)
:name "Example 2 from Robby"
:precision binary64
(fabs (- (* (* ew (cos t)) (cos (atan (/ (* (- eh) (tan t)) ew)))) (* (* eh (sin t)) (sin (atan (/ (* (- eh) (tan t)) ew)))))))