
(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 (fabs (+ (* (sin t) (/ ew (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(((sin(t) * (ew / 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(((Math.sin(t) * (ew / 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(((math.sin(t) * (ew / 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(sin(t) * Float64(ew / hypot(1.0, Float64(Float64(eh / ew) / tan(t))))) + Float64(eh * Float64(cos(t) * sin(atan(Float64(eh / Float64(ew * tan(t))))))))) end
function tmp = code(eh, ew, t) tmp = abs(((sin(t) * (ew / 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[Sin[t], $MachinePrecision] * N[(ew / N[Sqrt[1.0 ^ 2 + N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin t \cdot \frac{ew}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)} + eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right|
\end{array}
Initial program 99.7%
associate-/r*99.7%
cos-atan99.7%
un-div-inv99.7%
hypot-1-def99.7%
associate-/r*99.7%
Applied egg-rr99.7%
*-commutative99.7%
associate-/l*99.8%
Simplified99.8%
expm1-log1p-u99.7%
expm1-undefine99.7%
Applied egg-rr99.7%
expm1-define99.7%
Simplified99.7%
Taylor expanded in eh around 0 99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (sin t) ew) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs(((sin(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(((sin(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(((Math.sin(t) * ew) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t): return math.fabs(((math.sin(t) * ew) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(Float64(sin(t) * ew) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))))) end
function tmp = code(eh, ew, t) tmp = abs(((sin(t) * ew) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * ew), $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|\sin t \cdot ew + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\end{array}
Initial program 99.7%
associate-/r*99.7%
cos-atan99.7%
un-div-inv99.7%
hypot-1-def99.7%
associate-/r*99.7%
Applied egg-rr99.7%
*-commutative99.7%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in ew around inf 97.8%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -6.7e+50) (not (<= ew 3.7e+90))) (fabs (* (sin t) ew)) (fabs (* (cos t) (* eh (sin (atan (/ (/ eh ew) (tan t)))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -6.7e+50) || !(ew <= 3.7e+90)) {
tmp = fabs((sin(t) * ew));
} else {
tmp = fabs((cos(t) * (eh * sin(atan(((eh / ew) / tan(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 ((ew <= (-6.7d+50)) .or. (.not. (ew <= 3.7d+90))) then
tmp = abs((sin(t) * ew))
else
tmp = abs((cos(t) * (eh * sin(atan(((eh / ew) / tan(t)))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -6.7e+50) || !(ew <= 3.7e+90)) {
tmp = Math.abs((Math.sin(t) * ew));
} else {
tmp = Math.abs((Math.cos(t) * (eh * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -6.7e+50) or not (ew <= 3.7e+90): tmp = math.fabs((math.sin(t) * ew)) else: tmp = math.fabs((math.cos(t) * (eh * math.sin(math.atan(((eh / ew) / math.tan(t))))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -6.7e+50) || !(ew <= 3.7e+90)) tmp = abs(Float64(sin(t) * ew)); else tmp = abs(Float64(cos(t) * Float64(eh * sin(atan(Float64(Float64(eh / ew) / tan(t))))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -6.7e+50) || ~((ew <= 3.7e+90))) tmp = abs((sin(t) * ew)); else tmp = abs((cos(t) * (eh * sin(atan(((eh / ew) / tan(t))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -6.7e+50], N[Not[LessEqual[ew, 3.7e+90]], $MachinePrecision]], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Cos[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -6.7 \cdot 10^{+50} \lor \neg \left(ew \leq 3.7 \cdot 10^{+90}\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\cos t \cdot \left(eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right|\\
\end{array}
\end{array}
if ew < -6.6999999999999999e50 or 3.7e90 < ew 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%
add-cube-cbrt97.8%
pow397.9%
Applied egg-rr49.8%
Taylor expanded in ew around inf 35.2%
rem-cube-cbrt35.8%
add-sqr-sqrt35.2%
sqrt-unprod41.8%
pow241.8%
*-commutative41.8%
Applied egg-rr41.8%
*-commutative41.8%
unpow241.8%
rem-sqrt-square75.0%
Simplified75.0%
if -6.6999999999999999e50 < ew < 3.7e90Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in ew around 0 81.7%
associate-*r*81.7%
*-commutative81.7%
associate-*r*81.7%
associate-/r*81.7%
Simplified81.7%
Final simplification79.1%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -4.4e+50) (not (<= ew 3.9e+90))) (fabs (* (sin t) ew)) (fabs eh)))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -4.4e+50) || !(ew <= 3.9e+90)) {
tmp = fabs((sin(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 ((ew <= (-4.4d+50)) .or. (.not. (ew <= 3.9d+90))) then
tmp = abs((sin(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 ((ew <= -4.4e+50) || !(ew <= 3.9e+90)) {
tmp = Math.abs((Math.sin(t) * ew));
} else {
tmp = Math.abs(eh);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -4.4e+50) or not (ew <= 3.9e+90): tmp = math.fabs((math.sin(t) * ew)) else: tmp = math.fabs(eh) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -4.4e+50) || !(ew <= 3.9e+90)) tmp = abs(Float64(sin(t) * ew)); else tmp = abs(eh); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -4.4e+50) || ~((ew <= 3.9e+90))) tmp = abs((sin(t) * ew)); else tmp = abs(eh); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -4.4e+50], N[Not[LessEqual[ew, 3.9e+90]], $MachinePrecision]], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[Abs[eh], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -4.4 \cdot 10^{+50} \lor \neg \left(ew \leq 3.9 \cdot 10^{+90}\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh\right|\\
\end{array}
\end{array}
if ew < -4.40000000000000034e50 or 3.9000000000000002e90 < ew 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%
add-cube-cbrt97.8%
pow397.9%
Applied egg-rr49.8%
Taylor expanded in ew around inf 35.2%
rem-cube-cbrt35.8%
add-sqr-sqrt35.2%
sqrt-unprod41.8%
pow241.8%
*-commutative41.8%
Applied egg-rr41.8%
*-commutative41.8%
unpow241.8%
rem-sqrt-square75.0%
Simplified75.0%
if -4.40000000000000034e50 < ew < 3.9000000000000002e90Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in t around 0 52.8%
associate-/r*52.8%
sin-atan13.5%
associate-/r*12.3%
div-inv12.0%
hypot-1-def23.8%
*-un-lft-identity23.8%
times-frac24.1%
Applied egg-rr24.1%
Taylor expanded in eh around inf 53.0%
Final simplification61.5%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -5e-10) (not (<= t 5.6e-8))) (* (sin t) ew) (fabs eh)))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -5e-10) || !(t <= 5.6e-8)) {
tmp = sin(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 ((t <= (-5d-10)) .or. (.not. (t <= 5.6d-8))) then
tmp = sin(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 ((t <= -5e-10) || !(t <= 5.6e-8)) {
tmp = Math.sin(t) * ew;
} else {
tmp = Math.abs(eh);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -5e-10) or not (t <= 5.6e-8): tmp = math.sin(t) * ew else: tmp = math.fabs(eh) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -5e-10) || !(t <= 5.6e-8)) tmp = Float64(sin(t) * ew); else tmp = abs(eh); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -5e-10) || ~((t <= 5.6e-8))) tmp = sin(t) * ew; else tmp = abs(eh); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -5e-10], N[Not[LessEqual[t, 5.6e-8]], $MachinePrecision]], N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision], N[Abs[eh], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-10} \lor \neg \left(t \leq 5.6 \cdot 10^{-8}\right):\\
\;\;\;\;\sin t \cdot ew\\
\mathbf{else}:\\
\;\;\;\;\left|eh\right|\\
\end{array}
\end{array}
if t < -5.00000000000000031e-10 or 5.5999999999999999e-8 < t Initial program 99.5%
associate-*l*99.5%
fma-define99.5%
associate-/r*99.5%
associate-*l*99.5%
associate-/r*99.5%
Simplified99.5%
add-cube-cbrt97.6%
pow397.7%
Applied egg-rr52.0%
Taylor expanded in ew around inf 27.8%
rem-cube-cbrt28.4%
*-commutative28.4%
Applied egg-rr28.4%
if -5.00000000000000031e-10 < t < 5.5999999999999999e-8Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
associate-/r*100.0%
associate-*l*100.0%
associate-/r*100.0%
Simplified100.0%
Taylor expanded in t around 0 70.4%
associate-/r*70.4%
sin-atan19.9%
associate-/r*18.3%
div-inv17.9%
hypot-1-def34.8%
*-un-lft-identity34.8%
times-frac34.9%
Applied egg-rr34.9%
Taylor expanded in eh around inf 70.8%
Final simplification48.4%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -5.4e+216) (not (<= ew 8.5e+186))) (fabs (* t ew)) (fabs eh)))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -5.4e+216) || !(ew <= 8.5e+186)) {
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 ((ew <= (-5.4d+216)) .or. (.not. (ew <= 8.5d+186))) 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 ((ew <= -5.4e+216) || !(ew <= 8.5e+186)) {
tmp = Math.abs((t * ew));
} else {
tmp = Math.abs(eh);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -5.4e+216) or not (ew <= 8.5e+186): tmp = math.fabs((t * ew)) else: tmp = math.fabs(eh) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -5.4e+216) || !(ew <= 8.5e+186)) tmp = abs(Float64(t * ew)); else tmp = abs(eh); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -5.4e+216) || ~((ew <= 8.5e+186))) tmp = abs((t * ew)); else tmp = abs(eh); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -5.4e+216], N[Not[LessEqual[ew, 8.5e+186]], $MachinePrecision]], N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision], N[Abs[eh], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -5.4 \cdot 10^{+216} \lor \neg \left(ew \leq 8.5 \cdot 10^{+186}\right):\\
\;\;\;\;\left|t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh\right|\\
\end{array}
\end{array}
if ew < -5.4000000000000003e216 or 8.4999999999999999e186 < ew 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%
add-cube-cbrt97.7%
pow397.7%
Applied egg-rr47.0%
Taylor expanded in ew around inf 43.0%
Taylor expanded in t around 0 19.2%
add-sqr-sqrt18.7%
sqrt-unprod37.6%
pow237.6%
*-commutative37.6%
Applied egg-rr37.6%
unpow237.6%
rem-sqrt-square48.0%
Simplified48.0%
if -5.4000000000000003e216 < ew < 8.4999999999999999e186Initial program 99.7%
associate-*l*99.7%
fma-define99.7%
associate-/r*99.7%
associate-*l*99.7%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in t around 0 47.1%
associate-/r*47.1%
sin-atan14.7%
associate-/r*13.8%
div-inv13.5%
hypot-1-def25.3%
*-un-lft-identity25.3%
times-frac25.5%
Applied egg-rr25.5%
Taylor expanded in eh around inf 47.4%
Final simplification47.5%
(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.7%
associate-*l*99.7%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.7%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in t around 0 40.1%
associate-/r*40.1%
sin-atan13.2%
associate-/r*12.5%
div-inv12.3%
hypot-1-def22.3%
*-un-lft-identity22.3%
times-frac22.5%
Applied egg-rr22.5%
Taylor expanded in eh around inf 40.7%
(FPCore (eh ew t) :precision binary64 (* t ew))
double code(double eh, double ew, double t) {
return 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 = t * ew
end function
public static double code(double eh, double ew, double t) {
return t * ew;
}
def code(eh, ew, t): return t * ew
function code(eh, ew, t) return Float64(t * ew) end
function tmp = code(eh, ew, t) tmp = t * ew; end
code[eh_, ew_, t_] := N[(t * ew), $MachinePrecision]
\begin{array}{l}
\\
t \cdot ew
\end{array}
Initial program 99.7%
associate-*l*99.7%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.7%
associate-/r*99.7%
Simplified99.7%
add-cube-cbrt97.8%
pow397.8%
Applied egg-rr52.9%
Taylor expanded in ew around inf 21.9%
Taylor expanded in t around 0 10.1%
Final simplification10.1%
herbie shell --seed 2024157
(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))))))))