
(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 9 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 (fabs (+ (* (* ew (sin t)) (/ 1.0 (hypot 1.0 (/ eh (* ew (tan t)))))) (* (* eh (cos t)) (sin (atan (* (/ eh ew) (/ 1.0 (tan t)))))))))
double code(double eh, double ew, double t) {
return fabs((((ew * sin(t)) * (1.0 / hypot(1.0, (eh / (ew * tan(t)))))) + ((eh * cos(t)) * sin(atan(((eh / ew) * (1.0 / tan(t))))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((ew * Math.sin(t)) * (1.0 / Math.hypot(1.0, (eh / (ew * Math.tan(t)))))) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) * (1.0 / Math.tan(t))))))));
}
def code(eh, ew, t): return math.fabs((((ew * math.sin(t)) * (1.0 / math.hypot(1.0, (eh / (ew * math.tan(t)))))) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) * (1.0 / math.tan(t))))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * sin(t)) * Float64(1.0 / hypot(1.0, Float64(eh / Float64(ew * tan(t)))))) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) * Float64(1.0 / tan(t)))))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * sin(t)) * (1.0 / hypot(1.0, (eh / (ew * tan(t)))))) + ((eh * cos(t)) * sin(atan(((eh / ew) * (1.0 / tan(t)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] * N[(1.0 / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(ew \cdot \sin t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew} \cdot \frac{1}{\tan t}\right)\right|
\end{array}
Initial program 99.8%
associate-/r*99.8%
cos-atan99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
div-inv99.8%
Applied egg-rr99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* ew (sin t)) (/ 1.0 (hypot 1.0 (/ eh (* ew (tan t)))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs((((ew * sin(t)) * (1.0 / hypot(1.0, (eh / (ew * tan(t)))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((ew * Math.sin(t)) * (1.0 / Math.hypot(1.0, (eh / (ew * Math.tan(t)))))) + ((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)) * (1.0 / math.hypot(1.0, (eh / (ew * math.tan(t)))))) + ((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)) * Float64(1.0 / hypot(1.0, Float64(eh / Float64(ew * tan(t)))))) + 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)) * (1.0 / hypot(1.0, (eh / (ew * tan(t)))))) + ((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[(1.0 / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $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 \frac{1}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\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%
associate-/r*99.8%
cos-atan99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
(FPCore (eh ew t) :precision binary64 (fabs (fma ew (* (sin t) (/ 1.0 (hypot 1.0 (/ (/ eh ew) (tan t))))) (* eh (cos t)))))
double code(double eh, double ew, double t) {
return fabs(fma(ew, (sin(t) * (1.0 / hypot(1.0, ((eh / ew) / tan(t))))), (eh * cos(t))));
}
function code(eh, ew, t) return abs(fma(ew, Float64(sin(t) * Float64(1.0 / hypot(1.0, Float64(Float64(eh / ew) / tan(t))))), Float64(eh * cos(t)))) end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[(N[Sin[t], $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(ew, \sin t \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}, eh \cdot \cos t\right)\right|
\end{array}
Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan57.5%
associate-*r/54.3%
hypot-1-def61.3%
Applied egg-rr61.3%
Taylor expanded in eh around inf 97.8%
cos-atan97.8%
hypot-1-def97.8%
associate-/r*97.8%
Applied egg-rr97.8%
(FPCore (eh ew t) :precision binary64 (fabs (fma ew (* (sin t) (cos (atan (/ eh (* ew t))))) (* (cos t) (- eh)))))
double code(double eh, double ew, double t) {
return fabs(fma(ew, (sin(t) * cos(atan((eh / (ew * t))))), (cos(t) * -eh)));
}
function code(eh, ew, t) return abs(fma(ew, Float64(sin(t) * cos(atan(Float64(eh / Float64(ew * t))))), Float64(cos(t) * Float64(-eh)))) end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[(N[Sin[t], $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[t], $MachinePrecision] * (-eh)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right), \cos t \cdot \left(-eh\right)\right)\right|
\end{array}
Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan57.5%
associate-*r/54.3%
hypot-1-def61.3%
Applied egg-rr61.3%
Taylor expanded in t around 0 59.2%
*-commutative59.2%
Simplified59.2%
Taylor expanded in eh around -inf 97.2%
associate-*r*97.2%
neg-mul-197.2%
Simplified97.2%
Final simplification97.2%
(FPCore (eh ew t) :precision binary64 (fabs (fma ew (sin t) (* eh (cos t)))))
double code(double eh, double ew, double t) {
return fabs(fma(ew, sin(t), (eh * cos(t))));
}
function code(eh, ew, t) return abs(fma(ew, sin(t), Float64(eh * cos(t)))) end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[Sin[t], $MachinePrecision] + N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(ew, \sin t, eh \cdot \cos t\right)\right|
\end{array}
Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan57.5%
associate-*r/54.3%
hypot-1-def61.3%
Applied egg-rr61.3%
Taylor expanded in eh around inf 97.8%
cos-atan97.8%
hypot-1-def97.8%
associate-/r*97.8%
Applied egg-rr97.8%
Taylor expanded in eh around 0 97.2%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -8e-55) (not (<= t 1.45e-46))) (fabs (* ew (sin t))) (fabs eh)))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -8e-55) || !(t <= 1.45e-46)) {
tmp = fabs((ew * sin(t)));
} 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 ((t <= (-8d-55)) .or. (.not. (t <= 1.45d-46))) then
tmp = abs((ew * sin(t)))
else
tmp = abs(eh)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -8e-55) || !(t <= 1.45e-46)) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = Math.abs(eh);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -8e-55) or not (t <= 1.45e-46): tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs(eh) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -8e-55) || !(t <= 1.45e-46)) tmp = abs(Float64(ew * sin(t))); else tmp = abs(eh); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -8e-55) || ~((t <= 1.45e-46))) tmp = abs((ew * sin(t))); else tmp = abs(eh); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -8e-55], N[Not[LessEqual[t, 1.45e-46]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[eh], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{-55} \lor \neg \left(t \leq 1.45 \cdot 10^{-46}\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh\right|\\
\end{array}
\end{array}
if t < -7.99999999999999996e-55 or 1.45000000000000002e-46 < t Initial program 99.7%
associate-*l*99.7%
fma-define99.7%
associate-/r*99.7%
associate-*l*99.7%
associate-/r*99.7%
Simplified99.7%
associate-*r*99.7%
sin-atan68.0%
associate-*r/63.7%
hypot-1-def68.5%
Applied egg-rr68.5%
Taylor expanded in t around 0 61.7%
associate-/r*61.7%
cos-atan61.7%
hypot-1-def61.7%
div-inv61.7%
associate-/r*61.7%
Applied egg-rr61.7%
Taylor expanded in ew around inf 48.0%
if -7.99999999999999996e-55 < t < 1.45000000000000002e-46Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
associate-/r*100.0%
associate-*l*100.0%
associate-/r*100.0%
Simplified100.0%
associate-*r*100.0%
sin-atan43.9%
associate-*r/42.0%
hypot-1-def51.9%
Applied egg-rr51.9%
Taylor expanded in t around 0 99.3%
Taylor expanded in t around 0 99.3%
associate-/r*99.3%
Simplified99.3%
Taylor expanded in ew around 0 77.9%
Final simplification61.0%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (sin t)) eh)))
double code(double eh, double ew, double t) {
return fabs(((ew * sin(t)) + 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(((ew * sin(t)) + eh))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.sin(t)) + eh));
}
def code(eh, ew, t): return math.fabs(((ew * math.sin(t)) + eh))
function code(eh, ew, t) return abs(Float64(Float64(ew * sin(t)) + eh)) end
function tmp = code(eh, ew, t) tmp = abs(((ew * sin(t)) + eh)); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \sin t + eh\right|
\end{array}
Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan57.5%
associate-*r/54.3%
hypot-1-def61.3%
Applied egg-rr61.3%
Taylor expanded in t around 0 78.0%
associate-/r*78.0%
cos-atan78.0%
hypot-1-def78.0%
div-inv78.0%
associate-/r*78.0%
Applied egg-rr78.0%
Taylor expanded in eh around 0 78.0%
Final simplification78.0%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -4.2e-126) (not (<= eh 4.6e-208))) (fabs eh) (fabs (* ew t))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -4.2e-126) || !(eh <= 4.6e-208)) {
tmp = fabs(eh);
} else {
tmp = fabs((ew * 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-126)) .or. (.not. (eh <= 4.6d-208))) then
tmp = abs(eh)
else
tmp = abs((ew * t))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -4.2e-126) || !(eh <= 4.6e-208)) {
tmp = Math.abs(eh);
} else {
tmp = Math.abs((ew * t));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -4.2e-126) or not (eh <= 4.6e-208): tmp = math.fabs(eh) else: tmp = math.fabs((ew * t)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -4.2e-126) || !(eh <= 4.6e-208)) tmp = abs(eh); else tmp = abs(Float64(ew * t)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -4.2e-126) || ~((eh <= 4.6e-208))) tmp = abs(eh); else tmp = abs((ew * t)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -4.2e-126], N[Not[LessEqual[eh, 4.6e-208]], $MachinePrecision]], N[Abs[eh], $MachinePrecision], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -4.2 \cdot 10^{-126} \lor \neg \left(eh \leq 4.6 \cdot 10^{-208}\right):\\
\;\;\;\;\left|eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot t\right|\\
\end{array}
\end{array}
if eh < -4.1999999999999997e-126 or 4.59999999999999993e-208 < eh Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan47.7%
associate-*r/43.5%
hypot-1-def52.0%
Applied egg-rr52.0%
Taylor expanded in t around 0 73.7%
Taylor expanded in t around 0 58.2%
associate-/r*58.2%
Simplified58.2%
Taylor expanded in ew around 0 53.3%
if -4.1999999999999997e-126 < eh < 4.59999999999999993e-208Initial program 99.9%
associate-*l*99.9%
fma-define99.9%
associate-/r*99.9%
associate-*l*99.9%
associate-/r*99.9%
Simplified99.9%
associate-*r*99.9%
sin-atan92.8%
associate-*r/92.8%
hypot-1-def94.5%
Applied egg-rr94.5%
Taylor expanded in t around 0 93.6%
associate-/r*93.6%
cos-atan93.6%
hypot-1-def93.6%
div-inv93.6%
associate-/r*93.6%
Applied egg-rr93.6%
Taylor expanded in ew around inf 85.3%
Taylor expanded in t around 0 44.8%
Final simplification51.4%
(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%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan57.5%
associate-*r/54.3%
hypot-1-def61.3%
Applied egg-rr61.3%
Taylor expanded in t around 0 78.0%
Taylor expanded in t around 0 56.9%
associate-/r*56.9%
Simplified56.9%
Taylor expanded in ew around 0 44.7%
herbie shell --seed 2024107
(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))))))))