
(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 (atan (/ eh (* ew (tan t)))))) (fabs (fma (* eh (cos t)) (sin t_1) (* (* ew (sin t)) (cos t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh / (ew * tan(t))));
return fabs(fma((eh * cos(t)), sin(t_1), ((ew * sin(t)) * cos(t_1))));
}
function code(eh, ew, t) t_1 = atan(Float64(eh / Float64(ew * tan(t)))) return abs(fma(Float64(eh * cos(t)), sin(t_1), Float64(Float64(ew * sin(t)) * cos(t_1)))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\
\left|\mathsf{fma}\left(eh \cdot \cos t, \sin t\_1, \left(ew \cdot \sin t\right) \cdot \cos t\_1\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in ew around 0
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Simplified99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t))) (t_2 (atan (/ (/ eh ew) (tan t)))))
(if (<= (fabs (+ (* t_1 (sin t_2)) (* (* ew (sin t)) (cos t_2)))) 1e-165)
(fabs (* ew (fma eh (/ (cos t) ew) (sin t))))
(fabs
(fma
(/ (sin t) (sqrt (fma (* eh eh) (pow (* ew (tan t)) -2.0) 1.0)))
ew
t_1)))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double t_2 = atan(((eh / ew) / tan(t)));
double tmp;
if (fabs(((t_1 * sin(t_2)) + ((ew * sin(t)) * cos(t_2)))) <= 1e-165) {
tmp = fabs((ew * fma(eh, (cos(t) / ew), sin(t))));
} else {
tmp = fabs(fma((sin(t) / sqrt(fma((eh * eh), pow((ew * tan(t)), -2.0), 1.0))), ew, t_1));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) t_2 = atan(Float64(Float64(eh / ew) / tan(t))) tmp = 0.0 if (abs(Float64(Float64(t_1 * sin(t_2)) + Float64(Float64(ew * sin(t)) * cos(t_2)))) <= 1e-165) tmp = abs(Float64(ew * fma(eh, Float64(cos(t) / ew), sin(t)))); else tmp = abs(fma(Float64(sin(t) / sqrt(fma(Float64(eh * eh), (Float64(ew * tan(t)) ^ -2.0), 1.0))), ew, t_1)); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Abs[N[(N[(t$95$1 * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1e-165], N[Abs[N[(ew * N[(eh * N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] + N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] / N[Sqrt[N[(N[(eh * eh), $MachinePrecision] * N[Power[N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * ew + t$95$1), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
t_2 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\mathbf{if}\;\left|t\_1 \cdot \sin t\_2 + \left(ew \cdot \sin t\right) \cdot \cos t\_2\right| \leq 10^{-165}:\\
\;\;\;\;\left|ew \cdot \mathsf{fma}\left(eh, \frac{\cos t}{ew}, \sin t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(\frac{\sin t}{\sqrt{\mathsf{fma}\left(eh \cdot eh, {\left(ew \cdot \tan t\right)}^{-2}, 1\right)}}, ew, t\_1\right)\right|\\
\end{array}
\end{array}
if (fabs.f64 (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))))) < 1e-165Initial program 99.7%
Applied egg-rr0.0%
Taylor expanded in eh around inf
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f640.0
Simplified0.0%
Taylor expanded in ew around inf
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-sin.f6493.6
Simplified93.6%
if 1e-165 < (fabs.f64 (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))))) Initial program 99.8%
Applied egg-rr47.0%
Taylor expanded in eh around inf
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6449.0
Simplified49.0%
Applied egg-rr97.2%
Final simplification96.9%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* ew (sin t)) (cos (atan (/ eh (* t ew))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs((((ew * sin(t)) * cos(atan((eh / (t * ew))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((((ew * sin(t)) * cos(atan((eh / (t * ew))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((ew * Math.sin(t)) * Math.cos(Math.atan((eh / (t * ew))))) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t): return math.fabs((((ew * math.sin(t)) * math.cos(math.atan((eh / (t * ew))))) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(atan(Float64(eh / Float64(t * ew))))) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * sin(t)) * cos(atan((eh / (t * ew))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{t \cdot ew}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.1
Simplified99.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* eh (cos t)))))
(if (<= eh -3.5e+98)
t_1
(if (<= eh 7e+110) (fabs (* ew (fma eh (/ (cos t) ew) (sin t)))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * cos(t)));
double tmp;
if (eh <= -3.5e+98) {
tmp = t_1;
} else if (eh <= 7e+110) {
tmp = fabs((ew * fma(eh, (cos(t) / ew), sin(t))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(eh * cos(t))) tmp = 0.0 if (eh <= -3.5e+98) tmp = t_1; elseif (eh <= 7e+110) tmp = abs(Float64(ew * fma(eh, Float64(cos(t) / ew), sin(t)))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -3.5e+98], t$95$1, If[LessEqual[eh, 7e+110], N[Abs[N[(ew * N[(eh * N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] + N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \cos t\right|\\
\mathbf{if}\;eh \leq -3.5 \cdot 10^{+98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 7 \cdot 10^{+110}:\\
\;\;\;\;\left|ew \cdot \mathsf{fma}\left(eh, \frac{\cos t}{ew}, \sin t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -3.5e98 or 6.9999999999999998e110 < eh Initial program 99.9%
Applied egg-rr4.5%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6494.6
Simplified94.6%
if -3.5e98 < eh < 6.9999999999999998e110Initial program 99.7%
Applied egg-rr62.8%
Taylor expanded in eh around inf
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6464.2
Simplified64.2%
Taylor expanded in ew around inf
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-sin.f6496.4
Simplified96.4%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* eh (cos t))))) (if (<= eh -8.5e-35) t_1 (if (<= eh 2.35e-71) (fabs (* ew (sin t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * cos(t)));
double tmp;
if (eh <= -8.5e-35) {
tmp = t_1;
} else if (eh <= 2.35e-71) {
tmp = fabs((ew * sin(t)));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = abs((eh * cos(t)))
if (eh <= (-8.5d-35)) then
tmp = t_1
else if (eh <= 2.35d-71) then
tmp = abs((ew * sin(t)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs((eh * Math.cos(t)));
double tmp;
if (eh <= -8.5e-35) {
tmp = t_1;
} else if (eh <= 2.35e-71) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((eh * math.cos(t))) tmp = 0 if eh <= -8.5e-35: tmp = t_1 elif eh <= 2.35e-71: tmp = math.fabs((ew * math.sin(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(eh * cos(t))) tmp = 0.0 if (eh <= -8.5e-35) tmp = t_1; elseif (eh <= 2.35e-71) tmp = abs(Float64(ew * sin(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((eh * cos(t))); tmp = 0.0; if (eh <= -8.5e-35) tmp = t_1; elseif (eh <= 2.35e-71) tmp = abs((ew * sin(t))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -8.5e-35], t$95$1, If[LessEqual[eh, 2.35e-71], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \cos t\right|\\
\mathbf{if}\;eh \leq -8.5 \cdot 10^{-35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 2.35 \cdot 10^{-71}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -8.5000000000000001e-35 or 2.34999999999999998e-71 < eh Initial program 99.8%
Applied egg-rr27.3%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6484.7
Simplified84.7%
if -8.5000000000000001e-35 < eh < 2.34999999999999998e-71Initial program 99.8%
Applied egg-rr65.0%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6475.1
Simplified75.1%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* eh (cos t))))) (if (<= eh -6.5e-187) t_1 (if (<= eh 5.8e-147) (fabs (* t ew)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * cos(t)));
double tmp;
if (eh <= -6.5e-187) {
tmp = t_1;
} else if (eh <= 5.8e-147) {
tmp = fabs((t * 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 * cos(t)))
if (eh <= (-6.5d-187)) then
tmp = t_1
else if (eh <= 5.8d-147) then
tmp = abs((t * 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.cos(t)));
double tmp;
if (eh <= -6.5e-187) {
tmp = t_1;
} else if (eh <= 5.8e-147) {
tmp = Math.abs((t * ew));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((eh * math.cos(t))) tmp = 0 if eh <= -6.5e-187: tmp = t_1 elif eh <= 5.8e-147: tmp = math.fabs((t * ew)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(eh * cos(t))) tmp = 0.0 if (eh <= -6.5e-187) tmp = t_1; elseif (eh <= 5.8e-147) tmp = abs(Float64(t * ew)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((eh * cos(t))); tmp = 0.0; if (eh <= -6.5e-187) tmp = t_1; elseif (eh <= 5.8e-147) tmp = abs((t * ew)); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -6.5e-187], t$95$1, If[LessEqual[eh, 5.8e-147], N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \cos t\right|\\
\mathbf{if}\;eh \leq -6.5 \cdot 10^{-187}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 5.8 \cdot 10^{-147}:\\
\;\;\;\;\left|t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -6.49999999999999983e-187 or 5.8000000000000002e-147 < eh Initial program 99.8%
Applied egg-rr38.8%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6471.6
Simplified71.6%
if -6.49999999999999983e-187 < eh < 5.8000000000000002e-147Initial program 99.8%
Applied egg-rr58.8%
Taylor expanded in eh around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-sin.f6480.9
Simplified80.9%
Taylor expanded in t around 0
lower-/.f64N/A
Simplified34.6%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f6453.2
Simplified53.2%
(FPCore (eh ew t) :precision binary64 (if (<= eh -9e-187) (fabs eh) (if (<= eh 1e-146) (fabs (* t ew)) (fabs eh))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -9e-187) {
tmp = fabs(eh);
} else if (eh <= 1e-146) {
tmp = fabs((t * ew));
} 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 <= (-9d-187)) then
tmp = abs(eh)
else if (eh <= 1d-146) then
tmp = abs((t * ew))
else
tmp = abs(eh)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (eh <= -9e-187) {
tmp = Math.abs(eh);
} else if (eh <= 1e-146) {
tmp = Math.abs((t * ew));
} else {
tmp = Math.abs(eh);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= -9e-187: tmp = math.fabs(eh) elif eh <= 1e-146: tmp = math.fabs((t * ew)) else: tmp = math.fabs(eh) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= -9e-187) tmp = abs(eh); elseif (eh <= 1e-146) tmp = abs(Float64(t * ew)); else tmp = abs(eh); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (eh <= -9e-187) tmp = abs(eh); elseif (eh <= 1e-146) tmp = abs((t * ew)); else tmp = abs(eh); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, -9e-187], N[Abs[eh], $MachinePrecision], If[LessEqual[eh, 1e-146], N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision], N[Abs[eh], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -9 \cdot 10^{-187}:\\
\;\;\;\;\left|eh\right|\\
\mathbf{elif}\;eh \leq 10^{-146}:\\
\;\;\;\;\left|t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh\right|\\
\end{array}
\end{array}
if eh < -8.9999999999999996e-187 or 1.00000000000000003e-146 < eh Initial program 99.8%
Applied egg-rr38.8%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6471.6
Simplified71.6%
Taylor expanded in t around 0
Simplified52.8%
*-rgt-identity52.8
Applied egg-rr52.8%
if -8.9999999999999996e-187 < eh < 1.00000000000000003e-146Initial program 99.8%
Applied egg-rr58.8%
Taylor expanded in eh around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-sin.f6480.9
Simplified80.9%
Taylor expanded in t around 0
lower-/.f64N/A
Simplified34.6%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f6453.2
Simplified53.2%
(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-rr42.8%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6461.7
Simplified61.7%
Taylor expanded in t around 0
Simplified45.1%
*-rgt-identity45.1
Applied egg-rr45.1%
herbie shell --seed 2024208
(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))))))))