
(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 13 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 (let* ((t_1 (atan (/ eh (* ew (tan t)))))) (fabs (fma (* eh (cos t)) (sin t_1) (* (* ew (sin t)) (cos t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh / (ew * tan(t))));
return fabs(fma((eh * cos(t)), sin(t_1), ((ew * sin(t)) * cos(t_1))));
}
function code(eh, ew, t) t_1 = atan(Float64(eh / Float64(ew * tan(t)))) return abs(fma(Float64(eh * cos(t)), sin(t_1), Float64(Float64(ew * sin(t)) * cos(t_1)))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\
\left|\mathsf{fma}\left(eh \cdot \cos t, \sin t\_1, \left(ew \cdot \sin t\right) \cdot \cos t\_1\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in ew around 0
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ eh (* ew t))))
(fabs
(fma
(* (cos t) (sin (atan (/ eh (* ew (tan t))))))
eh
(/ (* ew (sin t)) (sqrt (fma t_1 t_1 1.0)))))))
double code(double eh, double ew, double t) {
double t_1 = eh / (ew * t);
return fabs(fma((cos(t) * sin(atan((eh / (ew * tan(t)))))), eh, ((ew * sin(t)) / sqrt(fma(t_1, t_1, 1.0)))));
}
function code(eh, ew, t) t_1 = Float64(eh / Float64(ew * t)) return abs(fma(Float64(cos(t) * sin(atan(Float64(eh / Float64(ew * tan(t)))))), eh, Float64(Float64(ew * sin(t)) / sqrt(fma(t_1, t_1, 1.0))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * eh + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(t$95$1 * t$95$1 + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot t}\\
\left|\mathsf{fma}\left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh, \frac{ew \cdot \sin t}{\sqrt{\mathsf{fma}\left(t\_1, t\_1, 1\right)}}\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.2
Applied rewrites99.2%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites99.2%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* eh (cos t)) (sin (atan (/ eh (* ew (tan t))))) (* ew (sin t)))))
double code(double eh, double ew, double t) {
return fabs(fma((eh * cos(t)), sin(atan((eh / (ew * tan(t))))), (ew * sin(t))));
}
function code(eh, ew, t) return abs(fma(Float64(eh * cos(t)), sin(atan(Float64(eh / Float64(ew * tan(t))))), Float64(ew * sin(t)))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), ew \cdot \sin t\right)\right|
\end{array}
Initial program 99.8%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites84.8%
Taylor expanded in eh around 0
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f64N/A
lower-*.f64N/A
lower-sin.f6498.8
Applied rewrites98.8%
(FPCore (eh ew t) :precision binary64 (fabs (fma (sin t) ew (* eh (* (cos t) (sin (atan (/ eh (* ew (tan t))))))))))
double code(double eh, double ew, double t) {
return fabs(fma(sin(t), ew, (eh * (cos(t) * sin(atan((eh / (ew * tan(t)))))))));
}
function code(eh, ew, t) return abs(fma(sin(t), ew, Float64(eh * Float64(cos(t) * sin(atan(Float64(eh / Float64(ew * tan(t))))))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[t], $MachinePrecision] * ew + 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|\mathsf{fma}\left(\sin t, ew, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right)\right|
\end{array}
Initial program 99.8%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites84.8%
Taylor expanded in eh around 0
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f64N/A
lower-*.f64N/A
lower-sin.f6498.8
Applied rewrites98.8%
Applied rewrites98.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (sin (atan (/ eh (* ew (tan t))))))
(t_2 (fabs (* (* eh (cos t)) t_1)))
(t_3 (/ eh (* ew t))))
(if (<= eh -330.0)
t_2
(if (<= eh 2.2e+46)
(fabs (fma t_1 eh (/ (* ew (sin t)) (sqrt (fma t_3 t_3 1.0)))))
t_2))))
double code(double eh, double ew, double t) {
double t_1 = sin(atan((eh / (ew * tan(t)))));
double t_2 = fabs(((eh * cos(t)) * t_1));
double t_3 = eh / (ew * t);
double tmp;
if (eh <= -330.0) {
tmp = t_2;
} else if (eh <= 2.2e+46) {
tmp = fabs(fma(t_1, eh, ((ew * sin(t)) / sqrt(fma(t_3, t_3, 1.0)))));
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = sin(atan(Float64(eh / Float64(ew * tan(t))))) t_2 = abs(Float64(Float64(eh * cos(t)) * t_1)) t_3 = Float64(eh / Float64(ew * t)) tmp = 0.0 if (eh <= -330.0) tmp = t_2; elseif (eh <= 2.2e+46) tmp = abs(fma(t_1, eh, Float64(Float64(ew * sin(t)) / sqrt(fma(t_3, t_3, 1.0))))); else tmp = t_2; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -330.0], t$95$2, If[LessEqual[eh, 2.2e+46], N[Abs[N[(t$95$1 * eh + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(t$95$3 * t$95$3 + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\
t_2 := \left|\left(eh \cdot \cos t\right) \cdot t\_1\right|\\
t_3 := \frac{eh}{ew \cdot t}\\
\mathbf{if}\;eh \leq -330:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;eh \leq 2.2 \cdot 10^{+46}:\\
\;\;\;\;\left|\mathsf{fma}\left(t\_1, eh, \frac{ew \cdot \sin t}{\sqrt{\mathsf{fma}\left(t\_3, t\_3, 1\right)}}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if eh < -330 or 2.2e46 < eh Initial program 99.7%
Taylor expanded in ew around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f6489.8
Applied rewrites89.8%
if -330 < eh < 2.2e46Initial program 99.8%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites99.9%
Taylor expanded in t around 0
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f6494.4
Applied rewrites94.4%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (* eh (cos t)) (sin (atan (/ eh (* ew (tan t))))))))) (if (<= eh -6e-54) t_1 (if (<= eh 9.2e-39) (fabs (* ew (sin t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs(((eh * cos(t)) * sin(atan((eh / (ew * tan(t)))))));
double tmp;
if (eh <= -6e-54) {
tmp = t_1;
} else if (eh <= 9.2e-39) {
tmp = fabs((ew * 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(((eh * cos(t)) * sin(atan((eh / (ew * tan(t)))))))
if (eh <= (-6d-54)) then
tmp = t_1
else if (eh <= 9.2d-39) then
tmp = abs((ew * 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(((eh * Math.cos(t)) * Math.sin(Math.atan((eh / (ew * Math.tan(t)))))));
double tmp;
if (eh <= -6e-54) {
tmp = t_1;
} else if (eh <= 9.2e-39) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs(((eh * math.cos(t)) * math.sin(math.atan((eh / (ew * math.tan(t))))))) tmp = 0 if eh <= -6e-54: tmp = t_1 elif eh <= 9.2e-39: tmp = math.fabs((ew * math.sin(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * tan(t))))))) tmp = 0.0 if (eh <= -6e-54) tmp = t_1; elseif (eh <= 9.2e-39) tmp = abs(Float64(ew * sin(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs(((eh * cos(t)) * sin(atan((eh / (ew * tan(t))))))); tmp = 0.0; if (eh <= -6e-54) tmp = t_1; elseif (eh <= 9.2e-39) tmp = abs((ew * sin(t))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -6e-54], t$95$1, If[LessEqual[eh, 9.2e-39], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\mathbf{if}\;eh \leq -6 \cdot 10^{-54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 9.2 \cdot 10^{-39}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -6.00000000000000018e-54 or 9.20000000000000033e-39 < eh Initial program 99.7%
Taylor expanded in ew around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f6488.0
Applied rewrites88.0%
if -6.00000000000000018e-54 < eh < 9.20000000000000033e-39Initial program 99.8%
Applied rewrites53.2%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6472.5
Applied rewrites72.5%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (- eh)))) (if (<= eh -7.5e-54) t_1 (if (<= eh 1.1e-38) (fabs (* ew (sin t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs(-eh);
double tmp;
if (eh <= -7.5e-54) {
tmp = t_1;
} else if (eh <= 1.1e-38) {
tmp = fabs((ew * 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(-eh)
if (eh <= (-7.5d-54)) then
tmp = t_1
else if (eh <= 1.1d-38) then
tmp = abs((ew * 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(-eh);
double tmp;
if (eh <= -7.5e-54) {
tmp = t_1;
} else if (eh <= 1.1e-38) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs(-eh) tmp = 0 if eh <= -7.5e-54: tmp = t_1 elif eh <= 1.1e-38: tmp = math.fabs((ew * math.sin(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(-eh)) tmp = 0.0 if (eh <= -7.5e-54) tmp = t_1; elseif (eh <= 1.1e-38) tmp = abs(Float64(ew * sin(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs(-eh); tmp = 0.0; if (eh <= -7.5e-54) tmp = t_1; elseif (eh <= 1.1e-38) tmp = abs((ew * sin(t))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[(-eh)], $MachinePrecision]}, If[LessEqual[eh, -7.5e-54], t$95$1, If[LessEqual[eh, 1.1e-38], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|-eh\right|\\
\mathbf{if}\;eh \leq -7.5 \cdot 10^{-54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 1.1 \cdot 10^{-38}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -7.5000000000000005e-54 or 1.10000000000000004e-38 < eh Initial program 99.7%
Taylor expanded in t around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f6453.9
Applied rewrites53.9%
Applied rewrites9.0%
Taylor expanded in eh around -inf
Applied rewrites54.2%
if -7.5000000000000005e-54 < eh < 1.10000000000000004e-38Initial program 99.8%
Applied rewrites53.2%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6472.5
Applied rewrites72.5%
(FPCore (eh ew t)
:precision binary64
(if (<= ew -3.6e+109)
(fabs
(*
ew
(*
t
(fma
(* t t)
(fma
(* t t)
(fma (* t t) -0.0001984126984126984 0.008333333333333333)
-0.16666666666666666)
1.0))))
(if (<= ew 1.1e+219) (fabs (- eh)) (fabs (* ew t)))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -3.6e+109) {
tmp = fabs((ew * (t * fma((t * t), fma((t * t), fma((t * t), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666), 1.0))));
} else if (ew <= 1.1e+219) {
tmp = fabs(-eh);
} else {
tmp = fabs((ew * t));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (ew <= -3.6e+109) tmp = abs(Float64(ew * Float64(t * fma(Float64(t * t), fma(Float64(t * t), fma(Float64(t * t), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666), 1.0)))); elseif (ew <= 1.1e+219) tmp = abs(Float64(-eh)); else tmp = abs(Float64(ew * t)); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[ew, -3.6e+109], N[Abs[N[(ew * N[(t * N[(N[(t * t), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 1.1e+219], N[Abs[(-eh)], $MachinePrecision], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -3.6 \cdot 10^{+109}:\\
\;\;\;\;\left|ew \cdot \left(t \cdot \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(t \cdot t, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), 1\right)\right)\right|\\
\mathbf{elif}\;ew \leq 1.1 \cdot 10^{+219}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot t\right|\\
\end{array}
\end{array}
if ew < -3.6e109Initial program 99.9%
Applied rewrites34.6%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6480.0
Applied rewrites80.0%
Taylor expanded in t around 0
Applied rewrites35.3%
if -3.6e109 < ew < 1.1000000000000001e219Initial program 99.7%
Taylor expanded in t around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f6450.0
Applied rewrites50.0%
Applied rewrites6.8%
Taylor expanded in eh around -inf
Applied rewrites50.4%
if 1.1000000000000001e219 < ew Initial program 100.0%
Applied rewrites63.4%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites73.1%
Final simplification49.0%
(FPCore (eh ew t)
:precision binary64
(if (<= ew -3.6e+109)
(fabs
(*
t
(fma
(* t t)
(fma 0.008333333333333333 (* ew (* t t)) (* ew -0.16666666666666666))
ew)))
(if (<= ew 1.1e+219) (fabs (- eh)) (fabs (* ew t)))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -3.6e+109) {
tmp = fabs((t * fma((t * t), fma(0.008333333333333333, (ew * (t * t)), (ew * -0.16666666666666666)), ew)));
} else if (ew <= 1.1e+219) {
tmp = fabs(-eh);
} else {
tmp = fabs((ew * t));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (ew <= -3.6e+109) tmp = abs(Float64(t * fma(Float64(t * t), fma(0.008333333333333333, Float64(ew * Float64(t * t)), Float64(ew * -0.16666666666666666)), ew))); elseif (ew <= 1.1e+219) tmp = abs(Float64(-eh)); else tmp = abs(Float64(ew * t)); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[ew, -3.6e+109], N[Abs[N[(t * N[(N[(t * t), $MachinePrecision] * N[(0.008333333333333333 * N[(ew * N[(t * t), $MachinePrecision]), $MachinePrecision] + N[(ew * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 1.1e+219], N[Abs[(-eh)], $MachinePrecision], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -3.6 \cdot 10^{+109}:\\
\;\;\;\;\left|t \cdot \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(0.008333333333333333, ew \cdot \left(t \cdot t\right), ew \cdot -0.16666666666666666\right), ew\right)\right|\\
\mathbf{elif}\;ew \leq 1.1 \cdot 10^{+219}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot t\right|\\
\end{array}
\end{array}
if ew < -3.6e109Initial program 99.9%
Applied rewrites34.6%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6480.0
Applied rewrites80.0%
Taylor expanded in t around 0
Applied rewrites34.9%
if -3.6e109 < ew < 1.1000000000000001e219Initial program 99.7%
Taylor expanded in t around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f6450.0
Applied rewrites50.0%
Applied rewrites6.8%
Taylor expanded in eh around -inf
Applied rewrites50.4%
if 1.1000000000000001e219 < ew Initial program 100.0%
Applied rewrites63.4%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites73.1%
Final simplification49.0%
(FPCore (eh ew t)
:precision binary64
(if (<= ew -3.6e+109)
(fabs
(*
ew
(*
t
(fma
(* t t)
(fma (* t t) 0.008333333333333333 -0.16666666666666666)
1.0))))
(if (<= ew 1.1e+219) (fabs (- eh)) (fabs (* ew t)))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -3.6e+109) {
tmp = fabs((ew * (t * fma((t * t), fma((t * t), 0.008333333333333333, -0.16666666666666666), 1.0))));
} else if (ew <= 1.1e+219) {
tmp = fabs(-eh);
} else {
tmp = fabs((ew * t));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (ew <= -3.6e+109) tmp = abs(Float64(ew * Float64(t * fma(Float64(t * t), fma(Float64(t * t), 0.008333333333333333, -0.16666666666666666), 1.0)))); elseif (ew <= 1.1e+219) tmp = abs(Float64(-eh)); else tmp = abs(Float64(ew * t)); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[ew, -3.6e+109], N[Abs[N[(ew * N[(t * N[(N[(t * t), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 1.1e+219], N[Abs[(-eh)], $MachinePrecision], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -3.6 \cdot 10^{+109}:\\
\;\;\;\;\left|ew \cdot \left(t \cdot \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(t \cdot t, 0.008333333333333333, -0.16666666666666666\right), 1\right)\right)\right|\\
\mathbf{elif}\;ew \leq 1.1 \cdot 10^{+219}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot t\right|\\
\end{array}
\end{array}
if ew < -3.6e109Initial program 99.9%
Applied rewrites34.6%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6480.0
Applied rewrites80.0%
Taylor expanded in t around 0
Applied rewrites34.9%
if -3.6e109 < ew < 1.1000000000000001e219Initial program 99.7%
Taylor expanded in t around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f6450.0
Applied rewrites50.0%
Applied rewrites6.8%
Taylor expanded in eh around -inf
Applied rewrites50.4%
if 1.1000000000000001e219 < ew Initial program 100.0%
Applied rewrites63.4%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites73.1%
Final simplification49.0%
(FPCore (eh ew t) :precision binary64 (if (<= ew -3.6e+109) (fabs (* ew (* t (fma (* t t) -0.16666666666666666 1.0)))) (if (<= ew 1.1e+219) (fabs (- eh)) (fabs (* ew t)))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -3.6e+109) {
tmp = fabs((ew * (t * fma((t * t), -0.16666666666666666, 1.0))));
} else if (ew <= 1.1e+219) {
tmp = fabs(-eh);
} else {
tmp = fabs((ew * t));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (ew <= -3.6e+109) tmp = abs(Float64(ew * Float64(t * fma(Float64(t * t), -0.16666666666666666, 1.0)))); elseif (ew <= 1.1e+219) tmp = abs(Float64(-eh)); else tmp = abs(Float64(ew * t)); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[ew, -3.6e+109], N[Abs[N[(ew * N[(t * N[(N[(t * t), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 1.1e+219], N[Abs[(-eh)], $MachinePrecision], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -3.6 \cdot 10^{+109}:\\
\;\;\;\;\left|ew \cdot \left(t \cdot \mathsf{fma}\left(t \cdot t, -0.16666666666666666, 1\right)\right)\right|\\
\mathbf{elif}\;ew \leq 1.1 \cdot 10^{+219}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot t\right|\\
\end{array}
\end{array}
if ew < -3.6e109Initial program 99.9%
Applied rewrites34.6%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6480.0
Applied rewrites80.0%
Taylor expanded in t around 0
Applied rewrites34.6%
if -3.6e109 < ew < 1.1000000000000001e219Initial program 99.7%
Taylor expanded in t around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f6450.0
Applied rewrites50.0%
Applied rewrites6.8%
Taylor expanded in eh around -inf
Applied rewrites50.4%
if 1.1000000000000001e219 < ew Initial program 100.0%
Applied rewrites63.4%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites73.1%
Final simplification48.9%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* ew t)))) (if (<= ew -3.6e+109) t_1 (if (<= ew 1.1e+219) (fabs (- eh)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * t));
double tmp;
if (ew <= -3.6e+109) {
tmp = t_1;
} else if (ew <= 1.1e+219) {
tmp = fabs(-eh);
} 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 * t))
if (ew <= (-3.6d+109)) then
tmp = t_1
else if (ew <= 1.1d+219) then
tmp = abs(-eh)
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 * t));
double tmp;
if (ew <= -3.6e+109) {
tmp = t_1;
} else if (ew <= 1.1e+219) {
tmp = Math.abs(-eh);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((ew * t)) tmp = 0 if ew <= -3.6e+109: tmp = t_1 elif ew <= 1.1e+219: tmp = math.fabs(-eh) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(ew * t)) tmp = 0.0 if (ew <= -3.6e+109) tmp = t_1; elseif (ew <= 1.1e+219) tmp = abs(Float64(-eh)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((ew * t)); tmp = 0.0; if (ew <= -3.6e+109) tmp = t_1; elseif (ew <= 1.1e+219) tmp = abs(-eh); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -3.6e+109], t$95$1, If[LessEqual[ew, 1.1e+219], N[Abs[(-eh)], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot t\right|\\
\mathbf{if}\;ew \leq -3.6 \cdot 10^{+109}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 1.1 \cdot 10^{+219}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -3.6e109 or 1.1000000000000001e219 < ew Initial program 99.9%
Applied rewrites40.6%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6484.2
Applied rewrites84.2%
Taylor expanded in t around 0
Applied rewrites42.5%
if -3.6e109 < ew < 1.1000000000000001e219Initial program 99.7%
Taylor expanded in t around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f6450.0
Applied rewrites50.0%
Applied rewrites6.8%
Taylor expanded in eh around -inf
Applied rewrites50.4%
Final simplification48.9%
(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(Float64(-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%
Taylor expanded in t around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f6443.3
Applied rewrites43.3%
Applied rewrites7.4%
Taylor expanded in eh around -inf
Applied rewrites43.7%
herbie shell --seed 2024219
(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))))))))