
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((-eh * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* eh (tan t)) (- ew))))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh * tan(t)) / -ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((eh * tan(t)) / -ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh * Math.tan(t)) / -ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh * math.tan(t)) / -ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh * tan(t)) / Float64(-ew))) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh * tan(t)) / -ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh \cdot \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}
Initial program 99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (cos t))) (t_2 (atan (/ (* eh (tan t)) (- ew)))))
(if (<= (- (* t_1 (cos t_2)) (* (* eh (sin t)) (sin t_2))) -1e-281)
(/ 1.0 (fabs (/ 1.0 ew)))
t_1)))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
double t_2 = atan(((eh * tan(t)) / -ew));
double tmp;
if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= -1e-281) {
tmp = 1.0 / fabs((1.0 / ew));
} 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) :: t_2
real(8) :: tmp
t_1 = ew * cos(t)
t_2 = atan(((eh * tan(t)) / -ew))
if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= (-1d-281)) then
tmp = 1.0d0 / abs((1.0d0 / ew))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = ew * Math.cos(t);
double t_2 = Math.atan(((eh * Math.tan(t)) / -ew));
double tmp;
if (((t_1 * Math.cos(t_2)) - ((eh * Math.sin(t)) * Math.sin(t_2))) <= -1e-281) {
tmp = 1.0 / Math.abs((1.0 / ew));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.cos(t) t_2 = math.atan(((eh * math.tan(t)) / -ew)) tmp = 0 if ((t_1 * math.cos(t_2)) - ((eh * math.sin(t)) * math.sin(t_2))) <= -1e-281: tmp = 1.0 / math.fabs((1.0 / ew)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) t_2 = atan(Float64(Float64(eh * tan(t)) / Float64(-ew))) tmp = 0.0 if (Float64(Float64(t_1 * cos(t_2)) - Float64(Float64(eh * sin(t)) * sin(t_2))) <= -1e-281) tmp = Float64(1.0 / abs(Float64(1.0 / ew))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * cos(t); t_2 = atan(((eh * tan(t)) / -ew)); tmp = 0.0; if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= -1e-281) tmp = 1.0 / abs((1.0 / ew)); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-281], N[(1.0 / N[Abs[N[(1.0 / ew), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
t_2 := \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\\
\mathbf{if}\;t\_1 \cdot \cos t\_2 - \left(eh \cdot \sin t\right) \cdot \sin t\_2 \leq -1 \cdot 10^{-281}:\\
\;\;\;\;\frac{1}{\left|\frac{1}{ew}\right|}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew))))) < -1e-281Initial program 99.8%
Applied rewrites80.5%
Taylor expanded in t around 0
lower-/.f6443.9
Applied rewrites43.9%
if -1e-281 < (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew))))) Initial program 99.8%
Applied rewrites75.3%
Applied rewrites59.2%
Taylor expanded in ew around inf
lower-*.f64N/A
lower-cos.f6458.0
Applied rewrites58.0%
Final simplification51.0%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (* eh (tan t)) ew))
(t_2 (* (sin t) (sin (atan t_1))))
(t_3
(fabs
(*
eh
(fma
(/ 1.0 (* eh (sqrt (+ 1.0 (pow t_1 2.0)))))
(* ew (cos t))
t_2)))))
(if (<= eh -3.7e+102)
t_3
(if (<= eh 7.5e-43) (fabs (* ew (fma eh (/ t_2 ew) (cos t)))) t_3))))
double code(double eh, double ew, double t) {
double t_1 = (eh * tan(t)) / ew;
double t_2 = sin(t) * sin(atan(t_1));
double t_3 = fabs((eh * fma((1.0 / (eh * sqrt((1.0 + pow(t_1, 2.0))))), (ew * cos(t)), t_2)));
double tmp;
if (eh <= -3.7e+102) {
tmp = t_3;
} else if (eh <= 7.5e-43) {
tmp = fabs((ew * fma(eh, (t_2 / ew), cos(t))));
} else {
tmp = t_3;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(Float64(eh * tan(t)) / ew) t_2 = Float64(sin(t) * sin(atan(t_1))) t_3 = abs(Float64(eh * fma(Float64(1.0 / Float64(eh * sqrt(Float64(1.0 + (t_1 ^ 2.0))))), Float64(ew * cos(t)), t_2))) tmp = 0.0 if (eh <= -3.7e+102) tmp = t_3; elseif (eh <= 7.5e-43) tmp = abs(Float64(ew * fma(eh, Float64(t_2 / ew), cos(t)))); else tmp = t_3; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Abs[N[(eh * N[(N[(1.0 / N[(eh * N[Sqrt[N[(1.0 + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -3.7e+102], t$95$3, If[LessEqual[eh, 7.5e-43], N[Abs[N[(ew * N[(eh * N[(t$95$2 / ew), $MachinePrecision] + N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh \cdot \tan t}{ew}\\
t_2 := \sin t \cdot \sin \tan^{-1} t\_1\\
t_3 := \left|eh \cdot \mathsf{fma}\left(\frac{1}{eh \cdot \sqrt{1 + {t\_1}^{2}}}, ew \cdot \cos t, t\_2\right)\right|\\
\mathbf{if}\;eh \leq -3.7 \cdot 10^{+102}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;eh \leq 7.5 \cdot 10^{-43}:\\
\;\;\;\;\left|ew \cdot \mathsf{fma}\left(eh, \frac{t\_2}{ew}, \cos t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if eh < -3.70000000000000023e102 or 7.50000000000000068e-43 < eh Initial program 99.8%
Taylor expanded in t around 0
lower-*.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f64N/A
mul-1-negN/A
lower-neg.f6431.3
Applied rewrites31.3%
Taylor expanded in eh around inf
lower-*.f64N/A
lower--.f64N/A
Applied rewrites99.8%
Applied rewrites99.7%
if -3.70000000000000023e102 < eh < 7.50000000000000068e-43Initial program 99.8%
Taylor expanded in t around 0
lower-*.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f64N/A
mul-1-negN/A
lower-neg.f6448.6
Applied rewrites48.6%
Taylor expanded in eh around inf
lower-*.f64N/A
lower--.f64N/A
Applied rewrites81.7%
Applied rewrites81.5%
Taylor expanded in ew around inf
Applied rewrites99.5%
Final simplification99.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (sin t) (sin (atan (/ (* eh (tan t)) ew)))))
(t_2 (fabs (* eh (fma (/ 1.0 eh) (* ew (cos t)) t_1)))))
(if (<= eh -4.5e+102)
t_2
(if (<= eh 1e+38) (fabs (* ew (fma eh (/ t_1 ew) (cos t)))) t_2))))
double code(double eh, double ew, double t) {
double t_1 = sin(t) * sin(atan(((eh * tan(t)) / ew)));
double t_2 = fabs((eh * fma((1.0 / eh), (ew * cos(t)), t_1)));
double tmp;
if (eh <= -4.5e+102) {
tmp = t_2;
} else if (eh <= 1e+38) {
tmp = fabs((ew * fma(eh, (t_1 / ew), cos(t))));
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(sin(t) * sin(atan(Float64(Float64(eh * tan(t)) / ew)))) t_2 = abs(Float64(eh * fma(Float64(1.0 / eh), Float64(ew * cos(t)), t_1))) tmp = 0.0 if (eh <= -4.5e+102) tmp = t_2; elseif (eh <= 1e+38) tmp = abs(Float64(ew * fma(eh, Float64(t_1 / ew), cos(t)))); else tmp = t_2; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(eh * N[(N[(1.0 / eh), $MachinePrecision] * N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -4.5e+102], t$95$2, If[LessEqual[eh, 1e+38], N[Abs[N[(ew * N[(eh * N[(t$95$1 / ew), $MachinePrecision] + N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\\
t_2 := \left|eh \cdot \mathsf{fma}\left(\frac{1}{eh}, ew \cdot \cos t, t\_1\right)\right|\\
\mathbf{if}\;eh \leq -4.5 \cdot 10^{+102}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;eh \leq 10^{+38}:\\
\;\;\;\;\left|ew \cdot \mathsf{fma}\left(eh, \frac{t\_1}{ew}, \cos t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if eh < -4.50000000000000021e102 or 9.99999999999999977e37 < eh Initial program 99.8%
Taylor expanded in t around 0
lower-*.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f64N/A
mul-1-negN/A
lower-neg.f6427.4
Applied rewrites27.4%
Taylor expanded in eh around inf
lower-*.f64N/A
lower--.f64N/A
Applied rewrites99.8%
Applied rewrites99.7%
Taylor expanded in eh around 0
Applied rewrites98.6%
if -4.50000000000000021e102 < eh < 9.99999999999999977e37Initial program 99.8%
Taylor expanded in t around 0
lower-*.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f64N/A
mul-1-negN/A
lower-neg.f6449.1
Applied rewrites49.1%
Taylor expanded in eh around inf
lower-*.f64N/A
lower--.f64N/A
Applied rewrites83.7%
Applied rewrites83.5%
Taylor expanded in ew around inf
Applied rewrites98.9%
Final simplification98.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* eh (sin t)))))
(if (<= eh -5.8e+200)
t_1
(if (<= eh 1.3e+178)
(fabs
(*
ew
(fma
eh
(/ (* (sin t) (sin (atan (/ (* eh (tan t)) ew)))) ew)
(cos t))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (eh <= -5.8e+200) {
tmp = t_1;
} else if (eh <= 1.3e+178) {
tmp = fabs((ew * fma(eh, ((sin(t) * sin(atan(((eh * tan(t)) / ew)))) / ew), cos(t))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(eh * sin(t))) tmp = 0.0 if (eh <= -5.8e+200) tmp = t_1; elseif (eh <= 1.3e+178) tmp = abs(Float64(ew * fma(eh, Float64(Float64(sin(t) * sin(atan(Float64(Float64(eh * tan(t)) / ew)))) / ew), cos(t)))); 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[eh, -5.8e+200], t$95$1, If[LessEqual[eh, 1.3e+178], N[Abs[N[(ew * N[(eh * N[(N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] + N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;eh \leq -5.8 \cdot 10^{+200}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 1.3 \cdot 10^{+178}:\\
\;\;\;\;\left|ew \cdot \mathsf{fma}\left(eh, \frac{\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)}{ew}, \cos t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -5.7999999999999998e200 or 1.3e178 < eh 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 rewrites36.7%
Taylor expanded in ew around 0
lower-*.f64N/A
lower-sin.f6487.0
Applied rewrites87.0%
if -5.7999999999999998e200 < eh < 1.3e178Initial program 99.8%
Taylor expanded in t around 0
lower-*.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f64N/A
mul-1-negN/A
lower-neg.f6446.9
Applied rewrites46.9%
Taylor expanded in eh around inf
lower-*.f64N/A
lower--.f64N/A
Applied rewrites87.5%
Applied rewrites87.3%
Taylor expanded in ew around inf
Applied rewrites96.9%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* eh (sin t))))) (if (<= eh -7.5e+79) t_1 (if (<= eh 2.65e+39) (fabs (* ew (cos t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * sin(t)));
double tmp;
if (eh <= -7.5e+79) {
tmp = t_1;
} else if (eh <= 2.65e+39) {
tmp = fabs((ew * cos(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 * sin(t)))
if (eh <= (-7.5d+79)) then
tmp = t_1
else if (eh <= 2.65d+39) then
tmp = abs((ew * cos(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.sin(t)));
double tmp;
if (eh <= -7.5e+79) {
tmp = t_1;
} else if (eh <= 2.65e+39) {
tmp = Math.abs((ew * Math.cos(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((eh * math.sin(t))) tmp = 0 if eh <= -7.5e+79: tmp = t_1 elif eh <= 2.65e+39: tmp = math.fabs((ew * math.cos(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(eh * sin(t))) tmp = 0.0 if (eh <= -7.5e+79) tmp = t_1; elseif (eh <= 2.65e+39) tmp = abs(Float64(ew * cos(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((eh * sin(t))); tmp = 0.0; if (eh <= -7.5e+79) tmp = t_1; elseif (eh <= 2.65e+39) tmp = abs((ew * cos(t))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -7.5e+79], t$95$1, If[LessEqual[eh, 2.65e+39], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;eh \leq -7.5 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 2.65 \cdot 10^{+39}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -7.49999999999999967e79 or 2.64999999999999989e39 < eh 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 rewrites51.8%
Taylor expanded in ew around 0
lower-*.f64N/A
lower-sin.f6474.5
Applied rewrites74.5%
if -7.49999999999999967e79 < eh < 2.64999999999999989e39Initial 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 rewrites96.0%
Taylor expanded in ew around inf
lower-*.f64N/A
lower-cos.f6483.7
Applied rewrites83.7%
(FPCore (eh ew t) :precision binary64 (if (<= ew -1.8e-126) (/ 1.0 (fabs (/ 1.0 ew))) (if (<= ew 5.2e-27) (fabs (* eh (sin t))) (* ew (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -1.8e-126) {
tmp = 1.0 / fabs((1.0 / ew));
} else if (ew <= 5.2e-27) {
tmp = fabs((eh * sin(t)));
} else {
tmp = ew * cos(t);
}
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 (ew <= (-1.8d-126)) then
tmp = 1.0d0 / abs((1.0d0 / ew))
else if (ew <= 5.2d-27) then
tmp = abs((eh * sin(t)))
else
tmp = ew * cos(t)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (ew <= -1.8e-126) {
tmp = 1.0 / Math.abs((1.0 / ew));
} else if (ew <= 5.2e-27) {
tmp = Math.abs((eh * Math.sin(t)));
} else {
tmp = ew * Math.cos(t);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if ew <= -1.8e-126: tmp = 1.0 / math.fabs((1.0 / ew)) elif ew <= 5.2e-27: tmp = math.fabs((eh * math.sin(t))) else: tmp = ew * math.cos(t) return tmp
function code(eh, ew, t) tmp = 0.0 if (ew <= -1.8e-126) tmp = Float64(1.0 / abs(Float64(1.0 / ew))); elseif (ew <= 5.2e-27) tmp = abs(Float64(eh * sin(t))); else tmp = Float64(ew * cos(t)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (ew <= -1.8e-126) tmp = 1.0 / abs((1.0 / ew)); elseif (ew <= 5.2e-27) tmp = abs((eh * sin(t))); else tmp = ew * cos(t); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[ew, -1.8e-126], N[(1.0 / N[Abs[N[(1.0 / ew), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[ew, 5.2e-27], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.8 \cdot 10^{-126}:\\
\;\;\;\;\frac{1}{\left|\frac{1}{ew}\right|}\\
\mathbf{elif}\;ew \leq 5.2 \cdot 10^{-27}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;ew \cdot \cos t\\
\end{array}
\end{array}
if ew < -1.8e-126Initial program 99.7%
Applied rewrites91.7%
Taylor expanded in t around 0
lower-/.f6450.0
Applied rewrites50.0%
if -1.8e-126 < ew < 5.20000000000000034e-27Initial program 99.9%
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.f6476.1
Applied rewrites76.1%
if 5.20000000000000034e-27 < ew Initial program 99.8%
Applied rewrites92.5%
Applied rewrites48.3%
Taylor expanded in ew around inf
lower-*.f64N/A
lower-cos.f6459.8
Applied rewrites59.8%
(FPCore (eh ew t) :precision binary64 (if (<= ew -1.6e-127) (/ 1.0 (fabs (/ 1.0 ew))) (if (<= ew 3.8e-34) (fabs (* t eh)) (/ 1.0 (/ 1.0 ew)))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -1.6e-127) {
tmp = 1.0 / fabs((1.0 / ew));
} else if (ew <= 3.8e-34) {
tmp = fabs((t * eh));
} else {
tmp = 1.0 / (1.0 / ew);
}
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 (ew <= (-1.6d-127)) then
tmp = 1.0d0 / abs((1.0d0 / ew))
else if (ew <= 3.8d-34) then
tmp = abs((t * eh))
else
tmp = 1.0d0 / (1.0d0 / ew)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (ew <= -1.6e-127) {
tmp = 1.0 / Math.abs((1.0 / ew));
} else if (ew <= 3.8e-34) {
tmp = Math.abs((t * eh));
} else {
tmp = 1.0 / (1.0 / ew);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if ew <= -1.6e-127: tmp = 1.0 / math.fabs((1.0 / ew)) elif ew <= 3.8e-34: tmp = math.fabs((t * eh)) else: tmp = 1.0 / (1.0 / ew) return tmp
function code(eh, ew, t) tmp = 0.0 if (ew <= -1.6e-127) tmp = Float64(1.0 / abs(Float64(1.0 / ew))); elseif (ew <= 3.8e-34) tmp = abs(Float64(t * eh)); else tmp = Float64(1.0 / Float64(1.0 / ew)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (ew <= -1.6e-127) tmp = 1.0 / abs((1.0 / ew)); elseif (ew <= 3.8e-34) tmp = abs((t * eh)); else tmp = 1.0 / (1.0 / ew); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[ew, -1.6e-127], N[(1.0 / N[Abs[N[(1.0 / ew), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[ew, 3.8e-34], N[Abs[N[(t * eh), $MachinePrecision]], $MachinePrecision], N[(1.0 / N[(1.0 / ew), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.6 \cdot 10^{-127}:\\
\;\;\;\;\frac{1}{\left|\frac{1}{ew}\right|}\\
\mathbf{elif}\;ew \leq 3.8 \cdot 10^{-34}:\\
\;\;\;\;\left|t \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{ew}}\\
\end{array}
\end{array}
if ew < -1.60000000000000009e-127Initial program 99.7%
Applied rewrites91.7%
Taylor expanded in t around 0
lower-/.f6450.0
Applied rewrites50.0%
if -1.60000000000000009e-127 < ew < 3.8000000000000001e-34Initial program 99.9%
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.1%
Taylor expanded in ew around 0
lower-*.f64N/A
lower-sin.f6475.9
Applied rewrites75.9%
Taylor expanded in t around 0
Applied rewrites44.8%
if 3.8000000000000001e-34 < ew Initial program 99.8%
Applied rewrites92.6%
Applied rewrites49.1%
Taylor expanded in t around 0
lower-/.f6448.6
Applied rewrites48.6%
(FPCore (eh ew t) :precision binary64 (if (<= ew -1.65e-127) (fabs (* eh (/ ew eh))) (if (<= ew 3.8e-34) (fabs (* t eh)) (/ 1.0 (/ 1.0 ew)))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -1.65e-127) {
tmp = fabs((eh * (ew / eh)));
} else if (ew <= 3.8e-34) {
tmp = fabs((t * eh));
} else {
tmp = 1.0 / (1.0 / ew);
}
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 (ew <= (-1.65d-127)) then
tmp = abs((eh * (ew / eh)))
else if (ew <= 3.8d-34) then
tmp = abs((t * eh))
else
tmp = 1.0d0 / (1.0d0 / ew)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (ew <= -1.65e-127) {
tmp = Math.abs((eh * (ew / eh)));
} else if (ew <= 3.8e-34) {
tmp = Math.abs((t * eh));
} else {
tmp = 1.0 / (1.0 / ew);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if ew <= -1.65e-127: tmp = math.fabs((eh * (ew / eh))) elif ew <= 3.8e-34: tmp = math.fabs((t * eh)) else: tmp = 1.0 / (1.0 / ew) return tmp
function code(eh, ew, t) tmp = 0.0 if (ew <= -1.65e-127) tmp = abs(Float64(eh * Float64(ew / eh))); elseif (ew <= 3.8e-34) tmp = abs(Float64(t * eh)); else tmp = Float64(1.0 / Float64(1.0 / ew)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (ew <= -1.65e-127) tmp = abs((eh * (ew / eh))); elseif (ew <= 3.8e-34) tmp = abs((t * eh)); else tmp = 1.0 / (1.0 / ew); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[ew, -1.65e-127], N[Abs[N[(eh * N[(ew / eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 3.8e-34], N[Abs[N[(t * eh), $MachinePrecision]], $MachinePrecision], N[(1.0 / N[(1.0 / ew), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.65 \cdot 10^{-127}:\\
\;\;\;\;\left|eh \cdot \frac{ew}{eh}\right|\\
\mathbf{elif}\;ew \leq 3.8 \cdot 10^{-34}:\\
\;\;\;\;\left|t \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{ew}}\\
\end{array}
\end{array}
if ew < -1.6499999999999999e-127Initial program 99.7%
Taylor expanded in t around 0
lower-*.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f64N/A
mul-1-negN/A
lower-neg.f6450.0
Applied rewrites50.0%
Taylor expanded in eh around inf
lower-*.f64N/A
lower--.f64N/A
Applied rewrites85.3%
Applied rewrites85.1%
Taylor expanded in t around 0
Applied rewrites43.7%
if -1.6499999999999999e-127 < ew < 3.8000000000000001e-34Initial program 99.9%
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.1%
Taylor expanded in ew around 0
lower-*.f64N/A
lower-sin.f6475.9
Applied rewrites75.9%
Taylor expanded in t around 0
Applied rewrites44.8%
if 3.8000000000000001e-34 < ew Initial program 99.8%
Applied rewrites92.6%
Applied rewrites49.1%
Taylor expanded in t around 0
lower-/.f6448.6
Applied rewrites48.6%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* eh (/ ew eh))))) (if (<= ew -1.65e-127) t_1 (if (<= ew 3.8e-34) (fabs (* t eh)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * (ew / eh)));
double tmp;
if (ew <= -1.65e-127) {
tmp = t_1;
} else if (ew <= 3.8e-34) {
tmp = fabs((t * 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((eh * (ew / eh)))
if (ew <= (-1.65d-127)) then
tmp = t_1
else if (ew <= 3.8d-34) then
tmp = abs((t * 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((eh * (ew / eh)));
double tmp;
if (ew <= -1.65e-127) {
tmp = t_1;
} else if (ew <= 3.8e-34) {
tmp = Math.abs((t * eh));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((eh * (ew / eh))) tmp = 0 if ew <= -1.65e-127: tmp = t_1 elif ew <= 3.8e-34: tmp = math.fabs((t * eh)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(eh * Float64(ew / eh))) tmp = 0.0 if (ew <= -1.65e-127) tmp = t_1; elseif (ew <= 3.8e-34) tmp = abs(Float64(t * eh)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((eh * (ew / eh))); tmp = 0.0; if (ew <= -1.65e-127) tmp = t_1; elseif (ew <= 3.8e-34) tmp = abs((t * eh)); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[(ew / eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -1.65e-127], t$95$1, If[LessEqual[ew, 3.8e-34], N[Abs[N[(t * eh), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \frac{ew}{eh}\right|\\
\mathbf{if}\;ew \leq -1.65 \cdot 10^{-127}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 3.8 \cdot 10^{-34}:\\
\;\;\;\;\left|t \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -1.6499999999999999e-127 or 3.8000000000000001e-34 < ew Initial program 99.8%
Taylor expanded in t around 0
lower-*.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
lower-*.f64N/A
lower-tan.f64N/A
mul-1-negN/A
lower-neg.f6449.5
Applied rewrites49.5%
Taylor expanded in eh around inf
lower-*.f64N/A
lower--.f64N/A
Applied rewrites84.3%
Applied rewrites84.1%
Taylor expanded in t around 0
Applied rewrites42.6%
if -1.6499999999999999e-127 < ew < 3.8000000000000001e-34Initial program 99.9%
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.1%
Taylor expanded in ew around 0
lower-*.f64N/A
lower-sin.f6475.9
Applied rewrites75.9%
Taylor expanded in t around 0
Applied rewrites44.8%
(FPCore (eh ew t) :precision binary64 (fabs (* t eh)))
double code(double eh, double ew, double t) {
return fabs((t * 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((t * eh))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((t * eh));
}
def code(eh, ew, t): return math.fabs((t * eh))
function code(eh, ew, t) return abs(Float64(t * eh)) end
function tmp = code(eh, ew, t) tmp = abs((t * eh)); end
code[eh_, ew_, t_] := N[Abs[N[(t * eh), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|t \cdot eh\right|
\end{array}
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 rewrites78.0%
Taylor expanded in ew around 0
lower-*.f64N/A
lower-sin.f6442.3
Applied rewrites42.3%
Taylor expanded in t around 0
Applied rewrites23.2%
herbie shell --seed 2024237
(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)))))))