
(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 8 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(eh / Float64(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[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $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{eh}{ew \cdot \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.9%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (sin t) (/ ew (hypot 1.0 (/ eh (* ew (tan t)))))) (* (* (cos t) eh) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs(((sin(t) * (ew / hypot(1.0, (eh / (ew * tan(t)))))) + ((cos(t) * eh) * sin(atan(((eh / ew) / tan(t)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.sin(t) * (ew / Math.hypot(1.0, (eh / (ew * Math.tan(t)))))) + ((Math.cos(t) * eh) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t): return math.fabs(((math.sin(t) * (ew / math.hypot(1.0, (eh / (ew * math.tan(t)))))) + ((math.cos(t) * eh) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(Float64(sin(t) * Float64(ew / hypot(1.0, Float64(eh / Float64(ew * tan(t)))))) + Float64(Float64(cos(t) * eh) * sin(atan(Float64(Float64(eh / ew) / tan(t))))))) end
function tmp = code(eh, ew, t) tmp = abs(((sin(t) * (ew / hypot(1.0, (eh / (ew * tan(t)))))) + ((cos(t) * eh) * sin(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[(ew / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin t \cdot \frac{ew}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)} + \left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\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
associate-/l/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
tan-lowering-tan.f64N/A
sin-lowering-sin.f6499.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (sin t)) (* (sin (atan (/ eh (* ew (tan t))))) (* (cos t) eh)))))
double code(double eh, double ew, double t) {
return fabs(((ew * sin(t)) + (sin(atan((eh / (ew * tan(t))))) * (cos(t) * 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(((ew * sin(t)) + (sin(atan((eh / (ew * tan(t))))) * (cos(t) * eh))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.sin(t)) + (Math.sin(Math.atan((eh / (ew * Math.tan(t))))) * (Math.cos(t) * eh))));
}
def code(eh, ew, t): return math.fabs(((ew * math.sin(t)) + (math.sin(math.atan((eh / (ew * math.tan(t))))) * (math.cos(t) * eh))))
function code(eh, ew, t) return abs(Float64(Float64(ew * sin(t)) + Float64(sin(atan(Float64(eh / Float64(ew * tan(t))))) * Float64(cos(t) * eh)))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * sin(t)) + (sin(atan((eh / (ew * tan(t))))) * (cos(t) * eh)))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \sin t + \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot \left(\cos t \cdot eh\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.9%
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.0%
Simplified98.0%
Final simplification98.0%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (cos t) eh))
(t_2
(fabs
(/
(+ (* ew (sin t)) (/ t_1 (/ (* t ew) eh)))
(hypot 1.0 (/ eh (* t ew)))))))
(if (<= ew -1.15e+74)
t_2
(if (<= ew 2.9e-16)
(fabs (- (* (* ew ew) (* (/ (pow (sin t) 2.0) t_1) -0.5)) t_1))
t_2))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * eh;
double t_2 = fabs((((ew * sin(t)) + (t_1 / ((t * ew) / eh))) / hypot(1.0, (eh / (t * ew)))));
double tmp;
if (ew <= -1.15e+74) {
tmp = t_2;
} else if (ew <= 2.9e-16) {
tmp = fabs((((ew * ew) * ((pow(sin(t), 2.0) / t_1) * -0.5)) - t_1));
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double t_1 = Math.cos(t) * eh;
double t_2 = Math.abs((((ew * Math.sin(t)) + (t_1 / ((t * ew) / eh))) / Math.hypot(1.0, (eh / (t * ew)))));
double tmp;
if (ew <= -1.15e+74) {
tmp = t_2;
} else if (ew <= 2.9e-16) {
tmp = Math.abs((((ew * ew) * ((Math.pow(Math.sin(t), 2.0) / t_1) * -0.5)) - t_1));
} else {
tmp = t_2;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.cos(t) * eh t_2 = math.fabs((((ew * math.sin(t)) + (t_1 / ((t * ew) / eh))) / math.hypot(1.0, (eh / (t * ew))))) tmp = 0 if ew <= -1.15e+74: tmp = t_2 elif ew <= 2.9e-16: tmp = math.fabs((((ew * ew) * ((math.pow(math.sin(t), 2.0) / t_1) * -0.5)) - t_1)) else: tmp = t_2 return tmp
function code(eh, ew, t) t_1 = Float64(cos(t) * eh) t_2 = abs(Float64(Float64(Float64(ew * sin(t)) + Float64(t_1 / Float64(Float64(t * ew) / eh))) / hypot(1.0, Float64(eh / Float64(t * ew))))) tmp = 0.0 if (ew <= -1.15e+74) tmp = t_2; elseif (ew <= 2.9e-16) tmp = abs(Float64(Float64(Float64(ew * ew) * Float64(Float64((sin(t) ^ 2.0) / t_1) * -0.5)) - t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = cos(t) * eh; t_2 = abs((((ew * sin(t)) + (t_1 / ((t * ew) / eh))) / hypot(1.0, (eh / (t * ew))))); tmp = 0.0; if (ew <= -1.15e+74) tmp = t_2; elseif (ew <= 2.9e-16) tmp = abs((((ew * ew) * (((sin(t) ^ 2.0) / t_1) * -0.5)) - t_1)); else tmp = t_2; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 / N[(N[(t * ew), $MachinePrecision] / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -1.15e+74], t$95$2, If[LessEqual[ew, 2.9e-16], N[Abs[N[(N[(N[(ew * ew), $MachinePrecision] * N[(N[(N[Power[N[Sin[t], $MachinePrecision], 2.0], $MachinePrecision] / t$95$1), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot eh\\
t_2 := \left|\frac{ew \cdot \sin t + \frac{t\_1}{\frac{t \cdot ew}{eh}}}{\mathsf{hypot}\left(1, \frac{eh}{t \cdot ew}\right)}\right|\\
\mathbf{if}\;ew \leq -1.15 \cdot 10^{+74}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;ew \leq 2.9 \cdot 10^{-16}:\\
\;\;\;\;\left|\left(ew \cdot ew\right) \cdot \left(\frac{{\sin t}^{2}}{t\_1} \cdot -0.5\right) - t\_1\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if ew < -1.1499999999999999e74 or 2.8999999999999998e-16 < ew Initial program 99.8%
neg-fabsN/A
fabs-lowering-fabs.f64N/A
distribute-neg-inN/A
unsub-negN/A
cos-atanN/A
un-div-invN/A
distribute-neg-fracN/A
Applied egg-rr85.0%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f6480.8%
Simplified80.8%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f6481.2%
Simplified81.2%
if -1.1499999999999999e74 < ew < 2.8999999999999998e-16Initial program 99.9%
neg-fabsN/A
fabs-lowering-fabs.f64N/A
distribute-neg-inN/A
unsub-negN/A
cos-atanN/A
un-div-invN/A
distribute-neg-fracN/A
Applied egg-rr52.2%
Taylor expanded in ew around 0
/-lowering-/.f64N/A
--lowering--.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f6443.8%
Simplified43.8%
Taylor expanded in ew around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
Simplified84.9%
Final simplification83.3%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (cos t) eh)) (t_2 (fabs t_1)))
(if (<= eh -1.05e+36)
t_2
(if (<= eh 5.2e-26)
(fabs
(/
(+ (* ew (sin t)) (/ t_1 (/ (* t ew) eh)))
(hypot 1.0 (/ eh (* t ew)))))
t_2))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * eh;
double t_2 = fabs(t_1);
double tmp;
if (eh <= -1.05e+36) {
tmp = t_2;
} else if (eh <= 5.2e-26) {
tmp = fabs((((ew * sin(t)) + (t_1 / ((t * ew) / eh))) / hypot(1.0, (eh / (t * ew)))));
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double t_1 = Math.cos(t) * eh;
double t_2 = Math.abs(t_1);
double tmp;
if (eh <= -1.05e+36) {
tmp = t_2;
} else if (eh <= 5.2e-26) {
tmp = Math.abs((((ew * Math.sin(t)) + (t_1 / ((t * ew) / eh))) / Math.hypot(1.0, (eh / (t * ew)))));
} else {
tmp = t_2;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.cos(t) * eh t_2 = math.fabs(t_1) tmp = 0 if eh <= -1.05e+36: tmp = t_2 elif eh <= 5.2e-26: tmp = math.fabs((((ew * math.sin(t)) + (t_1 / ((t * ew) / eh))) / math.hypot(1.0, (eh / (t * ew))))) else: tmp = t_2 return tmp
function code(eh, ew, t) t_1 = Float64(cos(t) * eh) t_2 = abs(t_1) tmp = 0.0 if (eh <= -1.05e+36) tmp = t_2; elseif (eh <= 5.2e-26) tmp = abs(Float64(Float64(Float64(ew * sin(t)) + Float64(t_1 / Float64(Float64(t * ew) / eh))) / hypot(1.0, Float64(eh / Float64(t * ew))))); else tmp = t_2; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = cos(t) * eh; t_2 = abs(t_1); tmp = 0.0; if (eh <= -1.05e+36) tmp = t_2; elseif (eh <= 5.2e-26) tmp = abs((((ew * sin(t)) + (t_1 / ((t * ew) / eh))) / hypot(1.0, (eh / (t * ew))))); else tmp = t_2; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$2 = N[Abs[t$95$1], $MachinePrecision]}, If[LessEqual[eh, -1.05e+36], t$95$2, If[LessEqual[eh, 5.2e-26], N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 / N[(N[(t * ew), $MachinePrecision] / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot eh\\
t_2 := \left|t\_1\right|\\
\mathbf{if}\;eh \leq -1.05 \cdot 10^{+36}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;eh \leq 5.2 \cdot 10^{-26}:\\
\;\;\;\;\left|\frac{ew \cdot \sin t + \frac{t\_1}{\frac{t \cdot ew}{eh}}}{\mathsf{hypot}\left(1, \frac{eh}{t \cdot ew}\right)}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if eh < -1.05000000000000002e36 or 5.2000000000000002e-26 < eh Initial program 99.8%
neg-fabsN/A
fabs-lowering-fabs.f64N/A
distribute-neg-inN/A
unsub-negN/A
cos-atanN/A
un-div-invN/A
distribute-neg-fracN/A
Applied egg-rr41.8%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
cos-lowering-cos.f6485.6%
Simplified85.6%
if -1.05000000000000002e36 < eh < 5.2000000000000002e-26Initial program 99.8%
neg-fabsN/A
fabs-lowering-fabs.f64N/A
distribute-neg-inN/A
unsub-negN/A
cos-atanN/A
un-div-invN/A
distribute-neg-fracN/A
Applied egg-rr89.6%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f6476.4%
Simplified76.4%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f6480.8%
Simplified80.8%
Final simplification83.2%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* ew (sin t))))) (if (<= ew -1.26e+134) t_1 (if (<= ew 5.7e-11) (fabs (* (cos t) eh)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * sin(t)));
double tmp;
if (ew <= -1.26e+134) {
tmp = t_1;
} else if (ew <= 5.7e-11) {
tmp = fabs((cos(t) * 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 * sin(t)))
if (ew <= (-1.26d+134)) then
tmp = t_1
else if (ew <= 5.7d-11) then
tmp = abs((cos(t) * 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 * Math.sin(t)));
double tmp;
if (ew <= -1.26e+134) {
tmp = t_1;
} else if (ew <= 5.7e-11) {
tmp = Math.abs((Math.cos(t) * eh));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((ew * math.sin(t))) tmp = 0 if ew <= -1.26e+134: tmp = t_1 elif ew <= 5.7e-11: tmp = math.fabs((math.cos(t) * eh)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(ew * sin(t))) tmp = 0.0 if (ew <= -1.26e+134) tmp = t_1; elseif (ew <= 5.7e-11) tmp = abs(Float64(cos(t) * eh)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((ew * sin(t))); tmp = 0.0; if (ew <= -1.26e+134) tmp = t_1; elseif (ew <= 5.7e-11) tmp = abs((cos(t) * eh)); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -1.26e+134], t$95$1, If[LessEqual[ew, 5.7e-11], N[Abs[N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \sin t\right|\\
\mathbf{if}\;ew \leq -1.26 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 5.7 \cdot 10^{-11}:\\
\;\;\;\;\left|\cos t \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -1.2600000000000001e134 or 5.6999999999999997e-11 < 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.f6474.5%
Simplified74.5%
if -1.2600000000000001e134 < ew < 5.6999999999999997e-11Initial program 99.8%
neg-fabsN/A
fabs-lowering-fabs.f64N/A
distribute-neg-inN/A
unsub-negN/A
cos-atanN/A
un-div-invN/A
distribute-neg-fracN/A
Applied egg-rr55.0%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
cos-lowering-cos.f6482.3%
Simplified82.3%
Final simplification79.5%
(FPCore (eh ew t) :precision binary64 (fabs (* (cos t) eh)))
double code(double eh, double ew, double t) {
return fabs((cos(t) * 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((cos(t) * eh))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((Math.cos(t) * eh));
}
def code(eh, ew, t): return math.fabs((math.cos(t) * eh))
function code(eh, ew, t) return abs(Float64(cos(t) * eh)) end
function tmp = code(eh, ew, t) tmp = abs((cos(t) * eh)); end
code[eh_, ew_, t_] := N[Abs[N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\cos t \cdot eh\right|
\end{array}
Initial program 99.8%
neg-fabsN/A
fabs-lowering-fabs.f64N/A
distribute-neg-inN/A
unsub-negN/A
cos-atanN/A
un-div-invN/A
distribute-neg-fracN/A
Applied egg-rr66.3%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
cos-lowering-cos.f6463.0%
Simplified63.0%
Final simplification63.0%
(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%
Applied egg-rr53.3%
Taylor expanded in t around 0
Simplified44.5%
herbie shell --seed 2024164
(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))))))))