
(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
(/ ew (sqrt (+ (pow t_1 2.0) 1.0)))
(cos t)
(* eh (* (sin (atan t_1)) (- (sin t))))))))
double code(double eh, double ew, double t) {
double t_1 = (eh * tan(t)) / -ew;
return fabs(fma((ew / sqrt((pow(t_1, 2.0) + 1.0))), cos(t), (eh * (sin(atan(t_1)) * -sin(t)))));
}
function code(eh, ew, t) t_1 = Float64(Float64(eh * tan(t)) / Float64(-ew)) return abs(fma(Float64(ew / sqrt(Float64((t_1 ^ 2.0) + 1.0))), cos(t), Float64(eh * Float64(sin(atan(t_1)) * Float64(-sin(t)))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]}, N[Abs[N[(N[(ew / N[Sqrt[N[(N[Power[t$95$1, 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[t], $MachinePrecision] + N[(eh * N[(N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision] * (-N[Sin[t], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh \cdot \tan t}{-ew}\\
\left|\mathsf{fma}\left(\frac{ew}{\sqrt{{t\_1}^{2} + 1}}, \cos t, eh \cdot \left(\sin \tan^{-1} t\_1 \cdot \left(-\sin t\right)\right)\right)\right|
\end{array}
\end{array}
Initial program 99.9%
sub-negN/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (eh ew t) :precision binary64 (fabs (fma (/ (cos t) (sqrt (+ (pow (* (tan t) (/ eh ew)) 2.0) 1.0))) ew (- (* eh (sin t))))))
double code(double eh, double ew, double t) {
return fabs(fma((cos(t) / sqrt((pow((tan(t) * (eh / ew)), 2.0) + 1.0))), ew, -(eh * sin(t))));
}
function code(eh, ew, t) return abs(fma(Float64(cos(t) / sqrt(Float64((Float64(tan(t) * Float64(eh / ew)) ^ 2.0) + 1.0))), ew, Float64(-Float64(eh * sin(t))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Cos[t], $MachinePrecision] / N[Sqrt[N[(N[Power[N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * ew + (-N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{{\left(\tan t \cdot \frac{eh}{ew}\right)}^{2} + 1}}, ew, -eh \cdot \sin t\right)\right|
\end{array}
Initial program 99.9%
sub-negN/A
+-commutativeN/A
Applied egg-rr81.5%
Taylor expanded in eh around -inf
cos-lowering-cos.f6498.4
Simplified98.4%
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr98.4%
Taylor expanded in t around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6498.5
Simplified98.5%
Final simplification98.5%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* (tan t) (- eh)) (cos t) (* ew (cos t)))))
double code(double eh, double ew, double t) {
return fabs(fma((tan(t) * -eh), cos(t), (ew * cos(t))));
}
function code(eh, ew, t) return abs(fma(Float64(tan(t) * Float64(-eh)), cos(t), Float64(ew * cos(t)))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Tan[t], $MachinePrecision] * (-eh)), $MachinePrecision] * N[Cos[t], $MachinePrecision] + N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\tan t \cdot \left(-eh\right), \cos t, ew \cdot \cos t\right)\right|
\end{array}
Initial program 99.9%
sub-negN/A
+-commutativeN/A
Applied egg-rr81.5%
Taylor expanded in eh around -inf
cos-lowering-cos.f6498.4
Simplified98.4%
Taylor expanded in eh around 0
Simplified98.1%
Final simplification98.1%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (fma (* (tan t) (- eh)) (cos t) ew)))) (if (<= eh -9500000.0) t_1 (if (<= eh 3.3e-85) (fabs (* ew (cos t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs(fma((tan(t) * -eh), cos(t), ew));
double tmp;
if (eh <= -9500000.0) {
tmp = t_1;
} else if (eh <= 3.3e-85) {
tmp = fabs((ew * cos(t)));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(fma(Float64(tan(t) * Float64(-eh)), cos(t), ew)) tmp = 0.0 if (eh <= -9500000.0) tmp = t_1; elseif (eh <= 3.3e-85) tmp = abs(Float64(ew * cos(t))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(N[Tan[t], $MachinePrecision] * (-eh)), $MachinePrecision] * N[Cos[t], $MachinePrecision] + ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -9500000.0], t$95$1, If[LessEqual[eh, 3.3e-85], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\mathsf{fma}\left(\tan t \cdot \left(-eh\right), \cos t, ew\right)\right|\\
\mathbf{if}\;eh \leq -9500000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 3.3 \cdot 10^{-85}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -9.5e6 or 3.29999999999999973e-85 < eh Initial program 99.8%
sub-negN/A
+-commutativeN/A
Applied egg-rr67.5%
Taylor expanded in eh around -inf
cos-lowering-cos.f6497.8
Simplified97.8%
Taylor expanded in t around 0
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
/-lowering-/.f64N/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
neg-lowering-neg.f6492.0
Simplified92.0%
Taylor expanded in t around 0
Simplified87.3%
if -9.5e6 < eh < 3.29999999999999973e-85Initial program 99.9%
sub-negN/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.9%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6491.8
Simplified91.8%
Final simplification89.3%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* ew (cos t)))))
(if (<= t -7.4e+118)
(fabs (* eh (sin t)))
(if (<= t -0.00017) t_1 (if (<= t 0.0062) (fabs (- (* eh t) ew)) t_1)))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * cos(t)));
double tmp;
if (t <= -7.4e+118) {
tmp = fabs((eh * sin(t)));
} else if (t <= -0.00017) {
tmp = t_1;
} else if (t <= 0.0062) {
tmp = fabs(((eh * 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((ew * cos(t)))
if (t <= (-7.4d+118)) then
tmp = abs((eh * sin(t)))
else if (t <= (-0.00017d0)) then
tmp = t_1
else if (t <= 0.0062d0) then
tmp = abs(((eh * 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((ew * Math.cos(t)));
double tmp;
if (t <= -7.4e+118) {
tmp = Math.abs((eh * Math.sin(t)));
} else if (t <= -0.00017) {
tmp = t_1;
} else if (t <= 0.0062) {
tmp = Math.abs(((eh * t) - ew));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((ew * math.cos(t))) tmp = 0 if t <= -7.4e+118: tmp = math.fabs((eh * math.sin(t))) elif t <= -0.00017: tmp = t_1 elif t <= 0.0062: tmp = math.fabs(((eh * t) - ew)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(ew * cos(t))) tmp = 0.0 if (t <= -7.4e+118) tmp = abs(Float64(eh * sin(t))); elseif (t <= -0.00017) tmp = t_1; elseif (t <= 0.0062) tmp = abs(Float64(Float64(eh * t) - ew)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((ew * cos(t))); tmp = 0.0; if (t <= -7.4e+118) tmp = abs((eh * sin(t))); elseif (t <= -0.00017) tmp = t_1; elseif (t <= 0.0062) tmp = abs(((eh * t) - ew)); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -7.4e+118], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, -0.00017], t$95$1, If[LessEqual[t, 0.0062], N[Abs[N[(N[(eh * t), $MachinePrecision] - ew), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \cos t\right|\\
\mathbf{if}\;t \leq -7.4 \cdot 10^{+118}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\mathbf{elif}\;t \leq -0.00017:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 0.0062:\\
\;\;\;\;\left|eh \cdot t - ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.39999999999999973e118Initial program 99.9%
sub-negN/A
+-commutativeN/A
Applied egg-rr55.5%
Taylor expanded in eh around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6465.8
Simplified65.8%
if -7.39999999999999973e118 < t < -1.7e-4 or 0.00619999999999999978 < t Initial program 99.7%
sub-negN/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.7%
Taylor expanded in ew around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6464.0
Simplified64.0%
if -1.7e-4 < t < 0.00619999999999999978Initial program 100.0%
sub-negN/A
+-commutativeN/A
Applied egg-rr90.0%
Taylor expanded in eh around -inf
cos-lowering-cos.f6498.9
Simplified98.9%
Taylor expanded in t around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6498.3
Simplified98.3%
Final simplification81.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* eh (sin t)))))
(if (<= t -48000000.0)
t_1
(if (<= t 1.75e-18) (fabs (- (* eh t) ew)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (t <= -48000000.0) {
tmp = t_1;
} else if (t <= 1.75e-18) {
tmp = fabs(((eh * 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 * sin(t)))
if (t <= (-48000000.0d0)) then
tmp = t_1
else if (t <= 1.75d-18) then
tmp = abs(((eh * 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.sin(t)));
double tmp;
if (t <= -48000000.0) {
tmp = t_1;
} else if (t <= 1.75e-18) {
tmp = Math.abs(((eh * t) - ew));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((eh * math.sin(t))) tmp = 0 if t <= -48000000.0: tmp = t_1 elif t <= 1.75e-18: tmp = math.fabs(((eh * t) - ew)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(eh * sin(t))) tmp = 0.0 if (t <= -48000000.0) tmp = t_1; elseif (t <= 1.75e-18) tmp = abs(Float64(Float64(eh * t) - 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 (t <= -48000000.0) tmp = t_1; elseif (t <= 1.75e-18) tmp = abs(((eh * t) - 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[t, -48000000.0], t$95$1, If[LessEqual[t, 1.75e-18], N[Abs[N[(N[(eh * t), $MachinePrecision] - ew), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;t \leq -48000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{-18}:\\
\;\;\;\;\left|eh \cdot t - ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.8e7 or 1.7499999999999999e-18 < t Initial program 99.7%
sub-negN/A
+-commutativeN/A
Applied egg-rr72.7%
Taylor expanded in eh around inf
*-lowering-*.f64N/A
sin-lowering-sin.f6447.6
Simplified47.6%
if -4.8e7 < t < 1.7499999999999999e-18Initial program 100.0%
sub-negN/A
+-commutativeN/A
Applied egg-rr90.6%
Taylor expanded in eh around -inf
cos-lowering-cos.f6499.6
Simplified99.6%
Taylor expanded in t around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6498.3
Simplified98.3%
Final simplification72.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (cos t))))
(if (<= t -3.1e+25)
t_1
(if (<= t 6600000000.0) (fabs (- (* eh t) ew)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
double tmp;
if (t <= -3.1e+25) {
tmp = t_1;
} else if (t <= 6600000000.0) {
tmp = fabs(((eh * 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 = ew * cos(t)
if (t <= (-3.1d+25)) then
tmp = t_1
else if (t <= 6600000000.0d0) then
tmp = abs(((eh * 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 = ew * Math.cos(t);
double tmp;
if (t <= -3.1e+25) {
tmp = t_1;
} else if (t <= 6600000000.0) {
tmp = Math.abs(((eh * t) - ew));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.cos(t) tmp = 0 if t <= -3.1e+25: tmp = t_1 elif t <= 6600000000.0: tmp = math.fabs(((eh * t) - ew)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) tmp = 0.0 if (t <= -3.1e+25) tmp = t_1; elseif (t <= 6600000000.0) tmp = abs(Float64(Float64(eh * t) - ew)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * cos(t); tmp = 0.0; if (t <= -3.1e+25) tmp = t_1; elseif (t <= 6600000000.0) tmp = abs(((eh * t) - ew)); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.1e+25], t$95$1, If[LessEqual[t, 6600000000.0], N[Abs[N[(N[(eh * t), $MachinePrecision] - ew), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
\mathbf{if}\;t \leq -3.1 \cdot 10^{+25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6600000000:\\
\;\;\;\;\left|eh \cdot t - ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.0999999999999998e25 or 6.6e9 < t Initial program 99.8%
Applied egg-rr67.6%
Taylor expanded in ew around inf
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6457.0
Simplified57.0%
inv-powN/A
sqr-powN/A
fabs-sqrN/A
sqr-powN/A
inv-powN/A
clear-numN/A
/-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f6426.6
Applied egg-rr26.6%
if -3.0999999999999998e25 < t < 6.6e9Initial program 100.0%
sub-negN/A
+-commutativeN/A
Applied egg-rr90.1%
Taylor expanded in eh around -inf
cos-lowering-cos.f6499.0
Simplified99.0%
Taylor expanded in t around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6491.7
Simplified91.7%
Final simplification62.2%
(FPCore (eh ew t) :precision binary64 (if (<= eh 4.2e+177) (fabs ew) (fabs (* eh t))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= 4.2e+177) {
tmp = fabs(ew);
} else {
tmp = fabs((eh * t));
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: tmp
if (eh <= 4.2d+177) then
tmp = abs(ew)
else
tmp = abs((eh * t))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (eh <= 4.2e+177) {
tmp = Math.abs(ew);
} else {
tmp = Math.abs((eh * t));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= 4.2e+177: tmp = math.fabs(ew) else: tmp = math.fabs((eh * t)) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= 4.2e+177) tmp = abs(ew); else tmp = abs(Float64(eh * t)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (eh <= 4.2e+177) tmp = abs(ew); else tmp = abs((eh * t)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, 4.2e+177], N[Abs[ew], $MachinePrecision], N[Abs[N[(eh * t), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq 4.2 \cdot 10^{+177}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot t\right|\\
\end{array}
\end{array}
if eh < 4.20000000000000026e177Initial program 99.9%
sub-negN/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.9%
Taylor expanded in t around 0
Simplified44.4%
if 4.20000000000000026e177 < eh Initial program 99.8%
sub-negN/A
+-commutativeN/A
Applied egg-rr56.2%
Taylor expanded in eh around -inf
cos-lowering-cos.f6496.9
Simplified96.9%
Taylor expanded in t around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6465.1
Simplified65.1%
Taylor expanded in ew around 0
mul-1-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f6448.2
Simplified48.2%
Final simplification44.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* eh t) ew)))
double code(double eh, double ew, double t) {
return fabs(((eh * t) - 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(((eh * t) - ew))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((eh * t) - ew));
}
def code(eh, ew, t): return math.fabs(((eh * t) - ew))
function code(eh, ew, t) return abs(Float64(Float64(eh * t) - ew)) end
function tmp = code(eh, ew, t) tmp = abs(((eh * t) - ew)); end
code[eh_, ew_, t_] := N[Abs[N[(N[(eh * t), $MachinePrecision] - ew), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|eh \cdot t - ew\right|
\end{array}
Initial program 99.9%
sub-negN/A
+-commutativeN/A
Applied egg-rr81.5%
Taylor expanded in eh around -inf
cos-lowering-cos.f6498.4
Simplified98.4%
Taylor expanded in t around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6455.3
Simplified55.3%
Final simplification55.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.9%
sub-negN/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.9%
Taylor expanded in t around 0
Simplified42.2%
herbie shell --seed 2024204
(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)))))))