
(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
(let* ((t_1 (/ (/ eh ew) (tan t))))
(fabs
(fma (* (cos t) (sin (atan t_1))) eh (/ (* 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(fma((cos(t) * sin(atan(t_1))), eh, ((ew * sin(t)) / hypot(1.0, t_1))));
}
function code(eh, ew, t) t_1 = Float64(Float64(eh / ew) / tan(t)) return abs(fma(Float64(cos(t) * sin(atan(t_1))), eh, Float64(Float64(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[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * eh + 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|\mathsf{fma}\left(\cos t \cdot \sin \tan^{-1} t\_1, eh, \frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, t\_1\right)}\right)\right|
\end{array}
\end{array}
Initial program 99.8%
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fma-defineN/A
fma-lowering-fma.f64N/A
Applied egg-rr99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh ew) (tan t))))
(fabs
(+
(/ (* ew (sin t)) (hypot 1.0 t_1))
(* (sin (atan t_1)) (* (cos t) eh))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / tan(t);
return fabs((((ew * sin(t)) / hypot(1.0, t_1)) + (sin(atan(t_1)) * (cos(t) * eh))));
}
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)) / Math.hypot(1.0, t_1)) + (Math.sin(Math.atan(t_1)) * (Math.cos(t) * eh))));
}
def code(eh, ew, t): t_1 = (eh / ew) / math.tan(t) return math.fabs((((ew * math.sin(t)) / math.hypot(1.0, t_1)) + (math.sin(math.atan(t_1)) * (math.cos(t) * eh))))
function code(eh, ew, t) t_1 = Float64(Float64(eh / ew) / tan(t)) return abs(Float64(Float64(Float64(ew * sin(t)) / hypot(1.0, t_1)) + Float64(sin(atan(t_1)) * Float64(cos(t) * eh)))) end
function tmp = code(eh, ew, t) t_1 = (eh / ew) / tan(t); tmp = abs((((ew * sin(t)) / hypot(1.0, t_1)) + (sin(atan(t_1)) * (cos(t) * eh)))); 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[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{ew}}{\tan t}\\
\left|\frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, t\_1\right)} + \sin \tan^{-1} t\_1 \cdot \left(\cos t \cdot eh\right)\right|
\end{array}
\end{array}
Initial program 99.8%
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6499.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh ew) (tan t))))
(fabs
(+
(* (sin (atan t_1)) (* (cos t) eh))
(* 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(((sin(atan(t_1)) * (cos(t) * eh)) + (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(((Math.sin(Math.atan(t_1)) * (Math.cos(t) * eh)) + (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(((math.sin(math.atan(t_1)) * (math.cos(t) * eh)) + (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(sin(atan(t_1)) * Float64(cos(t) * eh)) + Float64(ew * Float64(sin(t) / hypot(1.0, t_1))))) end
function tmp = code(eh, ew, t) t_1 = (eh / ew) / tan(t); tmp = abs(((sin(atan(t_1)) * (cos(t) * eh)) + (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[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision] + N[(ew * N[(N[Sin[t], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{ew}}{\tan t}\\
\left|\sin \tan^{-1} t\_1 \cdot \left(\cos t \cdot eh\right) + ew \cdot \frac{\sin t}{\mathsf{hypot}\left(1, t\_1\right)}\right|
\end{array}
\end{array}
Initial program 99.8%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6499.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (sin (atan (/ (/ eh ew) (tan t)))) (* (cos t) eh)) (* (* ew (sin t)) (/ 1.0 (hypot 1.0 (/ eh (* t ew))))))))
double code(double eh, double ew, double t) {
return fabs(((sin(atan(((eh / ew) / tan(t)))) * (cos(t) * eh)) + ((ew * sin(t)) * (1.0 / hypot(1.0, (eh / (t * ew)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.sin(Math.atan(((eh / ew) / Math.tan(t)))) * (Math.cos(t) * eh)) + ((ew * Math.sin(t)) * (1.0 / Math.hypot(1.0, (eh / (t * ew)))))));
}
def code(eh, ew, t): return math.fabs(((math.sin(math.atan(((eh / ew) / math.tan(t)))) * (math.cos(t) * eh)) + ((ew * math.sin(t)) * (1.0 / math.hypot(1.0, (eh / (t * ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(sin(atan(Float64(Float64(eh / ew) / tan(t)))) * Float64(cos(t) * eh)) + Float64(Float64(ew * sin(t)) * Float64(1.0 / hypot(1.0, Float64(eh / Float64(t * ew))))))) end
function tmp = code(eh, ew, t) tmp = abs(((sin(atan(((eh / ew) / tan(t)))) * (cos(t) * eh)) + ((ew * sin(t)) * (1.0 / hypot(1.0, (eh / (t * ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \left(\cos t \cdot eh\right) + \left(ew \cdot \sin t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{eh}{t \cdot ew}\right)}\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6499.5%
Simplified99.5%
*-commutativeN/A
*-lowering-*.f64N/A
cos-atanN/A
/-lowering-/.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6499.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (sin t)) (* (* (cos t) eh) (sin (atan (/ eh (* ew (tan t)))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * sin(t)) + ((cos(t) * eh) * 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)) + ((cos(t) * eh) * 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)) + ((Math.cos(t) * eh) * Math.sin(Math.atan((eh / (ew * Math.tan(t))))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.sin(t)) + ((math.cos(t) * eh) * math.sin(math.atan((eh / (ew * math.tan(t))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * sin(t)) + Float64(Float64(cos(t) * eh) * sin(atan(Float64(eh / Float64(ew * tan(t)))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * sin(t)) + ((cos(t) * eh) * sin(atan((eh / (ew * tan(t)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Cos[t], $MachinePrecision] * eh), $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(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|
\end{array}
Initial program 99.8%
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fma-defineN/A
fma-lowering-fma.f64N/A
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.5%
Simplified98.5%
Final simplification98.5%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (cos t) eh)))
(if (<= eh -8.5e-89)
(fabs (* t_1 (sin (atan (/ eh (* ew (tan t)))))))
(if (<= eh 5e-56)
(fabs (* ew (sin t)))
(fabs (* (sin (atan (/ (/ eh ew) (tan t)))) t_1))))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * eh;
double tmp;
if (eh <= -8.5e-89) {
tmp = fabs((t_1 * sin(atan((eh / (ew * tan(t)))))));
} else if (eh <= 5e-56) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs((sin(atan(((eh / ew) / tan(t)))) * 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 = cos(t) * eh
if (eh <= (-8.5d-89)) then
tmp = abs((t_1 * sin(atan((eh / (ew * tan(t)))))))
else if (eh <= 5d-56) then
tmp = abs((ew * sin(t)))
else
tmp = abs((sin(atan(((eh / ew) / tan(t)))) * t_1))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.cos(t) * eh;
double tmp;
if (eh <= -8.5e-89) {
tmp = Math.abs((t_1 * Math.sin(Math.atan((eh / (ew * Math.tan(t)))))));
} else if (eh <= 5e-56) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = Math.abs((Math.sin(Math.atan(((eh / ew) / Math.tan(t)))) * t_1));
}
return tmp;
}
def code(eh, ew, t): t_1 = math.cos(t) * eh tmp = 0 if eh <= -8.5e-89: tmp = math.fabs((t_1 * math.sin(math.atan((eh / (ew * math.tan(t))))))) elif eh <= 5e-56: tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs((math.sin(math.atan(((eh / ew) / math.tan(t)))) * t_1)) return tmp
function code(eh, ew, t) t_1 = Float64(cos(t) * eh) tmp = 0.0 if (eh <= -8.5e-89) tmp = abs(Float64(t_1 * sin(atan(Float64(eh / Float64(ew * tan(t))))))); elseif (eh <= 5e-56) tmp = abs(Float64(ew * sin(t))); else tmp = abs(Float64(sin(atan(Float64(Float64(eh / ew) / tan(t)))) * t_1)); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = cos(t) * eh; tmp = 0.0; if (eh <= -8.5e-89) tmp = abs((t_1 * sin(atan((eh / (ew * tan(t))))))); elseif (eh <= 5e-56) tmp = abs((ew * sin(t))); else tmp = abs((sin(atan(((eh / ew) / tan(t)))) * t_1)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]}, If[LessEqual[eh, -8.5e-89], N[Abs[N[(t$95$1 * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 5e-56], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot eh\\
\mathbf{if}\;eh \leq -8.5 \cdot 10^{-89}:\\
\;\;\;\;\left|t\_1 \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\mathbf{elif}\;eh \leq 5 \cdot 10^{-56}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot t\_1\right|\\
\end{array}
\end{array}
if eh < -8.49999999999999937e-89Initial program 99.8%
Taylor expanded in ew around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.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
cos-lowering-cos.f6480.7%
Simplified80.7%
if -8.49999999999999937e-89 < eh < 4.99999999999999997e-56Initial program 99.7%
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fma-defineN/A
fma-lowering-fma.f64N/A
Applied egg-rr99.7%
Taylor expanded in eh around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6474.8%
Simplified74.8%
if 4.99999999999999997e-56 < eh Initial program 100.0%
cos-atanN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
hypot-1-defN/A
hypot-lowering-hypot.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64100.0%
Applied egg-rr100.0%
Taylor expanded in ew around 0
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
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6485.7%
Simplified85.7%
Final simplification79.9%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (* (cos t) eh) (sin (atan (/ eh (* ew (tan t))))))))) (if (<= eh -1.8e-88) t_1 (if (<= eh 8.8e-57) (fabs (* ew (sin t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs(((cos(t) * eh) * sin(atan((eh / (ew * tan(t)))))));
double tmp;
if (eh <= -1.8e-88) {
tmp = t_1;
} else if (eh <= 8.8e-57) {
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(((cos(t) * eh) * sin(atan((eh / (ew * tan(t)))))))
if (eh <= (-1.8d-88)) then
tmp = t_1
else if (eh <= 8.8d-57) 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(((Math.cos(t) * eh) * Math.sin(Math.atan((eh / (ew * Math.tan(t)))))));
double tmp;
if (eh <= -1.8e-88) {
tmp = t_1;
} else if (eh <= 8.8e-57) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs(((math.cos(t) * eh) * math.sin(math.atan((eh / (ew * math.tan(t))))))) tmp = 0 if eh <= -1.8e-88: tmp = t_1 elif eh <= 8.8e-57: tmp = math.fabs((ew * math.sin(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(Float64(cos(t) * eh) * sin(atan(Float64(eh / Float64(ew * tan(t))))))) tmp = 0.0 if (eh <= -1.8e-88) tmp = t_1; elseif (eh <= 8.8e-57) tmp = abs(Float64(ew * sin(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs(((cos(t) * eh) * sin(atan((eh / (ew * tan(t))))))); tmp = 0.0; if (eh <= -1.8e-88) tmp = t_1; elseif (eh <= 8.8e-57) 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[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -1.8e-88], t$95$1, If[LessEqual[eh, 8.8e-57], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\mathbf{if}\;eh \leq -1.8 \cdot 10^{-88}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 8.8 \cdot 10^{-57}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -1.8e-88 or 8.79999999999999994e-57 < eh Initial program 99.9%
Taylor expanded in ew around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.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
cos-lowering-cos.f6483.0%
Simplified83.0%
if -1.8e-88 < eh < 8.79999999999999994e-57Initial program 99.7%
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fma-defineN/A
fma-lowering-fma.f64N/A
Applied egg-rr99.7%
Taylor expanded in eh around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6474.8%
Simplified74.8%
Final simplification79.9%
(FPCore (eh ew t) :precision binary64 (if (<= eh -5.2e-87) (fabs eh) (if (<= eh 3.25e-37) (fabs (* ew (sin t))) (fabs eh))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -5.2e-87) {
tmp = fabs(eh);
} else if (eh <= 3.25e-37) {
tmp = fabs((ew * sin(t)));
} 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 (eh <= (-5.2d-87)) then
tmp = abs(eh)
else if (eh <= 3.25d-37) then
tmp = abs((ew * sin(t)))
else
tmp = abs(eh)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (eh <= -5.2e-87) {
tmp = Math.abs(eh);
} else if (eh <= 3.25e-37) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = Math.abs(eh);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= -5.2e-87: tmp = math.fabs(eh) elif eh <= 3.25e-37: tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs(eh) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= -5.2e-87) tmp = abs(eh); elseif (eh <= 3.25e-37) tmp = abs(Float64(ew * sin(t))); else tmp = abs(eh); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (eh <= -5.2e-87) tmp = abs(eh); elseif (eh <= 3.25e-37) tmp = abs((ew * sin(t))); else tmp = abs(eh); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, -5.2e-87], N[Abs[eh], $MachinePrecision], If[LessEqual[eh, 3.25e-37], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[eh], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -5.2 \cdot 10^{-87}:\\
\;\;\;\;\left|eh\right|\\
\mathbf{elif}\;eh \leq 3.25 \cdot 10^{-37}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh\right|\\
\end{array}
\end{array}
if eh < -5.20000000000000005e-87 or 3.2500000000000001e-37 < eh Initial program 99.9%
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.f6462.8%
Simplified62.8%
associate-/r*N/A
sin-atanN/A
div-invN/A
metadata-evalN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
associate-/r*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
Applied egg-rr32.4%
Taylor expanded in eh around inf
Simplified63.1%
if -5.20000000000000005e-87 < eh < 3.2500000000000001e-37Initial program 99.7%
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fma-defineN/A
fma-lowering-fma.f64N/A
Applied egg-rr99.8%
Taylor expanded in eh around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6473.9%
Simplified73.9%
(FPCore (eh ew t) :precision binary64 (if (<= ew -1.1e+190) (fabs (* t ew)) (if (<= ew 1.05e+204) (fabs eh) (* ew (sin t)))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -1.1e+190) {
tmp = fabs((t * ew));
} else if (ew <= 1.05e+204) {
tmp = fabs(eh);
} else {
tmp = ew * sin(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.1d+190)) then
tmp = abs((t * ew))
else if (ew <= 1.05d+204) then
tmp = abs(eh)
else
tmp = ew * sin(t)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (ew <= -1.1e+190) {
tmp = Math.abs((t * ew));
} else if (ew <= 1.05e+204) {
tmp = Math.abs(eh);
} else {
tmp = ew * Math.sin(t);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if ew <= -1.1e+190: tmp = math.fabs((t * ew)) elif ew <= 1.05e+204: tmp = math.fabs(eh) else: tmp = ew * math.sin(t) return tmp
function code(eh, ew, t) tmp = 0.0 if (ew <= -1.1e+190) tmp = abs(Float64(t * ew)); elseif (ew <= 1.05e+204) tmp = abs(eh); else tmp = Float64(ew * sin(t)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (ew <= -1.1e+190) tmp = abs((t * ew)); elseif (ew <= 1.05e+204) tmp = abs(eh); else tmp = ew * sin(t); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[ew, -1.1e+190], N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 1.05e+204], N[Abs[eh], $MachinePrecision], N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.1 \cdot 10^{+190}:\\
\;\;\;\;\left|t \cdot ew\right|\\
\mathbf{elif}\;ew \leq 1.05 \cdot 10^{+204}:\\
\;\;\;\;\left|eh\right|\\
\mathbf{else}:\\
\;\;\;\;ew \cdot \sin t\\
\end{array}
\end{array}
if ew < -1.1e190Initial program 99.9%
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fma-defineN/A
fma-lowering-fma.f64N/A
Applied egg-rr99.9%
Taylor expanded in eh around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6486.3%
Simplified86.3%
Taylor expanded in t around 0
*-commutativeN/A
*-lowering-*.f6457.6%
Simplified57.6%
if -1.1e190 < ew < 1.05e204Initial 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.f6456.6%
Simplified56.6%
associate-/r*N/A
sin-atanN/A
div-invN/A
metadata-evalN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
associate-/r*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
Applied egg-rr28.5%
Taylor expanded in eh around inf
Simplified56.9%
if 1.05e204 < ew Initial program 99.8%
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fma-defineN/A
fma-lowering-fma.f64N/A
Applied egg-rr99.8%
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
remove-double-divN/A
metadata-evalN/A
Applied egg-rr70.9%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6466.9%
Simplified66.9%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* t ew)))) (if (<= ew -7.5e+188) t_1 (if (<= ew 4.8e+210) (fabs eh) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((t * ew));
double tmp;
if (ew <= -7.5e+188) {
tmp = t_1;
} else if (ew <= 4.8e+210) {
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((t * ew))
if (ew <= (-7.5d+188)) then
tmp = t_1
else if (ew <= 4.8d+210) 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((t * ew));
double tmp;
if (ew <= -7.5e+188) {
tmp = t_1;
} else if (ew <= 4.8e+210) {
tmp = Math.abs(eh);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((t * ew)) tmp = 0 if ew <= -7.5e+188: tmp = t_1 elif ew <= 4.8e+210: tmp = math.fabs(eh) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(t * ew)) tmp = 0.0 if (ew <= -7.5e+188) tmp = t_1; elseif (ew <= 4.8e+210) tmp = abs(eh); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((t * ew)); tmp = 0.0; if (ew <= -7.5e+188) tmp = t_1; elseif (ew <= 4.8e+210) tmp = abs(eh); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -7.5e+188], t$95$1, If[LessEqual[ew, 4.8e+210], N[Abs[eh], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|t \cdot ew\right|\\
\mathbf{if}\;ew \leq -7.5 \cdot 10^{+188}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 4.8 \cdot 10^{+210}:\\
\;\;\;\;\left|eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -7.4999999999999996e188 or 4.79999999999999977e210 < ew Initial program 99.8%
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fma-defineN/A
fma-lowering-fma.f64N/A
Applied egg-rr99.8%
Taylor expanded in eh around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6489.5%
Simplified89.5%
Taylor expanded in t around 0
*-commutativeN/A
*-lowering-*.f6459.8%
Simplified59.8%
if -7.4999999999999996e188 < ew < 4.79999999999999977e210Initial 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.f6456.5%
Simplified56.5%
associate-/r*N/A
sin-atanN/A
div-invN/A
metadata-evalN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
associate-/r*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
Applied egg-rr29.0%
Taylor expanded in eh around inf
Simplified56.8%
(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.f6447.0%
Simplified47.0%
associate-/r*N/A
sin-atanN/A
div-invN/A
metadata-evalN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f64N/A
hypot-undefineN/A
hypot-lowering-hypot.f64N/A
associate-/r*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
Applied egg-rr25.3%
Taylor expanded in eh around inf
Simplified47.4%
herbie shell --seed 2024152
(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))))))))