
(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 10 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
(+
(* (/ ew (hypot 1.0 t_1)) (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((((ew / hypot(1.0, t_1)) * 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((((ew / Math.hypot(1.0, t_1)) * 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((((ew / math.hypot(1.0, t_1)) * 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(ew / hypot(1.0, t_1)) * 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((((ew / hypot(1.0, t_1)) * 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[(ew / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[t], $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{ew}{\mathsf{hypot}\left(1, t\_1\right)} \cdot \sin t + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t\_1\right|
\end{array}
\end{array}
Initial program 99.8%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
sin-lowering-sin.f6499.8%
Applied egg-rr99.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
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6499.5%
Simplified99.5%
Final simplification99.5%
(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(eh / Float64(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[(eh / N[(ew * N[Tan[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(\frac{eh}{ew \cdot \tan t}\right)\right|
\end{array}
Initial program 99.8%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
sin-lowering-sin.f6499.8%
Applied egg-rr99.8%
Taylor expanded in eh around 0
+-lowering-+.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f64N/A
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6498.6%
Simplified98.6%
Final simplification98.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(fabs
(fma
(* eh (/ (cos t) ew))
ew
(/ (* ew (sin t)) (hypot 1.0 (/ (/ eh t) ew)))))))
(if (<= ew -6.5e-141) t_1 (if (<= ew 1.25e-89) (fabs (* eh (cos t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs(fma((eh * (cos(t) / ew)), ew, ((ew * sin(t)) / hypot(1.0, ((eh / t) / ew)))));
double tmp;
if (ew <= -6.5e-141) {
tmp = t_1;
} else if (ew <= 1.25e-89) {
tmp = fabs((eh * cos(t)));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(fma(Float64(eh * Float64(cos(t) / ew)), ew, Float64(Float64(ew * sin(t)) / hypot(1.0, Float64(Float64(eh / t) / ew))))) tmp = 0.0 if (ew <= -6.5e-141) tmp = t_1; elseif (ew <= 1.25e-89) tmp = abs(Float64(eh * cos(t))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(eh * N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] * ew + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -6.5e-141], t$95$1, If[LessEqual[ew, 1.25e-89], N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\mathsf{fma}\left(eh \cdot \frac{\cos t}{ew}, ew, \frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)}\right)\right|\\
\mathbf{if}\;ew \leq -6.5 \cdot 10^{-141}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 1.25 \cdot 10^{-89}:\\
\;\;\;\;\left|eh \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -6.4999999999999995e-141 or 1.24999999999999992e-89 < ew Initial program 99.8%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
sin-lowering-sin.f6499.8%
Applied egg-rr99.8%
associate-*l/N/A
+-commutativeN/A
Applied egg-rr84.3%
Taylor expanded in eh around inf
Simplified97.4%
Taylor expanded in t around 0
/-lowering-/.f6497.3%
Simplified97.3%
if -6.4999999999999995e-141 < ew < 1.24999999999999992e-89Initial program 99.9%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
sin-lowering-sin.f6499.9%
Applied egg-rr99.9%
associate-*l/N/A
+-commutativeN/A
Applied egg-rr48.9%
Taylor expanded in eh around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6493.6%
Simplified93.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(fabs (+ (* ew (sin t)) (* eh (sin (atan (/ (/ eh ew) (tan t)))))))))
(if (<= ew -5.8e-139) t_1 (if (<= ew 7.5e-40) (fabs (* eh (cos t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs(((ew * sin(t)) + (eh * sin(atan(((eh / ew) / tan(t)))))));
double tmp;
if (ew <= -5.8e-139) {
tmp = t_1;
} else if (ew <= 7.5e-40) {
tmp = fabs((eh * cos(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 * sin(t)) + (eh * sin(atan(((eh / ew) / tan(t)))))))
if (ew <= (-5.8d-139)) then
tmp = t_1
else if (ew <= 7.5d-40) then
tmp = abs((eh * cos(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.sin(t)) + (eh * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
double tmp;
if (ew <= -5.8e-139) {
tmp = t_1;
} else if (ew <= 7.5e-40) {
tmp = Math.abs((eh * Math.cos(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs(((ew * math.sin(t)) + (eh * math.sin(math.atan(((eh / ew) / math.tan(t))))))) tmp = 0 if ew <= -5.8e-139: tmp = t_1 elif ew <= 7.5e-40: tmp = math.fabs((eh * math.cos(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(Float64(ew * sin(t)) + Float64(eh * sin(atan(Float64(Float64(eh / ew) / tan(t))))))) tmp = 0.0 if (ew <= -5.8e-139) tmp = t_1; elseif (ew <= 7.5e-40) tmp = abs(Float64(eh * cos(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs(((ew * sin(t)) + (eh * sin(atan(((eh / ew) / tan(t))))))); tmp = 0.0; if (ew <= -5.8e-139) tmp = t_1; elseif (ew <= 7.5e-40) tmp = abs((eh * cos(t))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -5.8e-139], t$95$1, If[LessEqual[ew, 7.5e-40], N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \sin t + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|\\
\mathbf{if}\;ew \leq -5.8 \cdot 10^{-139}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 7.5 \cdot 10^{-40}:\\
\;\;\;\;\left|eh \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -5.7999999999999998e-139 or 7.50000000000000069e-40 < ew Initial program 99.7%
Taylor expanded in t around 0
Simplified91.7%
cos-atanN/A
metadata-evalN/A
div-invN/A
associate-*l/N/A
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
Applied egg-rr91.6%
Taylor expanded in eh around 0
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
atan-lowering-atan.f64N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6491.1%
Simplified91.1%
if -5.7999999999999998e-139 < ew < 7.50000000000000069e-40Initial program 99.9%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
sin-lowering-sin.f6499.9%
Applied egg-rr99.9%
associate-*l/N/A
+-commutativeN/A
Applied egg-rr52.8%
Taylor expanded in eh around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6492.3%
Simplified92.3%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* eh (cos t))))) (if (<= eh -9e-37) t_1 (if (<= eh 8e-70) (fabs (* ew (sin t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * cos(t)));
double tmp;
if (eh <= -9e-37) {
tmp = t_1;
} else if (eh <= 8e-70) {
tmp = fabs((ew * 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((eh * cos(t)))
if (eh <= (-9d-37)) then
tmp = t_1
else if (eh <= 8d-70) then
tmp = abs((ew * 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((eh * Math.cos(t)));
double tmp;
if (eh <= -9e-37) {
tmp = t_1;
} else if (eh <= 8e-70) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((eh * math.cos(t))) tmp = 0 if eh <= -9e-37: tmp = t_1 elif eh <= 8e-70: tmp = math.fabs((ew * math.sin(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(eh * cos(t))) tmp = 0.0 if (eh <= -9e-37) tmp = t_1; elseif (eh <= 8e-70) tmp = abs(Float64(ew * sin(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((eh * cos(t))); tmp = 0.0; if (eh <= -9e-37) tmp = t_1; elseif (eh <= 8e-70) tmp = abs((ew * sin(t))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -9e-37], t$95$1, If[LessEqual[eh, 8e-70], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \cos t\right|\\
\mathbf{if}\;eh \leq -9 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 8 \cdot 10^{-70}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -9.00000000000000081e-37 or 7.99999999999999997e-70 < eh Initial program 99.8%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
sin-lowering-sin.f6499.8%
Applied egg-rr99.8%
associate-*l/N/A
+-commutativeN/A
Applied egg-rr56.8%
Taylor expanded in eh around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6482.0%
Simplified82.0%
if -9.00000000000000081e-37 < eh < 7.99999999999999997e-70Initial program 99.8%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
sin-lowering-sin.f6499.8%
Applied egg-rr99.8%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6475.4%
Simplified75.4%
(FPCore (eh ew t) :precision binary64 (if (<= ew -4.4e+224) (fabs (* t (+ ew (* -0.16666666666666666 (* ew (* t t)))))) (if (<= ew 1.45e+201) (fabs (* eh (cos t))) (fabs (* ew t)))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -4.4e+224) {
tmp = fabs((t * (ew + (-0.16666666666666666 * (ew * (t * t))))));
} else if (ew <= 1.45e+201) {
tmp = fabs((eh * cos(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 (ew <= (-4.4d+224)) then
tmp = abs((t * (ew + ((-0.16666666666666666d0) * (ew * (t * t))))))
else if (ew <= 1.45d+201) then
tmp = abs((eh * cos(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 (ew <= -4.4e+224) {
tmp = Math.abs((t * (ew + (-0.16666666666666666 * (ew * (t * t))))));
} else if (ew <= 1.45e+201) {
tmp = Math.abs((eh * Math.cos(t)));
} else {
tmp = Math.abs((ew * t));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if ew <= -4.4e+224: tmp = math.fabs((t * (ew + (-0.16666666666666666 * (ew * (t * t)))))) elif ew <= 1.45e+201: tmp = math.fabs((eh * math.cos(t))) else: tmp = math.fabs((ew * t)) return tmp
function code(eh, ew, t) tmp = 0.0 if (ew <= -4.4e+224) tmp = abs(Float64(t * Float64(ew + Float64(-0.16666666666666666 * Float64(ew * Float64(t * t)))))); elseif (ew <= 1.45e+201) tmp = abs(Float64(eh * cos(t))); else tmp = abs(Float64(ew * t)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (ew <= -4.4e+224) tmp = abs((t * (ew + (-0.16666666666666666 * (ew * (t * t)))))); elseif (ew <= 1.45e+201) tmp = abs((eh * cos(t))); else tmp = abs((ew * t)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[ew, -4.4e+224], N[Abs[N[(t * N[(ew + N[(-0.16666666666666666 * N[(ew * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 1.45e+201], N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -4.4 \cdot 10^{+224}:\\
\;\;\;\;\left|t \cdot \left(ew + -0.16666666666666666 \cdot \left(ew \cdot \left(t \cdot t\right)\right)\right)\right|\\
\mathbf{elif}\;ew \leq 1.45 \cdot 10^{+201}:\\
\;\;\;\;\left|eh \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot t\right|\\
\end{array}
\end{array}
if ew < -4.3999999999999999e224Initial program 99.6%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
sin-lowering-sin.f6499.6%
Applied egg-rr99.6%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6482.6%
Simplified82.6%
Taylor expanded in t around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6454.4%
Simplified54.4%
if -4.3999999999999999e224 < ew < 1.4500000000000001e201Initial program 99.8%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
sin-lowering-sin.f6499.8%
Applied egg-rr99.8%
associate-*l/N/A
+-commutativeN/A
Applied egg-rr70.4%
Taylor expanded in eh around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6468.3%
Simplified68.3%
if 1.4500000000000001e201 < ew Initial program 99.8%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
sin-lowering-sin.f6499.8%
Applied egg-rr99.8%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6483.6%
Simplified83.6%
Taylor expanded in t around 0
*-commutativeN/A
*-lowering-*.f6442.7%
Simplified42.7%
Final simplification64.5%
(FPCore (eh ew t)
:precision binary64
(if (<= ew -4.2e+128)
(fabs (* ew t))
(if (<= ew 1.85e+186)
(fabs eh)
(fabs
(*
ew
(*
t
(+
1.0
(*
(* t t)
(+ -0.16666666666666666 (* (* t t) 0.008333333333333333))))))))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -4.2e+128) {
tmp = fabs((ew * t));
} else if (ew <= 1.85e+186) {
tmp = fabs(eh);
} else {
tmp = fabs((ew * (t * (1.0 + ((t * t) * (-0.16666666666666666 + ((t * t) * 0.008333333333333333)))))));
}
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 <= (-4.2d+128)) then
tmp = abs((ew * t))
else if (ew <= 1.85d+186) then
tmp = abs(eh)
else
tmp = abs((ew * (t * (1.0d0 + ((t * t) * ((-0.16666666666666666d0) + ((t * t) * 0.008333333333333333d0)))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (ew <= -4.2e+128) {
tmp = Math.abs((ew * t));
} else if (ew <= 1.85e+186) {
tmp = Math.abs(eh);
} else {
tmp = Math.abs((ew * (t * (1.0 + ((t * t) * (-0.16666666666666666 + ((t * t) * 0.008333333333333333)))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if ew <= -4.2e+128: tmp = math.fabs((ew * t)) elif ew <= 1.85e+186: tmp = math.fabs(eh) else: tmp = math.fabs((ew * (t * (1.0 + ((t * t) * (-0.16666666666666666 + ((t * t) * 0.008333333333333333))))))) return tmp
function code(eh, ew, t) tmp = 0.0 if (ew <= -4.2e+128) tmp = abs(Float64(ew * t)); elseif (ew <= 1.85e+186) tmp = abs(eh); else tmp = abs(Float64(ew * Float64(t * Float64(1.0 + Float64(Float64(t * t) * Float64(-0.16666666666666666 + Float64(Float64(t * t) * 0.008333333333333333))))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (ew <= -4.2e+128) tmp = abs((ew * t)); elseif (ew <= 1.85e+186) tmp = abs(eh); else tmp = abs((ew * (t * (1.0 + ((t * t) * (-0.16666666666666666 + ((t * t) * 0.008333333333333333))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[ew, -4.2e+128], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 1.85e+186], N[Abs[eh], $MachinePrecision], N[Abs[N[(ew * N[(t * N[(1.0 + N[(N[(t * t), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(t * t), $MachinePrecision] * 0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -4.2 \cdot 10^{+128}:\\
\;\;\;\;\left|ew \cdot t\right|\\
\mathbf{elif}\;ew \leq 1.85 \cdot 10^{+186}:\\
\;\;\;\;\left|eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \left(t \cdot \left(1 + \left(t \cdot t\right) \cdot \left(-0.16666666666666666 + \left(t \cdot t\right) \cdot 0.008333333333333333\right)\right)\right)\right|\\
\end{array}
\end{array}
if ew < -4.1999999999999999e128Initial program 99.7%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
sin-lowering-sin.f6499.7%
Applied egg-rr99.7%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6476.5%
Simplified76.5%
Taylor expanded in t around 0
*-commutativeN/A
*-lowering-*.f6439.5%
Simplified39.5%
if -4.1999999999999999e128 < ew < 1.85e186Initial program 99.8%
Taylor expanded in t around 0
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f6452.0%
Simplified52.0%
associate-/r*N/A
sin-atanN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
cos-atanN/A
*-lowering-*.f64N/A
Applied egg-rr27.3%
Taylor expanded in eh around inf
Simplified52.3%
if 1.85e186 < ew Initial program 99.8%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
sin-lowering-sin.f6499.8%
Applied egg-rr99.8%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6479.8%
Simplified79.8%
Taylor expanded in t around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6441.2%
Simplified41.2%
Final simplification48.9%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* ew t)))) (if (<= ew -1.7e+123) t_1 (if (<= ew 1.62e+188) (fabs eh) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * t));
double tmp;
if (ew <= -1.7e+123) {
tmp = t_1;
} else if (ew <= 1.62e+188) {
tmp = fabs(eh);
} 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 * t))
if (ew <= (-1.7d+123)) then
tmp = t_1
else if (ew <= 1.62d+188) then
tmp = abs(eh)
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 * t));
double tmp;
if (ew <= -1.7e+123) {
tmp = t_1;
} else if (ew <= 1.62e+188) {
tmp = Math.abs(eh);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((ew * t)) tmp = 0 if ew <= -1.7e+123: tmp = t_1 elif ew <= 1.62e+188: tmp = math.fabs(eh) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(ew * t)) tmp = 0.0 if (ew <= -1.7e+123) tmp = t_1; elseif (ew <= 1.62e+188) tmp = abs(eh); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((ew * t)); tmp = 0.0; if (ew <= -1.7e+123) tmp = t_1; elseif (ew <= 1.62e+188) tmp = abs(eh); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -1.7e+123], t$95$1, If[LessEqual[ew, 1.62e+188], N[Abs[eh], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot t\right|\\
\mathbf{if}\;ew \leq -1.7 \cdot 10^{+123}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 1.62 \cdot 10^{+188}:\\
\;\;\;\;\left|eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -1.70000000000000001e123 or 1.62000000000000012e188 < ew Initial program 99.7%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
sin-lowering-sin.f6499.7%
Applied egg-rr99.7%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6478.0%
Simplified78.0%
Taylor expanded in t around 0
*-commutativeN/A
*-lowering-*.f6440.3%
Simplified40.3%
if -1.70000000000000001e123 < ew < 1.62000000000000012e188Initial program 99.8%
Taylor expanded in t around 0
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f6452.0%
Simplified52.0%
associate-/r*N/A
sin-atanN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
cos-atanN/A
*-lowering-*.f64N/A
Applied egg-rr27.3%
Taylor expanded in eh around inf
Simplified52.3%
Final simplification48.9%
(FPCore (eh ew t) :precision binary64 (fabs eh))
double code(double eh, double ew, double t) {
return fabs(eh);
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs(eh)
end function
public static double code(double eh, double ew, double t) {
return Math.abs(eh);
}
def code(eh, ew, t): return math.fabs(eh)
function code(eh, ew, t) return abs(eh) end
function tmp = code(eh, ew, t) tmp = abs(eh); end
code[eh_, ew_, t_] := N[Abs[eh], $MachinePrecision]
\begin{array}{l}
\\
\left|eh\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f6442.8%
Simplified42.8%
associate-/r*N/A
sin-atanN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
cos-atanN/A
*-lowering-*.f64N/A
Applied egg-rr21.6%
Taylor expanded in eh around inf
Simplified43.2%
herbie shell --seed 2024160
(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))))))))