
(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 8 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
(-
(* (* eh (sin t)) (sin (atan (/ t_1 (- 0.0 ew)))))
(* (* ew (cos (atan (/ t_1 ew)))) (cos t))))))
double code(double eh, double ew, double t) {
double t_1 = eh * tan(t);
return fabs((((eh * sin(t)) * sin(atan((t_1 / (0.0 - ew))))) - ((ew * cos(atan((t_1 / ew)))) * cos(t))));
}
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 = eh * tan(t)
code = abs((((eh * sin(t)) * sin(atan((t_1 / (0.0d0 - ew))))) - ((ew * cos(atan((t_1 / ew)))) * cos(t))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = eh * Math.tan(t);
return Math.abs((((eh * Math.sin(t)) * Math.sin(Math.atan((t_1 / (0.0 - ew))))) - ((ew * Math.cos(Math.atan((t_1 / ew)))) * Math.cos(t))));
}
def code(eh, ew, t): t_1 = eh * math.tan(t) return math.fabs((((eh * math.sin(t)) * math.sin(math.atan((t_1 / (0.0 - ew))))) - ((ew * math.cos(math.atan((t_1 / ew)))) * math.cos(t))))
function code(eh, ew, t) t_1 = Float64(eh * tan(t)) return abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(t_1 / Float64(0.0 - ew))))) - Float64(Float64(ew * cos(atan(Float64(t_1 / ew)))) * cos(t)))) end
function tmp = code(eh, ew, t) t_1 = eh * tan(t); tmp = abs((((eh * sin(t)) * sin(atan((t_1 / (0.0 - ew))))) - ((ew * cos(atan((t_1 / ew)))) * cos(t)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(t$95$1 / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(ew * N[Cos[N[ArcTan[N[(t$95$1 / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \tan t\\
\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{t\_1}{0 - ew}\right) - \left(ew \cdot \cos \tan^{-1} \left(\frac{t\_1}{ew}\right)\right) \cdot \cos t\right|
\end{array}
\end{array}
Initial program 99.8%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* eh (sin t)) (* (* ew (cos t)) (cos (atan (* eh (/ (tan t) ew))))))))
double code(double eh, double ew, double t) {
return fabs(((eh * sin(t)) + ((ew * cos(t)) * cos(atan((eh * (tan(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 * sin(t)) + ((ew * cos(t)) * cos(atan((eh * (tan(t) / ew)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((eh * Math.sin(t)) + ((ew * Math.cos(t)) * Math.cos(Math.atan((eh * (Math.tan(t) / ew)))))));
}
def code(eh, ew, t): return math.fabs(((eh * math.sin(t)) + ((ew * math.cos(t)) * math.cos(math.atan((eh * (math.tan(t) / ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(eh * sin(t)) + Float64(Float64(ew * cos(t)) * cos(atan(Float64(eh * Float64(tan(t) / ew))))))) end
function tmp = code(eh, ew, t) tmp = abs(((eh * sin(t)) + ((ew * cos(t)) * cos(atan((eh * (tan(t) / ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|eh \cdot \sin t + \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)\right|
\end{array}
Initial program 99.8%
Applied egg-rr66.1%
Applied egg-rr82.2%
Taylor expanded in ew around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
Simplified98.2%
Taylor expanded in eh around 0
fabs-negN/A
fabs-lowering-fabs.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
cos-lowering-cos.f64N/A
atan-lowering-atan.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6498.2
Simplified98.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* eh (sin t)))))
(if (<= eh -1.45e+162)
t_1
(if (<= eh 6.5e+72)
(fabs (* (cos (atan (/ (* eh (tan t)) 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 <= -1.45e+162) {
tmp = t_1;
} else if (eh <= 6.5e+72) {
tmp = fabs((cos(atan(((eh * tan(t)) / ew))) * (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.45d+162)) then
tmp = t_1
else if (eh <= 6.5d+72) then
tmp = abs((cos(atan(((eh * tan(t)) / ew))) * (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.45e+162) {
tmp = t_1;
} else if (eh <= 6.5e+72) {
tmp = Math.abs((Math.cos(Math.atan(((eh * Math.tan(t)) / ew))) * (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.45e+162: tmp = t_1 elif eh <= 6.5e+72: tmp = math.fabs((math.cos(math.atan(((eh * math.tan(t)) / ew))) * (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.45e+162) tmp = t_1; elseif (eh <= 6.5e+72) tmp = abs(Float64(cos(atan(Float64(Float64(eh * tan(t)) / ew))) * 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.45e+162) tmp = t_1; elseif (eh <= 6.5e+72) tmp = abs((cos(atan(((eh * tan(t)) / ew))) * (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.45e+162], t$95$1, If[LessEqual[eh, 6.5e+72], N[Abs[N[(N[Cos[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $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 -1.45 \cdot 10^{+162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 6.5 \cdot 10^{+72}:\\
\;\;\;\;\left|\cos \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right) \cdot \left(ew \cdot \cos t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -1.45000000000000003e162 or 6.5000000000000001e72 < eh Initial program 99.8%
Applied egg-rr31.2%
Applied egg-rr51.5%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
sin-lowering-sin.f6476.6
Simplified76.6%
if -1.45000000000000003e162 < eh < 6.5000000000000001e72Initial program 99.9%
--lowering--.f64N/A
Applied egg-rr99.9%
Taylor expanded in ew around inf
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
cos-lowering-cos.f64N/A
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f6477.0
Simplified77.0%
Final simplification76.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* eh (sin t)))))
(if (<= t -0.00066)
t_1
(if (<= t 1480.0)
(fabs (+ (* eh t) (* ew (cos (atan (* eh (/ (tan t) ew)))))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (t <= -0.00066) {
tmp = t_1;
} else if (t <= 1480.0) {
tmp = fabs(((eh * t) + (ew * cos(atan((eh * (tan(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 <= (-0.00066d0)) then
tmp = t_1
else if (t <= 1480.0d0) then
tmp = abs(((eh * t) + (ew * cos(atan((eh * (tan(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 <= -0.00066) {
tmp = t_1;
} else if (t <= 1480.0) {
tmp = Math.abs(((eh * t) + (ew * Math.cos(Math.atan((eh * (Math.tan(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 <= -0.00066: tmp = t_1 elif t <= 1480.0: tmp = math.fabs(((eh * t) + (ew * math.cos(math.atan((eh * (math.tan(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 <= -0.00066) tmp = t_1; elseif (t <= 1480.0) tmp = abs(Float64(Float64(eh * t) + Float64(ew * cos(atan(Float64(eh * Float64(tan(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 <= -0.00066) tmp = t_1; elseif (t <= 1480.0) tmp = abs(((eh * t) + (ew * cos(atan((eh * (tan(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, -0.00066], t$95$1, If[LessEqual[t, 1480.0], N[Abs[N[(N[(eh * t), $MachinePrecision] + N[(ew * N[Cos[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $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}\;t \leq -0.00066:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1480:\\
\;\;\;\;\left|eh \cdot t + ew \cdot \cos \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.6e-4 or 1480 < t Initial program 99.7%
Applied egg-rr58.4%
Applied egg-rr75.4%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
sin-lowering-sin.f6449.5
Simplified49.5%
if -6.6e-4 < t < 1480Initial program 100.0%
Applied egg-rr73.3%
Applied egg-rr88.7%
Taylor expanded in ew around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
Simplified98.8%
Taylor expanded in t around 0
--lowering--.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
atan-lowering-atan.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
tan-lowering-tan.f6498.0
Simplified98.0%
Final simplification74.3%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* eh (sin t))))) (if (<= t -8e-9) t_1 (if (<= t 6.8e-50) (fabs ew) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (t <= -8e-9) {
tmp = t_1;
} else if (t <= 6.8e-50) {
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 (t <= (-8d-9)) then
tmp = t_1
else if (t <= 6.8d-50) 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 (t <= -8e-9) {
tmp = t_1;
} else if (t <= 6.8e-50) {
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 t <= -8e-9: tmp = t_1 elif t <= 6.8e-50: 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 (t <= -8e-9) tmp = t_1; elseif (t <= 6.8e-50) 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 (t <= -8e-9) tmp = t_1; elseif (t <= 6.8e-50) 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[t, -8e-9], t$95$1, If[LessEqual[t, 6.8e-50], N[Abs[ew], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;t \leq -8 \cdot 10^{-9}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6.8 \cdot 10^{-50}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -8.0000000000000005e-9 or 6.80000000000000029e-50 < t Initial program 99.7%
Applied egg-rr57.3%
Applied egg-rr73.6%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
sin-lowering-sin.f6450.4
Simplified50.4%
if -8.0000000000000005e-9 < t < 6.80000000000000029e-50Initial program 100.0%
Taylor expanded in t around 0
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
atan-lowering-atan.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6472.9
Simplified72.9%
flip3--N/A
associate-/r/N/A
metadata-evalN/A
+-lft-identityN/A
distribute-rgt-outN/A
+-commutativeN/A
+-lft-identityN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f64N/A
metadata-evalN/A
--lowering--.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6425.2
Applied egg-rr25.2%
Applied egg-rr72.7%
Taylor expanded in ew around inf
Simplified73.1%
(FPCore (eh ew t) :precision binary64 (if (<= eh -1.05e+163) (* eh (sin t)) (if (<= eh 2.5e+162) (fabs ew) (fabs (* eh t)))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -1.05e+163) {
tmp = eh * sin(t);
} else if (eh <= 2.5e+162) {
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 <= (-1.05d+163)) then
tmp = eh * sin(t)
else if (eh <= 2.5d+162) 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 <= -1.05e+163) {
tmp = eh * Math.sin(t);
} else if (eh <= 2.5e+162) {
tmp = Math.abs(ew);
} else {
tmp = Math.abs((eh * t));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= -1.05e+163: tmp = eh * math.sin(t) elif eh <= 2.5e+162: tmp = math.fabs(ew) else: tmp = math.fabs((eh * t)) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= -1.05e+163) tmp = Float64(eh * sin(t)); elseif (eh <= 2.5e+162) 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 <= -1.05e+163) tmp = eh * sin(t); elseif (eh <= 2.5e+162) tmp = abs(ew); else tmp = abs((eh * t)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, -1.05e+163], N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision], If[LessEqual[eh, 2.5e+162], N[Abs[ew], $MachinePrecision], N[Abs[N[(eh * t), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.05 \cdot 10^{+163}:\\
\;\;\;\;eh \cdot \sin t\\
\mathbf{elif}\;eh \leq 2.5 \cdot 10^{+162}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot t\right|\\
\end{array}
\end{array}
if eh < -1.05e163Initial program 99.8%
Applied egg-rr28.8%
Applied egg-rr37.0%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
sin-lowering-sin.f6479.8
Simplified79.8%
neg-fabsN/A
sub0-negN/A
flip3--N/A
fabs-divN/A
Applied egg-rr50.9%
if -1.05e163 < eh < 2.4999999999999998e162Initial program 99.9%
Taylor expanded in t around 0
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
atan-lowering-atan.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6449.9
Simplified49.9%
flip3--N/A
associate-/r/N/A
metadata-evalN/A
+-lft-identityN/A
distribute-rgt-outN/A
+-commutativeN/A
+-lft-identityN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f64N/A
metadata-evalN/A
--lowering--.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6419.7
Applied egg-rr19.7%
Applied egg-rr49.7%
Taylor expanded in ew around inf
Simplified50.0%
if 2.4999999999999998e162 < eh Initial program 99.8%
Applied egg-rr24.9%
Applied egg-rr56.9%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
sin-lowering-sin.f6483.6
Simplified83.6%
Taylor expanded in t around 0
*-lowering-*.f6458.0
Simplified58.0%
Final simplification51.1%
(FPCore (eh ew t) :precision binary64 (if (<= eh 1.35e+161) (fabs ew) (fabs (* eh t))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= 1.35e+161) {
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 <= 1.35d+161) 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 <= 1.35e+161) {
tmp = Math.abs(ew);
} else {
tmp = Math.abs((eh * t));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= 1.35e+161: tmp = math.fabs(ew) else: tmp = math.fabs((eh * t)) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= 1.35e+161) 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 <= 1.35e+161) tmp = abs(ew); else tmp = abs((eh * t)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, 1.35e+161], N[Abs[ew], $MachinePrecision], N[Abs[N[(eh * t), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq 1.35 \cdot 10^{+161}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot t\right|\\
\end{array}
\end{array}
if eh < 1.3499999999999999e161Initial program 99.8%
Taylor expanded in t around 0
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
atan-lowering-atan.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6446.3
Simplified46.3%
flip3--N/A
associate-/r/N/A
metadata-evalN/A
+-lft-identityN/A
distribute-rgt-outN/A
+-commutativeN/A
+-lft-identityN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f64N/A
metadata-evalN/A
--lowering--.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6418.0
Applied egg-rr18.0%
Applied egg-rr46.0%
Taylor expanded in ew around inf
Simplified46.5%
if 1.3499999999999999e161 < eh Initial program 99.8%
Applied egg-rr24.9%
Applied egg-rr56.9%
Taylor expanded in eh around -inf
*-lowering-*.f64N/A
sin-lowering-sin.f6483.6
Simplified83.6%
Taylor expanded in t around 0
*-lowering-*.f6458.0
Simplified58.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%
Taylor expanded in t around 0
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
atan-lowering-atan.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6442.3
Simplified42.3%
flip3--N/A
associate-/r/N/A
metadata-evalN/A
+-lft-identityN/A
distribute-rgt-outN/A
+-commutativeN/A
+-lft-identityN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
tan-lowering-tan.f64N/A
metadata-evalN/A
--lowering--.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6416.1
Applied egg-rr16.1%
Applied egg-rr42.0%
Taylor expanded in ew around inf
Simplified42.5%
herbie shell --seed 2024191
(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)))))))