
(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)) (- ew))))
(fabs
(fma
(* eh (sin t))
(- (sin (atan t_1)))
(/ (* ew (cos t)) (sqrt (+ 1.0 (pow t_1 2.0))))))))
double code(double eh, double ew, double t) {
double t_1 = (eh * tan(t)) / -ew;
return fabs(fma((eh * sin(t)), -sin(atan(t_1)), ((ew * cos(t)) / sqrt((1.0 + pow(t_1, 2.0))))));
}
function code(eh, ew, t) t_1 = Float64(Float64(eh * tan(t)) / Float64(-ew)) return abs(fma(Float64(eh * sin(t)), Float64(-sin(atan(t_1))), Float64(Float64(ew * cos(t)) / sqrt(Float64(1.0 + (t_1 ^ 2.0)))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]}, N[Abs[N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * (-N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]) + N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh \cdot \tan t}{-ew}\\
\left|\mathsf{fma}\left(eh \cdot \sin t, -\sin \tan^{-1} t\_1, \frac{ew \cdot \cos t}{\sqrt{1 + {t\_1}^{2}}}\right)\right|
\end{array}
\end{array}
Initial program 99.8%
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.9%
(FPCore (eh ew t) :precision binary64 (fabs (fma (- (* eh (sin t))) (sin (atan (/ (* eh (tan t)) (- ew)))) (* ew (cos t)))))
double code(double eh, double ew, double t) {
return fabs(fma(-(eh * sin(t)), sin(atan(((eh * tan(t)) / -ew))), (ew * cos(t))));
}
function code(eh, ew, t) return abs(fma(Float64(-Float64(eh * sin(t))), sin(atan(Float64(Float64(eh * tan(t)) / Float64(-ew)))), Float64(ew * cos(t)))) 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[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(-eh \cdot \sin t, \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right), ew \cdot \cos t\right)\right|
\end{array}
Initial program 99.8%
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.9%
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
Simplified97.7%
Final simplification97.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (sin t))) (t_2 (fabs t_1)))
(if (<= eh -3.6e+62)
t_2
(if (<= eh 8e+66)
(fabs (fma (cos t) ew (* (* eh (/ 0.5 ew)) (* t_1 (tan t)))))
(if (<= eh 6e+148)
(fabs (fma (* eh (- t)) (sin (atan (/ (* eh (tan t)) (- ew)))) ew))
t_2)))))
double code(double eh, double ew, double t) {
double t_1 = eh * sin(t);
double t_2 = fabs(t_1);
double tmp;
if (eh <= -3.6e+62) {
tmp = t_2;
} else if (eh <= 8e+66) {
tmp = fabs(fma(cos(t), ew, ((eh * (0.5 / ew)) * (t_1 * tan(t)))));
} else if (eh <= 6e+148) {
tmp = fabs(fma((eh * -t), sin(atan(((eh * tan(t)) / -ew))), ew));
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh * sin(t)) t_2 = abs(t_1) tmp = 0.0 if (eh <= -3.6e+62) tmp = t_2; elseif (eh <= 8e+66) tmp = abs(fma(cos(t), ew, Float64(Float64(eh * Float64(0.5 / ew)) * Float64(t_1 * tan(t))))); elseif (eh <= 6e+148) tmp = abs(fma(Float64(eh * Float64(-t)), sin(atan(Float64(Float64(eh * tan(t)) / Float64(-ew)))), ew)); else tmp = t_2; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[t$95$1], $MachinePrecision]}, If[LessEqual[eh, -3.6e+62], t$95$2, If[LessEqual[eh, 8e+66], N[Abs[N[(N[Cos[t], $MachinePrecision] * ew + N[(N[(eh * N[(0.5 / ew), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 6e+148], N[Abs[N[(N[(eh * (-t)), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + ew), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \sin t\\
t_2 := \left|t\_1\right|\\
\mathbf{if}\;eh \leq -3.6 \cdot 10^{+62}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;eh \leq 8 \cdot 10^{+66}:\\
\;\;\;\;\left|\mathsf{fma}\left(\cos t, ew, \left(eh \cdot \frac{0.5}{ew}\right) \cdot \left(t\_1 \cdot \tan t\right)\right)\right|\\
\mathbf{elif}\;eh \leq 6 \cdot 10^{+148}:\\
\;\;\;\;\left|\mathsf{fma}\left(eh \cdot \left(-t\right), \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right), ew\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if eh < -3.6e62 or 6.00000000000000029e148 < eh Initial program 99.8%
neg-fabsN/A
fabs-lowering-fabs.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
Applied egg-rr47.3%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
sin-lowering-sin.f6477.7
Simplified77.7%
if -3.6e62 < eh < 7.99999999999999956e66Initial program 99.9%
sub-negN/A
+-commutativeN/A
distribute-lft-neg-inN/A
sin-atanN/A
associate-/l*N/A
associate-/l*N/A
associate-*r*N/A
Applied egg-rr91.7%
Taylor expanded in eh around 0
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6486.0
Simplified86.0%
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
cos-lowering-cos.f64N/A
*-commutativeN/A
times-fracN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
associate-/l*N/A
tan-quotN/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
tan-lowering-tan.f6486.0
Applied egg-rr86.0%
accelerator-lowering-fma.f64N/A
cos-lowering-cos.f64N/A
associate-*l*N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6486.0
Applied egg-rr86.0%
if 7.99999999999999956e66 < eh < 6.00000000000000029e148Initial program 99.9%
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.9%
Taylor expanded in t around 0
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
Simplified75.8%
Final simplification82.0%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* eh (sin t)))))
(if (<= eh -1.6e+64)
t_1
(if (<= eh 4.4e+148)
(fabs (fma (* (* eh 0.5) (* (tan t) (/ (sin t) ew))) eh (* ew (cos t))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (eh <= -1.6e+64) {
tmp = t_1;
} else if (eh <= 4.4e+148) {
tmp = fabs(fma(((eh * 0.5) * (tan(t) * (sin(t) / ew))), eh, (ew * cos(t))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(eh * sin(t))) tmp = 0.0 if (eh <= -1.6e+64) tmp = t_1; elseif (eh <= 4.4e+148) tmp = abs(fma(Float64(Float64(eh * 0.5) * Float64(tan(t) * Float64(sin(t) / ew))), eh, Float64(ew * cos(t)))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -1.6e+64], t$95$1, If[LessEqual[eh, 4.4e+148], N[Abs[N[(N[(N[(eh * 0.5), $MachinePrecision] * N[(N[Tan[t], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * eh + N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;eh \leq -1.6 \cdot 10^{+64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 4.4 \cdot 10^{+148}:\\
\;\;\;\;\left|\mathsf{fma}\left(\left(eh \cdot 0.5\right) \cdot \left(\tan t \cdot \frac{\sin t}{ew}\right), eh, ew \cdot \cos t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -1.60000000000000009e64 or 4.3999999999999998e148 < eh Initial program 99.8%
neg-fabsN/A
fabs-lowering-fabs.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
Applied egg-rr47.3%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
sin-lowering-sin.f6477.7
Simplified77.7%
if -1.60000000000000009e64 < eh < 4.3999999999999998e148Initial program 99.9%
sub-negN/A
+-commutativeN/A
distribute-lft-neg-inN/A
sin-atanN/A
associate-/l*N/A
associate-/l*N/A
associate-*r*N/A
Applied egg-rr90.8%
Taylor expanded in eh around 0
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6482.2
Simplified82.2%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-/l*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
tan-quotN/A
*-lowering-*.f64N/A
tan-lowering-tan.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6482.2
Applied egg-rr82.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* eh (sin t)))))
(if (<= eh -1.8e+66)
t_1
(if (<= eh 5e+148)
(fabs (fma (cos t) ew (* (/ 0.5 ew) (* (* eh eh) (* (sin t) (tan t))))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (eh <= -1.8e+66) {
tmp = t_1;
} else if (eh <= 5e+148) {
tmp = fabs(fma(cos(t), ew, ((0.5 / ew) * ((eh * eh) * (sin(t) * tan(t))))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(eh * sin(t))) tmp = 0.0 if (eh <= -1.8e+66) tmp = t_1; elseif (eh <= 5e+148) tmp = abs(fma(cos(t), ew, Float64(Float64(0.5 / ew) * Float64(Float64(eh * eh) * Float64(sin(t) * tan(t)))))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -1.8e+66], t$95$1, If[LessEqual[eh, 5e+148], N[Abs[N[(N[Cos[t], $MachinePrecision] * ew + N[(N[(0.5 / ew), $MachinePrecision] * N[(N[(eh * eh), $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;eh \leq -1.8 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 5 \cdot 10^{+148}:\\
\;\;\;\;\left|\mathsf{fma}\left(\cos t, ew, \frac{0.5}{ew} \cdot \left(\left(eh \cdot eh\right) \cdot \left(\sin t \cdot \tan t\right)\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -1.8e66 or 5.00000000000000024e148 < eh Initial program 99.8%
neg-fabsN/A
fabs-lowering-fabs.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
Applied egg-rr47.3%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
sin-lowering-sin.f6477.7
Simplified77.7%
if -1.8e66 < eh < 5.00000000000000024e148Initial program 99.9%
sub-negN/A
+-commutativeN/A
distribute-lft-neg-inN/A
sin-atanN/A
associate-/l*N/A
associate-/l*N/A
associate-*r*N/A
Applied egg-rr90.8%
Taylor expanded in eh around 0
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6482.2
Simplified82.2%
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
cos-lowering-cos.f64N/A
*-commutativeN/A
times-fracN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
associate-/l*N/A
tan-quotN/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
tan-lowering-tan.f6482.2
Applied egg-rr82.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* eh (sin t)))))
(if (<= eh -3.3e+64)
t_1
(if (<= eh 4.4e+148)
(fabs (fma (* eh eh) (/ (* 0.5 (pow (sin t) 2.0)) ew) (* ew (cos t))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (eh <= -3.3e+64) {
tmp = t_1;
} else if (eh <= 4.4e+148) {
tmp = fabs(fma((eh * eh), ((0.5 * pow(sin(t), 2.0)) / ew), (ew * cos(t))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(eh * sin(t))) tmp = 0.0 if (eh <= -3.3e+64) tmp = t_1; elseif (eh <= 4.4e+148) tmp = abs(fma(Float64(eh * eh), Float64(Float64(0.5 * (sin(t) ^ 2.0)) / ew), Float64(ew * cos(t)))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -3.3e+64], t$95$1, If[LessEqual[eh, 4.4e+148], N[Abs[N[(N[(eh * eh), $MachinePrecision] * N[(N[(0.5 * N[Power[N[Sin[t], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] + N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;eh \leq -3.3 \cdot 10^{+64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 4.4 \cdot 10^{+148}:\\
\;\;\;\;\left|\mathsf{fma}\left(eh \cdot eh, \frac{0.5 \cdot {\sin t}^{2}}{ew}, ew \cdot \cos t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -3.29999999999999988e64 or 4.3999999999999998e148 < eh Initial program 99.8%
neg-fabsN/A
fabs-lowering-fabs.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
Applied egg-rr47.3%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
sin-lowering-sin.f6477.7
Simplified77.7%
if -3.29999999999999988e64 < eh < 4.3999999999999998e148Initial program 99.9%
sub-negN/A
+-commutativeN/A
distribute-lft-neg-inN/A
sin-atanN/A
associate-/l*N/A
associate-/l*N/A
associate-*r*N/A
Applied egg-rr90.8%
Taylor expanded in eh around 0
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6482.2
Simplified82.2%
Taylor expanded in t around 0
Simplified82.1%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* eh (sin t))))) (if (<= eh -1.12e+61) t_1 (if (<= eh 4.4e+148) (fabs (* ew (cos t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (eh <= -1.12e+61) {
tmp = t_1;
} else if (eh <= 4.4e+148) {
tmp = fabs((ew * 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((eh * sin(t)))
if (eh <= (-1.12d+61)) then
tmp = t_1
else if (eh <= 4.4d+148) then
tmp = abs((ew * 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((eh * Math.sin(t)));
double tmp;
if (eh <= -1.12e+61) {
tmp = t_1;
} else if (eh <= 4.4e+148) {
tmp = Math.abs((ew * Math.cos(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((eh * math.sin(t))) tmp = 0 if eh <= -1.12e+61: tmp = t_1 elif eh <= 4.4e+148: tmp = math.fabs((ew * math.cos(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(eh * sin(t))) tmp = 0.0 if (eh <= -1.12e+61) tmp = t_1; elseif (eh <= 4.4e+148) tmp = abs(Float64(ew * cos(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((eh * sin(t))); tmp = 0.0; if (eh <= -1.12e+61) tmp = t_1; elseif (eh <= 4.4e+148) tmp = abs((ew * cos(t))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -1.12e+61], t$95$1, If[LessEqual[eh, 4.4e+148], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;eh \leq -1.12 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 4.4 \cdot 10^{+148}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -1.12e61 or 4.3999999999999998e148 < eh Initial program 99.8%
neg-fabsN/A
fabs-lowering-fabs.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
Applied egg-rr47.3%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
sin-lowering-sin.f6477.7
Simplified77.7%
if -1.12e61 < eh < 4.3999999999999998e148Initial program 99.9%
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.9%
Taylor expanded in eh around 0
*-lowering-*.f64N/A
cos-lowering-cos.f6482.1
Simplified82.1%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* eh (sin t))))) (if (<= eh -7.6e+53) t_1 (if (<= eh 5.2e+60) (fabs ew) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (eh <= -7.6e+53) {
tmp = t_1;
} else if (eh <= 5.2e+60) {
tmp = fabs(ew);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = abs((eh * sin(t)))
if (eh <= (-7.6d+53)) then
tmp = t_1
else if (eh <= 5.2d+60) then
tmp = abs(ew)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs((eh * Math.sin(t)));
double tmp;
if (eh <= -7.6e+53) {
tmp = t_1;
} else if (eh <= 5.2e+60) {
tmp = Math.abs(ew);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((eh * math.sin(t))) tmp = 0 if eh <= -7.6e+53: tmp = t_1 elif eh <= 5.2e+60: tmp = math.fabs(ew) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(eh * sin(t))) tmp = 0.0 if (eh <= -7.6e+53) tmp = t_1; elseif (eh <= 5.2e+60) tmp = abs(ew); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((eh * sin(t))); tmp = 0.0; if (eh <= -7.6e+53) tmp = t_1; elseif (eh <= 5.2e+60) tmp = abs(ew); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -7.6e+53], t$95$1, If[LessEqual[eh, 5.2e+60], N[Abs[ew], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;eh \leq -7.6 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 5.2 \cdot 10^{+60}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -7.59999999999999995e53 or 5.20000000000000016e60 < eh Initial program 99.8%
neg-fabsN/A
fabs-lowering-fabs.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
Applied egg-rr54.3%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
sin-lowering-sin.f6472.1
Simplified72.1%
if -7.59999999999999995e53 < eh < 5.20000000000000016e60Initial program 99.9%
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.9%
Taylor expanded in t around 0
Simplified59.0%
(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
+-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.9%
Taylor expanded in t around 0
Simplified41.2%
(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%
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.9%
Taylor expanded in t around 0
Simplified41.2%
neg-fabsN/A
neg-sub0N/A
flip--N/A
fabs-divN/A
/-lowering-/.f64N/A
fabs-lowering-fabs.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
fabs-lowering-fabs.f64N/A
+-lowering-+.f6425.2
Applied egg-rr25.2%
div-fabsN/A
metadata-evalN/A
flip--N/A
neg-sub0N/A
neg-fabsN/A
+-lft-identityN/A
flip3-+N/A
fabs-divN/A
metadata-evalN/A
+-lft-identityN/A
sqr-powN/A
fabs-sqrN/A
sqr-powN/A
metadata-evalN/A
+-lft-identityN/A
mul0-lftN/A
--rgt-identityN/A
fabs-sqrN/A
pow2N/A
pow-divN/A
metadata-evalN/A
unpow120.6
Applied egg-rr20.6%
herbie shell --seed 2024198
(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)))))))