
(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
(/ 1.0 (sqrt (fma t_1 t_1 1.0)))
(* ew (sin t))
(* (* eh (cos t)) (sin (atan (/ eh (* ew (tan t))))))))))
double code(double eh, double ew, double t) {
double t_1 = eh / (ew * t);
return fabs(fma((1.0 / sqrt(fma(t_1, t_1, 1.0))), (ew * sin(t)), ((eh * cos(t)) * sin(atan((eh / (ew * tan(t))))))));
}
function code(eh, ew, t) t_1 = Float64(eh / Float64(ew * t)) return abs(fma(Float64(1.0 / sqrt(fma(t_1, t_1, 1.0))), Float64(ew * sin(t)), Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * tan(t)))))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(1.0 / N[Sqrt[N[(t$95$1 * t$95$1 + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + 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]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot t}\\
\left|\mathsf{fma}\left(\frac{1}{\sqrt{\mathsf{fma}\left(t\_1, t\_1, 1\right)}}, ew \cdot \sin t, \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6498.9
Applied rewrites98.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
Applied rewrites98.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ eh (* ew t))))
(fabs
(fma
(/ (sin t) (sqrt (fma t_1 t_1 1.0)))
ew
(* (* eh (cos t)) (sin (atan (/ eh (* ew (tan t))))))))))
double code(double eh, double ew, double t) {
double t_1 = eh / (ew * t);
return fabs(fma((sin(t) / sqrt(fma(t_1, t_1, 1.0))), ew, ((eh * cos(t)) * sin(atan((eh / (ew * tan(t))))))));
}
function code(eh, ew, t) t_1 = Float64(eh / Float64(ew * t)) return abs(fma(Float64(sin(t) / sqrt(fma(t_1, t_1, 1.0))), ew, Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * tan(t)))))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[Sin[t], $MachinePrecision] / N[Sqrt[N[(t$95$1 * t$95$1 + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * ew + 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]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot t}\\
\left|\mathsf{fma}\left(\frac{\sin t}{\sqrt{\mathsf{fma}\left(t\_1, t\_1, 1\right)}}, ew, \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6498.9
Applied rewrites98.9%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
Applied rewrites98.9%
(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%
Applied rewrites46.7%
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.6
Applied rewrites98.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t)))
(t_2 (/ eh (* ew t)))
(t_3
(fabs
(fma
(/ 1.0 (sqrt (fma t_2 t_2 1.0)))
(* ew (sin t))
(* t_1 (sin (atan t_2)))))))
(if (<= ew -2.65e-183)
t_3
(if (<= ew 1.42e-67)
(fabs (* t_1 (sin (atan (/ eh (* ew (tan t)))))))
t_3))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double t_2 = eh / (ew * t);
double t_3 = fabs(fma((1.0 / sqrt(fma(t_2, t_2, 1.0))), (ew * sin(t)), (t_1 * sin(atan(t_2)))));
double tmp;
if (ew <= -2.65e-183) {
tmp = t_3;
} else if (ew <= 1.42e-67) {
tmp = fabs((t_1 * sin(atan((eh / (ew * tan(t)))))));
} else {
tmp = t_3;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) t_2 = Float64(eh / Float64(ew * t)) t_3 = abs(fma(Float64(1.0 / sqrt(fma(t_2, t_2, 1.0))), Float64(ew * sin(t)), Float64(t_1 * sin(atan(t_2))))) tmp = 0.0 if (ew <= -2.65e-183) tmp = t_3; elseif (ew <= 1.42e-67) tmp = abs(Float64(t_1 * sin(atan(Float64(eh / Float64(ew * tan(t))))))); else tmp = t_3; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Abs[N[(N[(1.0 / N[Sqrt[N[(t$95$2 * t$95$2 + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[Sin[N[ArcTan[t$95$2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -2.65e-183], t$95$3, If[LessEqual[ew, 1.42e-67], N[Abs[N[(t$95$1 * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
t_2 := \frac{eh}{ew \cdot t}\\
t_3 := \left|\mathsf{fma}\left(\frac{1}{\sqrt{\mathsf{fma}\left(t\_2, t\_2, 1\right)}}, ew \cdot \sin t, t\_1 \cdot \sin \tan^{-1} t\_2\right)\right|\\
\mathbf{if}\;ew \leq -2.65 \cdot 10^{-183}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;ew \leq 1.42 \cdot 10^{-67}:\\
\;\;\;\;\left|t\_1 \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if ew < -2.6500000000000002e-183 or 1.42000000000000004e-67 < ew Initial program 99.8%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6498.6
Applied rewrites98.6%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
Applied rewrites98.6%
Taylor expanded in t around 0
lower-*.f6489.8
Applied rewrites89.8%
if -2.6500000000000002e-183 < ew < 1.42000000000000004e-67Initial program 99.9%
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.f6495.5
Applied rewrites95.5%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (* eh (cos t)) (sin (atan (/ eh (* ew (tan t))))))))) (if (<= eh -2.6e-19) t_1 (if (<= eh 2.4e-73) (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 <= -2.6e-19) {
tmp = t_1;
} else if (eh <= 2.4e-73) {
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 <= (-2.6d-19)) then
tmp = t_1
else if (eh <= 2.4d-73) 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 <= -2.6e-19) {
tmp = t_1;
} else if (eh <= 2.4e-73) {
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 <= -2.6e-19: tmp = t_1 elif eh <= 2.4e-73: 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 <= -2.6e-19) tmp = t_1; elseif (eh <= 2.4e-73) 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 <= -2.6e-19) tmp = t_1; elseif (eh <= 2.4e-73) 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, -2.6e-19], t$95$1, If[LessEqual[eh, 2.4e-73], 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 -2.6 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 2.4 \cdot 10^{-73}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -2.60000000000000013e-19 or 2.40000000000000006e-73 < eh Initial program 99.8%
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.f6478.7
Applied rewrites78.7%
if -2.60000000000000013e-19 < eh < 2.40000000000000006e-73Initial program 99.8%
Applied rewrites69.9%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6475.1
Applied rewrites75.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* ew (sin t)))))
(if (<= t -0.0054)
t_1
(if (<= t 900000.0)
(fabs (fma eh (sin (atan (/ eh (* ew (tan t))))) (* ew t)))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * sin(t)));
double tmp;
if (t <= -0.0054) {
tmp = t_1;
} else if (t <= 900000.0) {
tmp = fabs(fma(eh, sin(atan((eh / (ew * tan(t))))), (ew * t)));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(ew * sin(t))) tmp = 0.0 if (t <= -0.0054) tmp = t_1; elseif (t <= 900000.0) tmp = abs(fma(eh, sin(atan(Float64(eh / Float64(ew * tan(t))))), Float64(ew * t))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -0.0054], t$95$1, If[LessEqual[t, 900000.0], N[Abs[N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \sin t\right|\\
\mathbf{if}\;t \leq -0.0054:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 900000:\\
\;\;\;\;\left|\mathsf{fma}\left(eh, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), ew \cdot t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -0.0054000000000000003 or 9e5 < t Initial program 99.7%
Applied rewrites56.9%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6456.3
Applied rewrites56.3%
if -0.0054000000000000003 < t < 9e5Initial program 100.0%
Applied rewrites34.4%
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.f6499.3
Applied rewrites99.3%
Taylor expanded in t around 0
Applied rewrites98.0%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* ew (sin t))))) (if (<= t -3.5e-90) t_1 (if (<= t 900000.0) (fabs (- eh)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * sin(t)));
double tmp;
if (t <= -3.5e-90) {
tmp = t_1;
} else if (t <= 900000.0) {
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 * sin(t)))
if (t <= (-3.5d-90)) then
tmp = t_1
else if (t <= 900000.0d0) 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 * Math.sin(t)));
double tmp;
if (t <= -3.5e-90) {
tmp = t_1;
} else if (t <= 900000.0) {
tmp = Math.abs(-eh);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((ew * math.sin(t))) tmp = 0 if t <= -3.5e-90: tmp = t_1 elif t <= 900000.0: tmp = math.fabs(-eh) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(ew * sin(t))) tmp = 0.0 if (t <= -3.5e-90) tmp = t_1; elseif (t <= 900000.0) tmp = abs(Float64(-eh)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((ew * sin(t))); tmp = 0.0; if (t <= -3.5e-90) tmp = t_1; elseif (t <= 900000.0) tmp = abs(-eh); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -3.5e-90], t$95$1, If[LessEqual[t, 900000.0], N[Abs[(-eh)], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \sin t\right|\\
\mathbf{if}\;t \leq -3.5 \cdot 10^{-90}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 900000:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.4999999999999999e-90 or 9e5 < t Initial program 99.7%
Applied rewrites56.6%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6456.2
Applied rewrites56.2%
if -3.4999999999999999e-90 < t < 9e5Initial program 100.0%
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.f6474.5
Applied rewrites74.5%
Applied rewrites9.7%
Taylor expanded in eh around -inf
Applied rewrites74.9%
(FPCore (eh ew t)
:precision binary64
(if (<= ew -5.5e+44)
(fabs (* ew t))
(if (<= ew 4.6e+142)
(fabs (- eh))
(fabs
(*
t
(fma
(* t t)
(fma
(* t t)
(fma
ew
0.008333333333333333
(* (* ew (* t t)) -0.0001984126984126984))
(* ew -0.16666666666666666))
ew))))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -5.5e+44) {
tmp = fabs((ew * t));
} else if (ew <= 4.6e+142) {
tmp = fabs(-eh);
} else {
tmp = fabs((t * fma((t * t), fma((t * t), fma(ew, 0.008333333333333333, ((ew * (t * t)) * -0.0001984126984126984)), (ew * -0.16666666666666666)), ew)));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (ew <= -5.5e+44) tmp = abs(Float64(ew * t)); elseif (ew <= 4.6e+142) tmp = abs(Float64(-eh)); else tmp = abs(Float64(t * fma(Float64(t * t), fma(Float64(t * t), fma(ew, 0.008333333333333333, Float64(Float64(ew * Float64(t * t)) * -0.0001984126984126984)), Float64(ew * -0.16666666666666666)), ew))); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[ew, -5.5e+44], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 4.6e+142], N[Abs[(-eh)], $MachinePrecision], N[Abs[N[(t * N[(N[(t * t), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * N[(ew * 0.008333333333333333 + N[(N[(ew * N[(t * t), $MachinePrecision]), $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision] + N[(ew * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -5.5 \cdot 10^{+44}:\\
\;\;\;\;\left|ew \cdot t\right|\\
\mathbf{elif}\;ew \leq 4.6 \cdot 10^{+142}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t \cdot \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(ew, 0.008333333333333333, \left(ew \cdot \left(t \cdot t\right)\right) \cdot -0.0001984126984126984\right), ew \cdot -0.16666666666666666\right), ew\right)\right|\\
\end{array}
\end{array}
if ew < -5.5000000000000001e44Initial program 99.8%
Applied rewrites72.7%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6476.2
Applied rewrites76.2%
Taylor expanded in t around 0
Applied rewrites35.2%
if -5.5000000000000001e44 < ew < 4.60000000000000004e142Initial 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.f6449.1
Applied rewrites49.1%
Applied rewrites7.6%
Taylor expanded in eh around -inf
Applied rewrites49.5%
if 4.60000000000000004e142 < ew Initial program 99.6%
Applied rewrites73.2%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6483.5
Applied rewrites83.5%
Taylor expanded in t around 0
Applied rewrites39.6%
(FPCore (eh ew t)
:precision binary64
(if (<= ew -5.5e+44)
(fabs (* ew t))
(if (<= ew 4.6e+142)
(fabs (- eh))
(fabs
(*
ew
(*
t
(fma
(* t t)
(fma (* t t) 0.008333333333333333 -0.16666666666666666)
1.0)))))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -5.5e+44) {
tmp = fabs((ew * t));
} else if (ew <= 4.6e+142) {
tmp = fabs(-eh);
} else {
tmp = fabs((ew * (t * fma((t * t), fma((t * t), 0.008333333333333333, -0.16666666666666666), 1.0))));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (ew <= -5.5e+44) tmp = abs(Float64(ew * t)); elseif (ew <= 4.6e+142) tmp = abs(Float64(-eh)); else tmp = abs(Float64(ew * Float64(t * fma(Float64(t * t), fma(Float64(t * t), 0.008333333333333333, -0.16666666666666666), 1.0)))); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[ew, -5.5e+44], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 4.6e+142], N[Abs[(-eh)], $MachinePrecision], 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]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -5.5 \cdot 10^{+44}:\\
\;\;\;\;\left|ew \cdot t\right|\\
\mathbf{elif}\;ew \leq 4.6 \cdot 10^{+142}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;\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|\\
\end{array}
\end{array}
if ew < -5.5000000000000001e44Initial program 99.8%
Applied rewrites72.7%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6476.2
Applied rewrites76.2%
Taylor expanded in t around 0
Applied rewrites35.2%
if -5.5000000000000001e44 < ew < 4.60000000000000004e142Initial 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.f6449.1
Applied rewrites49.1%
Applied rewrites7.6%
Taylor expanded in eh around -inf
Applied rewrites49.5%
if 4.60000000000000004e142 < ew Initial program 99.6%
Applied rewrites73.2%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6483.5
Applied rewrites83.5%
Taylor expanded in t around 0
Applied rewrites39.5%
(FPCore (eh ew t)
:precision binary64
(if (<= ew -5.5e+44)
(fabs (* ew t))
(if (<= ew 4.6e+142)
(fabs (- eh))
(fabs (* ew (* t (fma (* t t) -0.16666666666666666 1.0)))))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -5.5e+44) {
tmp = fabs((ew * t));
} else if (ew <= 4.6e+142) {
tmp = fabs(-eh);
} else {
tmp = fabs((ew * (t * fma((t * t), -0.16666666666666666, 1.0))));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (ew <= -5.5e+44) tmp = abs(Float64(ew * t)); elseif (ew <= 4.6e+142) tmp = abs(Float64(-eh)); else tmp = abs(Float64(ew * Float64(t * fma(Float64(t * t), -0.16666666666666666, 1.0)))); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[ew, -5.5e+44], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 4.6e+142], N[Abs[(-eh)], $MachinePrecision], N[Abs[N[(ew * N[(t * N[(N[(t * t), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -5.5 \cdot 10^{+44}:\\
\;\;\;\;\left|ew \cdot t\right|\\
\mathbf{elif}\;ew \leq 4.6 \cdot 10^{+142}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \left(t \cdot \mathsf{fma}\left(t \cdot t, -0.16666666666666666, 1\right)\right)\right|\\
\end{array}
\end{array}
if ew < -5.5000000000000001e44Initial program 99.8%
Applied rewrites72.7%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6476.2
Applied rewrites76.2%
Taylor expanded in t around 0
Applied rewrites35.2%
if -5.5000000000000001e44 < ew < 4.60000000000000004e142Initial 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.f6449.1
Applied rewrites49.1%
Applied rewrites7.6%
Taylor expanded in eh around -inf
Applied rewrites49.5%
if 4.60000000000000004e142 < ew Initial program 99.6%
Applied rewrites73.2%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6483.5
Applied rewrites83.5%
Taylor expanded in t around 0
Applied rewrites38.7%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* ew t)))) (if (<= ew -5.5e+44) t_1 (if (<= ew 4.6e+142) (fabs (- eh)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * t));
double tmp;
if (ew <= -5.5e+44) {
tmp = t_1;
} else if (ew <= 4.6e+142) {
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 <= (-5.5d+44)) then
tmp = t_1
else if (ew <= 4.6d+142) 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 <= -5.5e+44) {
tmp = t_1;
} else if (ew <= 4.6e+142) {
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 <= -5.5e+44: tmp = t_1 elif ew <= 4.6e+142: 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 <= -5.5e+44) tmp = t_1; elseif (ew <= 4.6e+142) 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 <= -5.5e+44) tmp = t_1; elseif (ew <= 4.6e+142) 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, -5.5e+44], t$95$1, If[LessEqual[ew, 4.6e+142], N[Abs[(-eh)], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot t\right|\\
\mathbf{if}\;ew \leq -5.5 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 4.6 \cdot 10^{+142}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -5.5000000000000001e44 or 4.60000000000000004e142 < ew Initial program 99.8%
Applied rewrites72.9%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6479.2
Applied rewrites79.2%
Taylor expanded in t around 0
Applied rewrites36.4%
if -5.5000000000000001e44 < ew < 4.60000000000000004e142Initial 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.f6449.1
Applied rewrites49.1%
Applied rewrites7.6%
Taylor expanded in eh around -inf
Applied rewrites49.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(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.f6438.4
Applied rewrites38.4%
Applied rewrites6.6%
Taylor expanded in eh around -inf
Applied rewrites38.9%
herbie shell --seed 2024227
(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))))))))