
(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 (* (- eh) (/ (tan t) ew))))
(fabs
(fma
(* eh (sin t))
(- (sin (atan t_1)))
(/ (* ew (cos t)) (sqrt (+ 1.0 (pow t_1 2.0))))))))
double code(double eh, double ew, double t) {
double t_1 = -eh * (tan(t) / ew);
return fabs(fma((eh * sin(t)), -sin(atan(t_1)), ((ew * cos(t)) / sqrt((1.0 + pow(t_1, 2.0))))));
}
function code(eh, ew, t) t_1 = Float64(Float64(-eh) * Float64(tan(t) / ew)) return abs(fma(Float64(eh * sin(t)), Float64(-sin(atan(t_1))), Float64(Float64(ew * cos(t)) / sqrt(Float64(1.0 + (t_1 ^ 2.0)))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[((-eh) * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * (-N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]) + N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-eh\right) \cdot \frac{\tan t}{ew}\\
\left|\mathsf{fma}\left(eh \cdot \sin t, -\sin \tan^{-1} t\_1, \frac{ew \cdot \cos t}{\sqrt{1 + {t\_1}^{2}}}\right)\right|
\end{array}
\end{array}
Initial program 99.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
Applied rewrites99.8%
(FPCore (eh ew t) :precision binary64 (fabs (fma (- (* eh (tan t))) (cos t) (/ (* ew (cos t)) (sqrt (+ 1.0 (pow (* (- eh) (/ (tan t) ew)) 2.0)))))))
double code(double eh, double ew, double t) {
return fabs(fma(-(eh * tan(t)), cos(t), ((ew * cos(t)) / sqrt((1.0 + pow((-eh * (tan(t) / ew)), 2.0))))));
}
function code(eh, ew, t) return abs(fma(Float64(-Float64(eh * tan(t))), cos(t), Float64(Float64(ew * cos(t)) / sqrt(Float64(1.0 + (Float64(Float64(-eh) * Float64(tan(t) / ew)) ^ 2.0)))))) end
code[eh_, ew_, t_] := N[Abs[N[((-N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision]) * N[Cos[t], $MachinePrecision] + N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[N[((-eh) * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(-eh \cdot \tan t, \cos t, \frac{ew \cdot \cos t}{\sqrt{1 + {\left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)}^{2}}}\right)\right|
\end{array}
Initial program 99.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites75.4%
Taylor expanded in eh around -inf
lower-cos.f6498.3
Applied rewrites98.3%
Final simplification98.3%
(FPCore (eh ew t) :precision binary64 (fabs (fma (- (* eh (tan t))) (cos t) (/ (* ew (cos t)) 1.0))))
double code(double eh, double ew, double t) {
return fabs(fma(-(eh * tan(t)), cos(t), ((ew * cos(t)) / 1.0)));
}
function code(eh, ew, t) return abs(fma(Float64(-Float64(eh * tan(t))), cos(t), Float64(Float64(ew * cos(t)) / 1.0))) end
code[eh_, ew_, t_] := N[Abs[N[((-N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision]) * N[Cos[t], $MachinePrecision] + N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(-eh \cdot \tan t, \cos t, \frac{ew \cdot \cos t}{1}\right)\right|
\end{array}
Initial program 99.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites75.4%
Taylor expanded in eh around -inf
lower-cos.f6498.3
Applied rewrites98.3%
Taylor expanded in eh around 0
Applied rewrites97.9%
Final simplification97.9%
(FPCore (eh ew t)
:precision binary64
(if (<= t -8e+24)
(fabs (* ew (cos t)))
(if (<= t 7.2e+73)
(fabs
(fma (- (* eh (tan t))) (cos t) (/ (fma -0.5 (* ew (* t t)) ew) 1.0)))
(fabs (* eh (sin t))))))
double code(double eh, double ew, double t) {
double tmp;
if (t <= -8e+24) {
tmp = fabs((ew * cos(t)));
} else if (t <= 7.2e+73) {
tmp = fabs(fma(-(eh * tan(t)), cos(t), (fma(-0.5, (ew * (t * t)), ew) / 1.0)));
} else {
tmp = fabs((eh * sin(t)));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (t <= -8e+24) tmp = abs(Float64(ew * cos(t))); elseif (t <= 7.2e+73) tmp = abs(fma(Float64(-Float64(eh * tan(t))), cos(t), Float64(fma(-0.5, Float64(ew * Float64(t * t)), ew) / 1.0))); else tmp = abs(Float64(eh * sin(t))); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[t, -8e+24], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 7.2e+73], N[Abs[N[((-N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision]) * N[Cos[t], $MachinePrecision] + N[(N[(-0.5 * N[(ew * N[(t * t), $MachinePrecision]), $MachinePrecision] + ew), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+24}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{+73}:\\
\;\;\;\;\left|\mathsf{fma}\left(-eh \cdot \tan t, \cos t, \frac{\mathsf{fma}\left(-0.5, ew \cdot \left(t \cdot t\right), ew\right)}{1}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\end{array}
\end{array}
if t < -7.9999999999999999e24Initial program 99.6%
lift--.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites76.4%
Taylor expanded in ew around inf
lower-*.f64N/A
lower-cos.f6456.3
Applied rewrites56.3%
if -7.9999999999999999e24 < t < 7.1999999999999998e73Initial program 99.9%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites78.5%
Taylor expanded in eh around -inf
lower-cos.f6498.3
Applied rewrites98.3%
Taylor expanded in eh around 0
Applied rewrites98.3%
Taylor expanded in t around 0
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6493.9
Applied rewrites93.9%
if 7.1999999999999998e73 < t Initial program 99.8%
lift--.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites57.6%
Taylor expanded in ew around 0
lower-*.f64N/A
lower-sin.f6467.0
Applied rewrites67.0%
Final simplification79.7%
(FPCore (eh ew t)
:precision binary64
(if (<= t -0.075)
(fabs (* ew (cos t)))
(if (<= t 0.00035)
(fabs (fma (- eh) (* t (sin (atan (/ (* eh t) (- ew))))) ew))
(fabs (* eh (sin t))))))
double code(double eh, double ew, double t) {
double tmp;
if (t <= -0.075) {
tmp = fabs((ew * cos(t)));
} else if (t <= 0.00035) {
tmp = fabs(fma(-eh, (t * sin(atan(((eh * t) / -ew)))), ew));
} else {
tmp = fabs((eh * sin(t)));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (t <= -0.075) tmp = abs(Float64(ew * cos(t))); elseif (t <= 0.00035) tmp = abs(fma(Float64(-eh), Float64(t * sin(atan(Float64(Float64(eh * t) / Float64(-ew))))), ew)); else tmp = abs(Float64(eh * sin(t))); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[t, -0.075], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 0.00035], N[Abs[N[((-eh) * N[(t * N[Sin[N[ArcTan[N[(N[(eh * t), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + ew), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.075:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{elif}\;t \leq 0.00035:\\
\;\;\;\;\left|\mathsf{fma}\left(-eh, t \cdot \sin \tan^{-1} \left(\frac{eh \cdot t}{-ew}\right), ew\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\end{array}
\end{array}
if t < -0.0749999999999999972Initial program 99.6%
lift--.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites75.2%
Taylor expanded in ew around inf
lower-*.f64N/A
lower-cos.f6455.2
Applied rewrites55.2%
if -0.0749999999999999972 < t < 3.49999999999999996e-4Initial program 100.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f6498.0
Applied rewrites98.0%
Taylor expanded in t around 0
Applied rewrites98.0%
if 3.49999999999999996e-4 < t Initial program 99.8%
lift--.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites53.6%
Taylor expanded in ew around 0
lower-*.f64N/A
lower-sin.f6469.4
Applied rewrites69.4%
Final simplification79.3%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* ew (cos t))))) (if (<= ew -3.9e-74) t_1 (if (<= ew 4.2e-41) (fabs (* eh (sin t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * cos(t)));
double tmp;
if (ew <= -3.9e-74) {
tmp = t_1;
} else if (ew <= 4.2e-41) {
tmp = fabs((eh * sin(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((ew * cos(t)))
if (ew <= (-3.9d-74)) then
tmp = t_1
else if (ew <= 4.2d-41) then
tmp = abs((eh * sin(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((ew * Math.cos(t)));
double tmp;
if (ew <= -3.9e-74) {
tmp = t_1;
} else if (ew <= 4.2e-41) {
tmp = Math.abs((eh * Math.sin(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((ew * math.cos(t))) tmp = 0 if ew <= -3.9e-74: tmp = t_1 elif ew <= 4.2e-41: tmp = math.fabs((eh * math.sin(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(ew * cos(t))) tmp = 0.0 if (ew <= -3.9e-74) tmp = t_1; elseif (ew <= 4.2e-41) tmp = abs(Float64(eh * sin(t))); 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 (ew <= -3.9e-74) tmp = t_1; elseif (ew <= 4.2e-41) tmp = abs((eh * sin(t))); 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[ew, -3.9e-74], t$95$1, If[LessEqual[ew, 4.2e-41], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \cos t\right|\\
\mathbf{if}\;ew \leq -3.9 \cdot 10^{-74}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 4.2 \cdot 10^{-41}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -3.9000000000000001e-74 or 4.20000000000000025e-41 < ew Initial program 99.8%
lift--.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites90.8%
Taylor expanded in ew around inf
lower-*.f64N/A
lower-cos.f6477.3
Applied rewrites77.3%
if -3.9000000000000001e-74 < ew < 4.20000000000000025e-41Initial program 99.8%
lift--.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites47.8%
Taylor expanded in ew around 0
lower-*.f64N/A
lower-sin.f6477.0
Applied rewrites77.0%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* eh (sin t)))))
(if (<= t -1.02e-47)
t_1
(if (<= t 8.2e-118)
(fabs
(fma (* eh (* eh (/ (* t t) ew))) 0.5 (fma -0.5 (* ew (* t t)) ew)))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (t <= -1.02e-47) {
tmp = t_1;
} else if (t <= 8.2e-118) {
tmp = fabs(fma((eh * (eh * ((t * t) / ew))), 0.5, fma(-0.5, (ew * (t * 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 <= -1.02e-47) tmp = t_1; elseif (t <= 8.2e-118) tmp = abs(fma(Float64(eh * Float64(eh * Float64(Float64(t * t) / ew))), 0.5, fma(-0.5, Float64(ew * Float64(t * t)), ew))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -1.02e-47], t$95$1, If[LessEqual[t, 8.2e-118], N[Abs[N[(N[(eh * N[(eh * N[(N[(t * t), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5 + N[(-0.5 * N[(ew * N[(t * t), $MachinePrecision]), $MachinePrecision] + ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;t \leq -1.02 \cdot 10^{-47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.2 \cdot 10^{-118}:\\
\;\;\;\;\left|\mathsf{fma}\left(eh \cdot \left(eh \cdot \frac{t \cdot t}{ew}\right), 0.5, \mathsf{fma}\left(-0.5, ew \cdot \left(t \cdot t\right), ew\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.02000000000000002e-47 or 8.2000000000000006e-118 < t Initial program 99.7%
lift--.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites66.0%
Taylor expanded in ew around 0
lower-*.f64N/A
lower-sin.f6458.4
Applied rewrites58.4%
if -1.02000000000000002e-47 < t < 8.2000000000000006e-118Initial program 100.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites87.6%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6467.5
Applied rewrites67.5%
Taylor expanded in eh around 0
Applied rewrites68.8%
Applied rewrites78.3%
(FPCore (eh ew t) :precision binary64 (fabs (fma -0.5 (* ew (* t t)) ew)))
double code(double eh, double ew, double t) {
return fabs(fma(-0.5, (ew * (t * t)), ew));
}
function code(eh, ew, t) return abs(fma(-0.5, Float64(ew * Float64(t * t)), ew)) end
code[eh_, ew_, t_] := N[Abs[N[(-0.5 * N[(ew * N[(t * t), $MachinePrecision]), $MachinePrecision] + ew), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(-0.5, ew \cdot \left(t \cdot t\right), ew\right)\right|
\end{array}
Initial program 99.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites75.4%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6431.2
Applied rewrites31.2%
Taylor expanded in eh around 0
Applied rewrites35.9%
(FPCore (eh ew t) :precision binary64 (fabs (* -0.5 (* ew (* t t)))))
double code(double eh, double ew, double t) {
return fabs((-0.5 * (ew * (t * 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(((-0.5d0) * (ew * (t * t))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((-0.5 * (ew * (t * t))));
}
def code(eh, ew, t): return math.fabs((-0.5 * (ew * (t * t))))
function code(eh, ew, t) return abs(Float64(-0.5 * Float64(ew * Float64(t * t)))) end
function tmp = code(eh, ew, t) tmp = abs((-0.5 * (ew * (t * t)))); end
code[eh_, ew_, t_] := N[Abs[N[(-0.5 * N[(ew * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|-0.5 \cdot \left(ew \cdot \left(t \cdot t\right)\right)\right|
\end{array}
Initial program 99.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites75.4%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6431.2
Applied rewrites31.2%
Taylor expanded in eh around 0
Applied rewrites35.9%
Taylor expanded in t around inf
Applied rewrites4.8%
herbie shell --seed 2024221
(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)))))))