
(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 10 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 (* eh (tan t))))
(fabs
(fma
(/ (cos t) (sqrt (+ 1.0 (pow (/ t_1 ew) 2.0))))
ew
(* eh (* (sin (atan (/ t_1 (- ew)))) (- (sin t))))))))
double code(double eh, double ew, double t) {
double t_1 = eh * tan(t);
return fabs(fma((cos(t) / sqrt((1.0 + pow((t_1 / ew), 2.0)))), ew, (eh * (sin(atan((t_1 / -ew))) * -sin(t)))));
}
function code(eh, ew, t) t_1 = Float64(eh * tan(t)) return abs(fma(Float64(cos(t) / sqrt(Float64(1.0 + (Float64(t_1 / ew) ^ 2.0)))), ew, Float64(eh * Float64(sin(atan(Float64(t_1 / Float64(-ew)))) * Float64(-sin(t)))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[Cos[t], $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[N[(t$95$1 / ew), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * ew + N[(eh * N[(N[Sin[N[ArcTan[N[(t$95$1 / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * (-N[Sin[t], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \tan t\\
\left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + {\left(\frac{t\_1}{ew}\right)}^{2}}}, ew, eh \cdot \left(\sin \tan^{-1} \left(\frac{t\_1}{-ew}\right) \cdot \left(-\sin t\right)\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
sub-negN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.8%
/-lowering-/.f64N/A
cos-lowering-cos.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrtN/A
+-lowering-+.f64N/A
unpow2N/A
distribute-frac-neg2N/A
distribute-frac-neg2N/A
sqr-negN/A
pow2N/A
pow-lowering-pow.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 (* (cos t) ew)) (t_2 (atan (/ (* eh (tan t)) (- ew)))))
(if (<= (- (* t_1 (cos t_2)) (* (* eh (sin t)) (sin t_2))) -2e-254)
(fabs ew)
t_1)))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * ew;
double t_2 = atan(((eh * tan(t)) / -ew));
double tmp;
if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= -2e-254) {
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) :: t_2
real(8) :: tmp
t_1 = cos(t) * ew
t_2 = atan(((eh * tan(t)) / -ew))
if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= (-2d-254)) 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.cos(t) * ew;
double t_2 = Math.atan(((eh * Math.tan(t)) / -ew));
double tmp;
if (((t_1 * Math.cos(t_2)) - ((eh * Math.sin(t)) * Math.sin(t_2))) <= -2e-254) {
tmp = Math.abs(ew);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.cos(t) * ew t_2 = math.atan(((eh * math.tan(t)) / -ew)) tmp = 0 if ((t_1 * math.cos(t_2)) - ((eh * math.sin(t)) * math.sin(t_2))) <= -2e-254: tmp = math.fabs(ew) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = Float64(cos(t) * ew) t_2 = atan(Float64(Float64(eh * tan(t)) / Float64(-ew))) tmp = 0.0 if (Float64(Float64(t_1 * cos(t_2)) - Float64(Float64(eh * sin(t)) * sin(t_2))) <= -2e-254) tmp = abs(ew); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = cos(t) * ew; t_2 = atan(((eh * tan(t)) / -ew)); tmp = 0.0; if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= -2e-254) tmp = abs(ew); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-254], N[Abs[ew], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot ew\\
t_2 := \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\\
\mathbf{if}\;t\_1 \cdot \cos t\_2 - \left(eh \cdot \sin t\right) \cdot \sin t\_2 \leq -2 \cdot 10^{-254}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew))))) < -1.9999999999999998e-254Initial program 99.8%
sub-negN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified39.0%
if -1.9999999999999998e-254 < (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew))))) Initial program 99.9%
Applied egg-rr72.8%
Taylor expanded in ew around inf
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6463.2
Simplified63.2%
inv-powN/A
*-commutativeN/A
sqr-powN/A
fabs-sqrN/A
sqr-powN/A
inv-powN/A
clear-numN/A
/-rgt-identityN/A
*-lowering-*.f64N/A
cos-lowering-cos.f6463.3
Applied egg-rr63.3%
Final simplification51.1%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* (- eh) (sin t)) (sin (atan (/ (* eh (tan t)) (- ew)))) (* (cos t) ew))))
double code(double eh, double ew, double t) {
return fabs(fma((-eh * sin(t)), sin(atan(((eh * tan(t)) / -ew))), (cos(t) * ew)));
}
function code(eh, ew, t) return abs(fma(Float64(Float64(-eh) * sin(t)), sin(atan(Float64(Float64(eh * tan(t)) / Float64(-ew)))), Float64(cos(t) * ew))) end
code[eh_, ew_, t_] := N[Abs[N[(N[((-eh) * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\left(-eh\right) \cdot \sin t, \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right), \cos t \cdot ew\right)\right|
\end{array}
Initial program 99.8%
sub-negN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.8%
/-lowering-/.f64N/A
cos-lowering-cos.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrtN/A
+-lowering-+.f64N/A
unpow2N/A
distribute-frac-neg2N/A
distribute-frac-neg2N/A
sqr-negN/A
pow2N/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f6499.8
Applied egg-rr99.8%
Taylor expanded in eh around 0
mul-1-negN/A
associate-*r*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
Simplified99.1%
Final simplification99.1%
(FPCore (eh ew t) :precision binary64 (fabs (fma (cos t) ew (* eh (* (sin (atan (/ (* eh (tan t)) (- ew)))) (- (sin t)))))))
double code(double eh, double ew, double t) {
return fabs(fma(cos(t), ew, (eh * (sin(atan(((eh * tan(t)) / -ew))) * -sin(t)))));
}
function code(eh, ew, t) return abs(fma(cos(t), ew, Float64(eh * Float64(sin(atan(Float64(Float64(eh * tan(t)) / Float64(-ew)))) * Float64(-sin(t)))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[Cos[t], $MachinePrecision] * ew + N[(eh * N[(N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * (-N[Sin[t], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\cos t, ew, eh \cdot \left(\sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right) \cdot \left(-\sin t\right)\right)\right)\right|
\end{array}
Initial program 99.8%
sub-negN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.8%
Taylor expanded in eh around 0
cos-lowering-cos.f6499.1
Simplified99.1%
Final simplification99.1%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (cos t) ew)))) (if (<= ew -3.8e-100) t_1 (if (<= ew 4.2e-21) (fabs (* eh (sin t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((cos(t) * ew));
double tmp;
if (ew <= -3.8e-100) {
tmp = t_1;
} else if (ew <= 4.2e-21) {
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((cos(t) * ew))
if (ew <= (-3.8d-100)) then
tmp = t_1
else if (ew <= 4.2d-21) 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((Math.cos(t) * ew));
double tmp;
if (ew <= -3.8e-100) {
tmp = t_1;
} else if (ew <= 4.2e-21) {
tmp = Math.abs((eh * Math.sin(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((math.cos(t) * ew)) tmp = 0 if ew <= -3.8e-100: tmp = t_1 elif ew <= 4.2e-21: tmp = math.fabs((eh * math.sin(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(cos(t) * ew)) tmp = 0.0 if (ew <= -3.8e-100) tmp = t_1; elseif (ew <= 4.2e-21) tmp = abs(Float64(eh * sin(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((cos(t) * ew)); tmp = 0.0; if (ew <= -3.8e-100) tmp = t_1; elseif (ew <= 4.2e-21) 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[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -3.8e-100], t$95$1, If[LessEqual[ew, 4.2e-21], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\cos t \cdot ew\right|\\
\mathbf{if}\;ew \leq -3.8 \cdot 10^{-100}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 4.2 \cdot 10^{-21}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -3.79999999999999997e-100 or 4.20000000000000025e-21 < ew Initial program 99.8%
sub-negN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.8%
Taylor expanded in eh around 0
*-lowering-*.f64N/A
cos-lowering-cos.f6486.3
Simplified86.3%
if -3.79999999999999997e-100 < ew < 4.20000000000000025e-21Initial program 99.9%
sub-negN/A
+-commutativeN/A
distribute-lft-neg-inN/A
sin-atanN/A
div-invN/A
associate-/l*N/A
associate-*r*N/A
Applied egg-rr41.5%
Taylor expanded in eh around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6474.7
Simplified74.7%
Final simplification81.7%
(FPCore (eh ew t) :precision binary64 (if (<= ew -4.5e-100) (fabs ew) (if (<= ew 5.7e-21) (fabs (* eh (sin t))) (* (cos t) ew))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -4.5e-100) {
tmp = fabs(ew);
} else if (ew <= 5.7e-21) {
tmp = fabs((eh * sin(t)));
} else {
tmp = cos(t) * ew;
}
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.5d-100)) then
tmp = abs(ew)
else if (ew <= 5.7d-21) then
tmp = abs((eh * sin(t)))
else
tmp = cos(t) * ew
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (ew <= -4.5e-100) {
tmp = Math.abs(ew);
} else if (ew <= 5.7e-21) {
tmp = Math.abs((eh * Math.sin(t)));
} else {
tmp = Math.cos(t) * ew;
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if ew <= -4.5e-100: tmp = math.fabs(ew) elif ew <= 5.7e-21: tmp = math.fabs((eh * math.sin(t))) else: tmp = math.cos(t) * ew return tmp
function code(eh, ew, t) tmp = 0.0 if (ew <= -4.5e-100) tmp = abs(ew); elseif (ew <= 5.7e-21) tmp = abs(Float64(eh * sin(t))); else tmp = Float64(cos(t) * ew); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (ew <= -4.5e-100) tmp = abs(ew); elseif (ew <= 5.7e-21) tmp = abs((eh * sin(t))); else tmp = cos(t) * ew; end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[ew, -4.5e-100], N[Abs[ew], $MachinePrecision], If[LessEqual[ew, 5.7e-21], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -4.5 \cdot 10^{-100}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{elif}\;ew \leq 5.7 \cdot 10^{-21}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\cos t \cdot ew\\
\end{array}
\end{array}
if ew < -4.5000000000000001e-100Initial program 99.7%
sub-negN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified49.1%
if -4.5000000000000001e-100 < ew < 5.6999999999999996e-21Initial program 99.9%
sub-negN/A
+-commutativeN/A
distribute-lft-neg-inN/A
sin-atanN/A
div-invN/A
associate-/l*N/A
associate-*r*N/A
Applied egg-rr41.5%
Taylor expanded in eh around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6474.7
Simplified74.7%
if 5.6999999999999996e-21 < ew Initial program 99.9%
Applied egg-rr92.8%
Taylor expanded in ew around inf
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6489.5
Simplified89.5%
inv-powN/A
*-commutativeN/A
sqr-powN/A
fabs-sqrN/A
sqr-powN/A
inv-powN/A
clear-numN/A
/-rgt-identityN/A
*-lowering-*.f64N/A
cos-lowering-cos.f6461.9
Applied egg-rr61.9%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (* eh (sin t)))) (if (<= eh -1.05e+98) t_1 (if (<= eh 6.3e+180) (fabs ew) t_1))))
double code(double eh, double ew, double t) {
double t_1 = eh * sin(t);
double tmp;
if (eh <= -1.05e+98) {
tmp = t_1;
} else if (eh <= 6.3e+180) {
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 = eh * sin(t)
if (eh <= (-1.05d+98)) then
tmp = t_1
else if (eh <= 6.3d+180) 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 = eh * Math.sin(t);
double tmp;
if (eh <= -1.05e+98) {
tmp = t_1;
} else if (eh <= 6.3e+180) {
tmp = Math.abs(ew);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = eh * math.sin(t) tmp = 0 if eh <= -1.05e+98: tmp = t_1 elif eh <= 6.3e+180: tmp = math.fabs(ew) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = Float64(eh * sin(t)) tmp = 0.0 if (eh <= -1.05e+98) tmp = t_1; elseif (eh <= 6.3e+180) tmp = abs(ew); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh * sin(t); tmp = 0.0; if (eh <= -1.05e+98) tmp = t_1; elseif (eh <= 6.3e+180) tmp = abs(ew); else tmp = 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, -1.05e+98], t$95$1, If[LessEqual[eh, 6.3e+180], N[Abs[ew], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \sin t\\
\mathbf{if}\;eh \leq -1.05 \cdot 10^{+98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 6.3 \cdot 10^{+180}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -1.05000000000000002e98 or 6.2999999999999999e180 < eh Initial program 99.8%
Applied egg-rr40.6%
inv-powN/A
sqr-powN/A
fabs-sqrN/A
sqr-powN/A
Applied egg-rr18.2%
Taylor expanded in eh around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6449.2
Simplified49.2%
if -1.05000000000000002e98 < eh < 6.2999999999999999e180Initial program 99.9%
sub-negN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified47.9%
(FPCore (eh ew t) :precision binary64 (if (<= ew -4.9e-114) (fabs ew) (if (<= ew 1.6e-218) (/ 1.0 (fabs (/ 1.0 (* t eh)))) ew)))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -4.9e-114) {
tmp = fabs(ew);
} else if (ew <= 1.6e-218) {
tmp = 1.0 / fabs((1.0 / (t * eh)));
} else {
tmp = ew;
}
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.9d-114)) then
tmp = abs(ew)
else if (ew <= 1.6d-218) then
tmp = 1.0d0 / abs((1.0d0 / (t * eh)))
else
tmp = ew
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (ew <= -4.9e-114) {
tmp = Math.abs(ew);
} else if (ew <= 1.6e-218) {
tmp = 1.0 / Math.abs((1.0 / (t * eh)));
} else {
tmp = ew;
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if ew <= -4.9e-114: tmp = math.fabs(ew) elif ew <= 1.6e-218: tmp = 1.0 / math.fabs((1.0 / (t * eh))) else: tmp = ew return tmp
function code(eh, ew, t) tmp = 0.0 if (ew <= -4.9e-114) tmp = abs(ew); elseif (ew <= 1.6e-218) tmp = Float64(1.0 / abs(Float64(1.0 / Float64(t * eh)))); else tmp = ew; end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (ew <= -4.9e-114) tmp = abs(ew); elseif (ew <= 1.6e-218) tmp = 1.0 / abs((1.0 / (t * eh))); else tmp = ew; end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[ew, -4.9e-114], N[Abs[ew], $MachinePrecision], If[LessEqual[ew, 1.6e-218], N[(1.0 / N[Abs[N[(1.0 / N[(t * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], ew]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -4.9 \cdot 10^{-114}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{elif}\;ew \leq 1.6 \cdot 10^{-218}:\\
\;\;\;\;\frac{1}{\left|\frac{1}{t \cdot eh}\right|}\\
\mathbf{else}:\\
\;\;\;\;ew\\
\end{array}
\end{array}
if ew < -4.8999999999999997e-114Initial program 99.8%
sub-negN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified48.7%
if -4.8999999999999997e-114 < ew < 1.6000000000000001e-218Initial program 100.0%
Applied egg-rr35.1%
Taylor expanded in ew around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6479.4
Simplified79.4%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6447.2
Simplified47.2%
if 1.6000000000000001e-218 < ew Initial program 99.8%
Applied egg-rr85.0%
inv-powN/A
sqr-powN/A
fabs-sqrN/A
sqr-powN/A
Applied egg-rr58.3%
Taylor expanded in t around 0
Simplified47.3%
(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%
sub-negN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.8%
Taylor expanded in t around 0
Simplified40.6%
(FPCore (eh ew t) :precision binary64 ew)
double code(double eh, double ew, double t) {
return ew;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = ew
end function
public static double code(double eh, double ew, double t) {
return ew;
}
def code(eh, ew, t): return ew
function code(eh, ew, t) return ew end
function tmp = code(eh, ew, t) tmp = ew; end
code[eh_, ew_, t_] := ew
\begin{array}{l}
\\
ew
\end{array}
Initial program 99.8%
Applied egg-rr75.4%
inv-powN/A
sqr-powN/A
fabs-sqrN/A
sqr-powN/A
Applied egg-rr37.2%
Taylor expanded in t around 0
Simplified22.9%
herbie shell --seed 2024205
(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)))))))