
(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 9 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 (atan (* eh (/ (tan t) (- ew)))))) (fabs (fma ew (* (cos t_1) (- (cos t))) (* eh (* (sin t) (sin t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh * (tan(t) / -ew)));
return fabs(fma(ew, (cos(t_1) * -cos(t)), (eh * (sin(t) * sin(t_1)))));
}
function code(eh, ew, t) t_1 = atan(Float64(eh * Float64(tan(t) / Float64(-ew)))) return abs(fma(ew, Float64(cos(t_1) * Float64(-cos(t))), Float64(eh * Float64(sin(t) * sin(t_1))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(ew * N[(N[Cos[t$95$1], $MachinePrecision] * (-N[Cos[t], $MachinePrecision])), $MachinePrecision] + N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right)\\
\left|\mathsf{fma}\left(ew, \cos t\_1 \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin t\_1\right)\right)\right|
\end{array}
\end{array}
Initial program 99.9%
fabs-sub99.9%
sub-neg99.9%
+-commutative99.9%
associate-*l*99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
Simplified99.9%
Final simplification99.9%
(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(eh * Float64(-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{eh \cdot \left(-\tan t\right)}{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}
Initial program 99.9%
Final simplification99.9%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* ew (cos t)) (cos (atan (/ (* eh (- (tan t))) ew)))) (* (* eh (sin t)) (sin (atan (/ (* eh (- t)) ew)))))))
double code(double eh, double ew, double t) {
return fabs((((ew * cos(t)) * cos(atan(((eh * -tan(t)) / ew)))) - ((eh * sin(t)) * sin(atan(((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((((ew * cos(t)) * cos(atan(((eh * -tan(t)) / ew)))) - ((eh * sin(t)) * sin(atan(((eh * -t) / ew))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((ew * Math.cos(t)) * Math.cos(Math.atan(((eh * -Math.tan(t)) / ew)))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * -t) / ew))))));
}
def code(eh, ew, t): return math.fabs((((ew * math.cos(t)) * math.cos(math.atan(((eh * -math.tan(t)) / ew)))) - ((eh * math.sin(t)) * math.sin(math.atan(((eh * -t) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(atan(Float64(Float64(eh * Float64(-tan(t))) / ew)))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * Float64(-t)) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * cos(t)) * cos(atan(((eh * -tan(t)) / ew)))) - ((eh * sin(t)) * sin(atan(((eh * -t) / ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(eh * (-N[Tan[t], $MachinePrecision])), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * (-t)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right)\right|
\end{array}
Initial program 99.9%
Taylor expanded in t around 0 99.8%
associate-*r/99.8%
associate-*r*99.8%
mul-1-neg99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (fma ew (* (cos (atan (* eh (/ (tan t) (- ew))))) (- (cos t))) (* eh (sin t)))))
double code(double eh, double ew, double t) {
return fabs(fma(ew, (cos(atan((eh * (tan(t) / -ew)))) * -cos(t)), (eh * sin(t))));
}
function code(eh, ew, t) return abs(fma(ew, Float64(cos(atan(Float64(eh * Float64(tan(t) / Float64(-ew))))) * Float64(-cos(t))), Float64(eh * sin(t)))) end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[(N[Cos[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * (-N[Cos[t], $MachinePrecision])), $MachinePrecision] + N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right) \cdot \left(-\cos t\right), eh \cdot \sin t\right)\right|
\end{array}
Initial program 99.9%
fabs-sub99.9%
sub-neg99.9%
+-commutative99.9%
associate-*l*99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
Simplified99.9%
associate-*r*99.9%
sin-atan78.5%
associate-*r/76.8%
associate-*r/76.8%
*-commutative76.8%
associate-/l*74.4%
add-sqr-sqrt36.8%
sqrt-unprod64.1%
sqr-neg64.1%
sqrt-unprod37.5%
add-sqr-sqrt74.3%
hypot-1-def80.2%
associate-*r/80.2%
Applied egg-rr80.2%
associate-/l*86.1%
associate-*l*86.1%
*-commutative86.1%
associate-/l*86.0%
associate-*r/85.9%
associate-*l/85.9%
*-commutative85.9%
Simplified85.9%
Taylor expanded in eh around inf 99.2%
Final simplification99.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (sin t))))
(if (or (<= eh -1.7e-93) (not (<= eh 1.7e-154)))
(fabs (fma ew (* (cos t) (- (cos (atan (* eh (/ t (- ew))))))) t_1))
(fabs (fma -0.5 (/ (pow t_1 2.0) ew) (* ew (cos t)))))))
double code(double eh, double ew, double t) {
double t_1 = eh * sin(t);
double tmp;
if ((eh <= -1.7e-93) || !(eh <= 1.7e-154)) {
tmp = fabs(fma(ew, (cos(t) * -cos(atan((eh * (t / -ew))))), t_1));
} else {
tmp = fabs(fma(-0.5, (pow(t_1, 2.0) / ew), (ew * cos(t))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh * sin(t)) tmp = 0.0 if ((eh <= -1.7e-93) || !(eh <= 1.7e-154)) tmp = abs(fma(ew, Float64(cos(t) * Float64(-cos(atan(Float64(eh * Float64(t / Float64(-ew))))))), t_1)); else tmp = abs(fma(-0.5, Float64((t_1 ^ 2.0) / ew), Float64(ew * cos(t)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -1.7e-93], N[Not[LessEqual[eh, 1.7e-154]], $MachinePrecision]], N[Abs[N[(ew * N[(N[Cos[t], $MachinePrecision] * (-N[Cos[N[ArcTan[N[(eh * N[(t / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision])), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision], N[Abs[N[(-0.5 * N[(N[Power[t$95$1, 2.0], $MachinePrecision] / ew), $MachinePrecision] + N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \sin t\\
\mathbf{if}\;eh \leq -1.7 \cdot 10^{-93} \lor \neg \left(eh \leq 1.7 \cdot 10^{-154}\right):\\
\;\;\;\;\left|\mathsf{fma}\left(ew, \cos t \cdot \left(-\cos \tan^{-1} \left(eh \cdot \frac{t}{-ew}\right)\right), t\_1\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(-0.5, \frac{{t\_1}^{2}}{ew}, ew \cdot \cos t\right)\right|\\
\end{array}
\end{array}
if eh < -1.70000000000000001e-93 or 1.6999999999999999e-154 < eh Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan69.1%
associate-*r/66.7%
associate-*r/66.6%
*-commutative66.6%
associate-/l*63.3%
add-sqr-sqrt28.8%
sqrt-unprod49.5%
sqr-neg49.5%
sqrt-unprod34.4%
add-sqr-sqrt63.2%
hypot-1-def71.7%
associate-*r/71.7%
Applied egg-rr71.7%
associate-/l*80.1%
associate-*l*80.1%
*-commutative80.1%
associate-/l*80.0%
associate-*r/79.9%
associate-*l/79.9%
*-commutative79.9%
Simplified79.9%
Taylor expanded in eh around inf 99.3%
Taylor expanded in t around 0 91.0%
if -1.70000000000000001e-93 < eh < 1.6999999999999999e-154Initial program 99.9%
fabs-sub99.9%
sub-neg99.9%
+-commutative99.9%
associate-*l*99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
Simplified99.9%
Applied egg-rr93.7%
+-inverses93.7%
associate-/l*93.7%
metadata-eval93.7%
mul0-rgt93.7%
Simplified93.7%
add-cube-cbrt91.9%
pow391.9%
Applied egg-rr91.9%
Taylor expanded in eh around 0 93.7%
fma-define93.7%
unpow293.7%
unpow293.7%
swap-sqr93.7%
unpow293.7%
Simplified93.7%
Taylor expanded in t around 0 93.7%
Final simplification91.8%
(FPCore (eh ew t) :precision binary64 (fabs (fma -0.5 (* eh (* (tan t) (* eh (/ (sin t) ew)))) (* ew (cos t)))))
double code(double eh, double ew, double t) {
return fabs(fma(-0.5, (eh * (tan(t) * (eh * (sin(t) / ew)))), (ew * cos(t))));
}
function code(eh, ew, t) return abs(fma(-0.5, Float64(eh * Float64(tan(t) * Float64(eh * Float64(sin(t) / ew)))), Float64(ew * cos(t)))) end
code[eh_, ew_, t_] := N[Abs[N[(-0.5 * N[(eh * N[(N[Tan[t], $MachinePrecision] * N[(eh * N[(N[Sin[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(-0.5, eh \cdot \left(\tan t \cdot \left(eh \cdot \frac{\sin t}{ew}\right)\right), ew \cdot \cos t\right)\right|
\end{array}
Initial program 99.9%
fabs-sub99.9%
sub-neg99.9%
+-commutative99.9%
associate-*l*99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
Simplified99.9%
Applied egg-rr62.8%
+-inverses62.8%
associate-/l*62.8%
metadata-eval62.8%
mul0-rgt62.8%
Simplified62.8%
add-cube-cbrt61.6%
pow361.6%
Applied egg-rr61.3%
Taylor expanded in eh around 0 57.2%
fma-define57.2%
unpow257.2%
unpow257.2%
swap-sqr61.9%
unpow261.9%
Simplified61.9%
unpow261.9%
*-commutative61.9%
times-frac63.4%
associate-*r/63.4%
tan-quot63.4%
Applied egg-rr63.4%
associate-*l*63.4%
associate-/l*63.4%
Simplified63.4%
(FPCore (eh ew t) :precision binary64 (fabs (fma -0.5 (* eh (* (sin t) (* (tan t) (/ eh ew)))) (* ew (cos t)))))
double code(double eh, double ew, double t) {
return fabs(fma(-0.5, (eh * (sin(t) * (tan(t) * (eh / ew)))), (ew * cos(t))));
}
function code(eh, ew, t) return abs(fma(-0.5, Float64(eh * Float64(sin(t) * Float64(tan(t) * Float64(eh / ew)))), Float64(ew * cos(t)))) end
code[eh_, ew_, t_] := N[Abs[N[(-0.5 * N[(eh * N[(N[Sin[t], $MachinePrecision] * N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(-0.5, eh \cdot \left(\sin t \cdot \left(\tan t \cdot \frac{eh}{ew}\right)\right), ew \cdot \cos t\right)\right|
\end{array}
Initial program 99.9%
fabs-sub99.9%
sub-neg99.9%
+-commutative99.9%
associate-*l*99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
Simplified99.9%
Applied egg-rr62.8%
+-inverses62.8%
associate-/l*62.8%
metadata-eval62.8%
mul0-rgt62.8%
Simplified62.8%
add-cube-cbrt61.6%
pow361.6%
Applied egg-rr61.3%
Taylor expanded in eh around 0 57.2%
fma-define57.2%
unpow257.2%
unpow257.2%
swap-sqr61.9%
unpow261.9%
Simplified61.9%
unpow261.9%
associate-/l*63.4%
frac-times63.3%
tan-quot63.3%
Applied egg-rr63.3%
associate-*l*63.3%
Simplified63.3%
Final simplification63.3%
(FPCore (eh ew t) :precision binary64 (fabs (* ew (cos t))))
double code(double eh, double ew, double t) {
return fabs((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
code = abs((ew * cos(t)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * Math.cos(t)));
}
def code(eh, ew, t): return math.fabs((ew * math.cos(t)))
function code(eh, ew, t) return abs(Float64(ew * cos(t))) end
function tmp = code(eh, ew, t) tmp = abs((ew * cos(t))); end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t\right|
\end{array}
Initial program 99.9%
fabs-sub99.9%
sub-neg99.9%
+-commutative99.9%
associate-*l*99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
Simplified99.9%
Applied egg-rr62.8%
+-inverses62.8%
associate-/l*62.8%
metadata-eval62.8%
mul0-rgt62.8%
Simplified62.8%
add-cube-cbrt61.6%
pow361.6%
Applied egg-rr61.3%
Taylor expanded in ew around inf 62.9%
(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%
fabs-sub99.9%
sub-neg99.9%
+-commutative99.9%
associate-*l*99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
Simplified99.9%
Applied egg-rr62.8%
+-inverses62.8%
associate-/l*62.8%
metadata-eval62.8%
mul0-rgt62.8%
Simplified62.8%
add-cube-cbrt61.6%
pow361.6%
Applied egg-rr61.3%
Taylor expanded in t around 0 42.1%
herbie shell --seed 2024103
(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)))))))