
(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 10 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 (+ (* (* 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}
Initial program 99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* (* ew (sin t)) (cos (atan (/ eh (* ew t))))))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * 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((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + ((ew * Math.sin(t)) * Math.cos(Math.atan((eh / (ew * t)))))));
}
def code(eh, ew, t): return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + ((ew * math.sin(t)) * math.cos(math.atan((eh / (ew * t)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(Float64(ew * sin(t)) * cos(atan(Float64(eh / Float64(ew * t))))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.2
Applied rewrites99.2%
Final simplification99.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%
Applied rewrites88.5%
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
(let* ((t_1
(fabs
(*
ew
(fma
(cos t)
(*
eh
(/
(sin
(atan
(/
(fma -0.3333333333333333 (* eh (/ (* t t) ew)) (/ eh ew))
t)))
ew))
(sin t))))))
(if (<= ew -5.3e-157)
t_1
(if (<= ew 3.2e-47)
(fabs (* (* eh (cos t)) (sin (atan (/ eh (* ew (tan t)))))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * fma(cos(t), (eh * (sin(atan((fma(-0.3333333333333333, (eh * ((t * t) / ew)), (eh / ew)) / t))) / ew)), sin(t))));
double tmp;
if (ew <= -5.3e-157) {
tmp = t_1;
} else if (ew <= 3.2e-47) {
tmp = fabs(((eh * cos(t)) * sin(atan((eh / (ew * tan(t)))))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(ew * fma(cos(t), Float64(eh * Float64(sin(atan(Float64(fma(-0.3333333333333333, Float64(eh * Float64(Float64(t * t) / ew)), Float64(eh / ew)) / t))) / ew)), sin(t)))) tmp = 0.0 if (ew <= -5.3e-157) tmp = t_1; elseif (ew <= 3.2e-47) tmp = abs(Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * tan(t))))))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[(N[Cos[t], $MachinePrecision] * N[(eh * N[(N[Sin[N[ArcTan[N[(N[(-0.3333333333333333 * N[(eh * N[(N[(t * t), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] + N[(eh / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] + N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -5.3e-157], t$95$1, If[LessEqual[ew, 3.2e-47], 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], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \mathsf{fma}\left(\cos t, eh \cdot \frac{\sin \tan^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, eh \cdot \frac{t \cdot t}{ew}, \frac{eh}{ew}\right)}{t}\right)}{ew}, \sin t\right)\right|\\
\mathbf{if}\;ew \leq -5.3 \cdot 10^{-157}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 3.2 \cdot 10^{-47}:\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -5.3000000000000002e-157 or 3.1999999999999999e-47 < ew Initial program 99.8%
Applied rewrites89.1%
Taylor expanded in ew around inf
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites97.2%
lift-cos.f64N/A
lift-tan.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-atan.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
Applied rewrites97.2%
Taylor expanded in t around 0
lower-/.f64N/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f6496.9
Applied rewrites96.9%
if -5.3000000000000002e-157 < ew < 3.1999999999999999e-47Initial 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.f6494.0
Applied rewrites94.0%
Final simplification95.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(fabs
(*
ew
(fma (cos t) (* eh (/ (sin (atan (/ eh (* ew t)))) ew)) (sin t))))))
(if (<= ew -3.8e-38)
t_1
(if (<= ew 8.5e-8)
(fabs (* (* eh (cos t)) (sin (atan (/ eh (* ew (tan t)))))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * fma(cos(t), (eh * (sin(atan((eh / (ew * t)))) / ew)), sin(t))));
double tmp;
if (ew <= -3.8e-38) {
tmp = t_1;
} else if (ew <= 8.5e-8) {
tmp = fabs(((eh * cos(t)) * sin(atan((eh / (ew * tan(t)))))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(ew * fma(cos(t), Float64(eh * Float64(sin(atan(Float64(eh / Float64(ew * t)))) / ew)), sin(t)))) tmp = 0.0 if (ew <= -3.8e-38) tmp = t_1; elseif (ew <= 8.5e-8) tmp = abs(Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * tan(t))))))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[(N[Cos[t], $MachinePrecision] * N[(eh * N[(N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] + N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -3.8e-38], t$95$1, If[LessEqual[ew, 8.5e-8], 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], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \mathsf{fma}\left(\cos t, eh \cdot \frac{\sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)}{ew}, \sin t\right)\right|\\
\mathbf{if}\;ew \leq -3.8 \cdot 10^{-38}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 8.5 \cdot 10^{-8}:\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -3.8e-38 or 8.49999999999999935e-8 < ew Initial program 99.8%
Applied rewrites89.3%
Taylor expanded in ew around inf
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites98.2%
lift-cos.f64N/A
lift-tan.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-atan.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
Applied rewrites98.1%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6493.4
Applied rewrites93.4%
if -3.8e-38 < ew < 8.49999999999999935e-8Initial 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.f6491.0
Applied rewrites91.0%
Final simplification92.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* ew (sin t)))))
(if (<= ew -7.5e+105)
t_1
(if (<= ew 2.6e+91)
(fabs (* (* eh (cos t)) (sin (atan (/ eh (* ew (tan t)))))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * sin(t)));
double tmp;
if (ew <= -7.5e+105) {
tmp = t_1;
} else if (ew <= 2.6e+91) {
tmp = fabs(((eh * cos(t)) * sin(atan((eh / (ew * tan(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 * sin(t)))
if (ew <= (-7.5d+105)) then
tmp = t_1
else if (ew <= 2.6d+91) then
tmp = abs(((eh * cos(t)) * sin(atan((eh / (ew * tan(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.sin(t)));
double tmp;
if (ew <= -7.5e+105) {
tmp = t_1;
} else if (ew <= 2.6e+91) {
tmp = Math.abs(((eh * Math.cos(t)) * Math.sin(Math.atan((eh / (ew * Math.tan(t)))))));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((ew * math.sin(t))) tmp = 0 if ew <= -7.5e+105: tmp = t_1 elif ew <= 2.6e+91: tmp = math.fabs(((eh * math.cos(t)) * math.sin(math.atan((eh / (ew * math.tan(t))))))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(ew * sin(t))) tmp = 0.0 if (ew <= -7.5e+105) tmp = t_1; elseif (ew <= 2.6e+91) tmp = abs(Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * tan(t))))))); 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 (ew <= -7.5e+105) tmp = t_1; elseif (ew <= 2.6e+91) tmp = abs(((eh * cos(t)) * sin(atan((eh / (ew * tan(t))))))); 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[ew, -7.5e+105], t$95$1, If[LessEqual[ew, 2.6e+91], 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], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \sin t\right|\\
\mathbf{if}\;ew \leq -7.5 \cdot 10^{+105}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 2.6 \cdot 10^{+91}:\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -7.5000000000000002e105 or 2.6e91 < ew Initial program 99.8%
Applied rewrites86.0%
Taylor expanded in ew around inf
lower-*.f64N/A
lower-sin.f6474.9
Applied rewrites74.9%
if -7.5000000000000002e105 < ew < 2.6e91Initial 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.f6481.7
Applied rewrites81.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* ew (sin t)))))
(if (<= t -900000000.0)
t_1
(if (<= t 0.00019)
(fabs (* ew (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 <= -900000000.0) {
tmp = t_1;
} else if (t <= 0.00019) {
tmp = fabs((ew * 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 <= -900000000.0) tmp = t_1; elseif (t <= 0.00019) tmp = abs(Float64(ew * fma(eh, Float64(sin(atan(Float64(eh / Float64(ew * tan(t))))) / 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, -900000000.0], t$95$1, If[LessEqual[t, 0.00019], N[Abs[N[(ew * N[(eh * N[(N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / ew), $MachinePrecision] + 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 -900000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 0.00019:\\
\;\;\;\;\left|ew \cdot \mathsf{fma}\left(eh, \frac{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}{ew}, t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9e8 or 1.9000000000000001e-4 < t Initial program 99.6%
Applied rewrites89.5%
Taylor expanded in ew around inf
lower-*.f64N/A
lower-sin.f6448.2
Applied rewrites48.2%
if -9e8 < t < 1.9000000000000001e-4Initial program 100.0%
Applied rewrites87.7%
Taylor expanded in ew around inf
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites86.3%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f6483.2
Applied rewrites83.2%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* ew (sin t))))) (if (<= t -900000000.0) t_1 (if (<= t 2.2e-6) (fabs eh) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * sin(t)));
double tmp;
if (t <= -900000000.0) {
tmp = t_1;
} else if (t <= 2.2e-6) {
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 <= (-900000000.0d0)) then
tmp = t_1
else if (t <= 2.2d-6) 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 <= -900000000.0) {
tmp = t_1;
} else if (t <= 2.2e-6) {
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 <= -900000000.0: tmp = t_1 elif t <= 2.2e-6: 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 <= -900000000.0) tmp = t_1; elseif (t <= 2.2e-6) tmp = abs(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 <= -900000000.0) tmp = t_1; elseif (t <= 2.2e-6) 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, -900000000.0], t$95$1, If[LessEqual[t, 2.2e-6], 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 -900000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{-6}:\\
\;\;\;\;\left|eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9e8 or 2.2000000000000001e-6 < t Initial program 99.6%
Applied rewrites89.5%
Taylor expanded in ew around inf
lower-*.f64N/A
lower-sin.f6448.2
Applied rewrites48.2%
if -9e8 < t < 2.2000000000000001e-6Initial 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.f6472.8
Applied rewrites72.8%
Applied rewrites11.5%
Taylor expanded in eh around -inf
mul-1-negN/A
lower-neg.f6473.1
Applied rewrites73.1%
fabs-negN/A
lower-fabs.f6473.1
Applied rewrites73.1%
(FPCore (eh ew t) :precision binary64 (if (<= eh -5.1e-202) (fabs eh) (if (<= eh 3.8e-148) (fabs (* ew t)) (fabs eh))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -5.1e-202) {
tmp = fabs(eh);
} else if (eh <= 3.8e-148) {
tmp = fabs((ew * t));
} else {
tmp = fabs(eh);
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: tmp
if (eh <= (-5.1d-202)) then
tmp = abs(eh)
else if (eh <= 3.8d-148) then
tmp = abs((ew * t))
else
tmp = abs(eh)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (eh <= -5.1e-202) {
tmp = Math.abs(eh);
} else if (eh <= 3.8e-148) {
tmp = Math.abs((ew * t));
} else {
tmp = Math.abs(eh);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= -5.1e-202: tmp = math.fabs(eh) elif eh <= 3.8e-148: tmp = math.fabs((ew * t)) else: tmp = math.fabs(eh) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= -5.1e-202) tmp = abs(eh); elseif (eh <= 3.8e-148) tmp = abs(Float64(ew * t)); else tmp = abs(eh); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (eh <= -5.1e-202) tmp = abs(eh); elseif (eh <= 3.8e-148) tmp = abs((ew * t)); else tmp = abs(eh); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, -5.1e-202], N[Abs[eh], $MachinePrecision], If[LessEqual[eh, 3.8e-148], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision], N[Abs[eh], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -5.1 \cdot 10^{-202}:\\
\;\;\;\;\left|eh\right|\\
\mathbf{elif}\;eh \leq 3.8 \cdot 10^{-148}:\\
\;\;\;\;\left|ew \cdot t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh\right|\\
\end{array}
\end{array}
if eh < -5.09999999999999996e-202 or 3.80000000000000014e-148 < eh 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.f6453.9
Applied rewrites53.9%
Applied rewrites10.3%
Taylor expanded in eh around -inf
mul-1-negN/A
lower-neg.f6454.2
Applied rewrites54.2%
fabs-negN/A
lower-fabs.f6454.2
Applied rewrites54.2%
if -5.09999999999999996e-202 < eh < 3.80000000000000014e-148Initial program 99.8%
Applied rewrites72.5%
Taylor expanded in ew around inf
lower-*.f64N/A
lower-sin.f6485.2
Applied rewrites85.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6442.4
Applied rewrites42.4%
Final simplification52.2%
(FPCore (eh ew t) :precision binary64 (fabs eh))
double code(double eh, double ew, double t) {
return fabs(eh);
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs(eh)
end function
public static double code(double eh, double ew, double t) {
return Math.abs(eh);
}
def code(eh, ew, t): return math.fabs(eh)
function code(eh, ew, t) return abs(eh) end
function tmp = code(eh, ew, t) tmp = abs(eh); end
code[eh_, ew_, t_] := N[Abs[eh], $MachinePrecision]
\begin{array}{l}
\\
\left|eh\right|
\end{array}
Initial program 99.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.f6447.5
Applied rewrites47.5%
Applied rewrites9.1%
Taylor expanded in eh around -inf
mul-1-negN/A
lower-neg.f6447.9
Applied rewrites47.9%
fabs-negN/A
lower-fabs.f6447.9
Applied rewrites47.9%
herbie shell --seed 2024214
(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))))))))