
(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 8 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(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}
Initial program 99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (sin t))))
(fabs
(-
(* (* ew (cos t)) (cos (atan (/ t_1 ew))))
(* t_1 (sin (atan (/ (* (- eh) (tan t)) ew))))))))
double code(double eh, double ew, double t) {
double t_1 = eh * sin(t);
return fabs((((ew * cos(t)) * cos(atan((t_1 / ew)))) - (t_1 * sin(atan(((-eh * tan(t)) / ew))))));
}
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 = eh * sin(t)
code = abs((((ew * cos(t)) * cos(atan((t_1 / ew)))) - (t_1 * sin(atan(((-eh * tan(t)) / ew))))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = eh * Math.sin(t);
return Math.abs((((ew * Math.cos(t)) * Math.cos(Math.atan((t_1 / ew)))) - (t_1 * Math.sin(Math.atan(((-eh * Math.tan(t)) / ew))))));
}
def code(eh, ew, t): t_1 = eh * math.sin(t) return math.fabs((((ew * math.cos(t)) * math.cos(math.atan((t_1 / ew)))) - (t_1 * math.sin(math.atan(((-eh * math.tan(t)) / ew))))))
function code(eh, ew, t) t_1 = Float64(eh * sin(t)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(atan(Float64(t_1 / ew)))) - Float64(t_1 * sin(atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)))))) end
function tmp = code(eh, ew, t) t_1 = eh * sin(t); tmp = abs((((ew * cos(t)) * cos(atan((t_1 / ew)))) - (t_1 * sin(atan(((-eh * tan(t)) / ew)))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(t$95$1 / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * N[Sin[N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \sin t\\
\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{t\_1}{ew}\right) - t\_1 \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in eh around 0
Applied rewrites99.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (sin t))))
(fabs
(-
(* (* ew (cos t)) (cos (atan (/ t_1 ew))))
(* t_1 (sin (atan (/ (- eh) ew))))))))
double code(double eh, double ew, double t) {
double t_1 = eh * sin(t);
return fabs((((ew * cos(t)) * cos(atan((t_1 / ew)))) - (t_1 * sin(atan((-eh / ew))))));
}
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 = eh * sin(t)
code = abs((((ew * cos(t)) * cos(atan((t_1 / ew)))) - (t_1 * sin(atan((-eh / ew))))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = eh * Math.sin(t);
return Math.abs((((ew * Math.cos(t)) * Math.cos(Math.atan((t_1 / ew)))) - (t_1 * Math.sin(Math.atan((-eh / ew))))));
}
def code(eh, ew, t): t_1 = eh * math.sin(t) return math.fabs((((ew * math.cos(t)) * math.cos(math.atan((t_1 / ew)))) - (t_1 * math.sin(math.atan((-eh / ew))))))
function code(eh, ew, t) t_1 = Float64(eh * sin(t)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(atan(Float64(t_1 / ew)))) - Float64(t_1 * sin(atan(Float64(Float64(-eh) / ew)))))) end
function tmp = code(eh, ew, t) t_1 = eh * sin(t); tmp = abs((((ew * cos(t)) * cos(atan((t_1 / ew)))) - (t_1 * sin(atan((-eh / ew)))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(t$95$1 / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * N[Sin[N[ArcTan[N[((-eh) / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \sin t\\
\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{t\_1}{ew}\right) - t\_1 \cdot \sin \tan^{-1} \left(\frac{-eh}{ew}\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in eh around 0
Applied rewrites99.7%
Taylor expanded in eh around 0
Applied rewrites98.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (sin t))) (t_2 (* ew (cos t))) (t_3 (atan (/ (- eh) ew))))
(if (<= ew -5e+83)
(fabs (- (* t_2 (cos t_3)) (* t_1 (sin t_3))))
(if (<= ew 6.7e+78)
(fabs
(-
(* t_2 (cos (atan (/ (* eh (- eh)) ew))))
(* t_1 (sin (atan (/ (fabs (- eh)) ew))))))
(fabs t_2)))))
double code(double eh, double ew, double t) {
double t_1 = eh * sin(t);
double t_2 = ew * cos(t);
double t_3 = atan((-eh / ew));
double tmp;
if (ew <= -5e+83) {
tmp = fabs(((t_2 * cos(t_3)) - (t_1 * sin(t_3))));
} else if (ew <= 6.7e+78) {
tmp = fabs(((t_2 * cos(atan(((eh * -eh) / ew)))) - (t_1 * sin(atan((fabs(-eh) / ew))))));
} else {
tmp = fabs(t_2);
}
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) :: t_3
real(8) :: tmp
t_1 = eh * sin(t)
t_2 = ew * cos(t)
t_3 = atan((-eh / ew))
if (ew <= (-5d+83)) then
tmp = abs(((t_2 * cos(t_3)) - (t_1 * sin(t_3))))
else if (ew <= 6.7d+78) then
tmp = abs(((t_2 * cos(atan(((eh * -eh) / ew)))) - (t_1 * sin(atan((abs(-eh) / ew))))))
else
tmp = abs(t_2)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = eh * Math.sin(t);
double t_2 = ew * Math.cos(t);
double t_3 = Math.atan((-eh / ew));
double tmp;
if (ew <= -5e+83) {
tmp = Math.abs(((t_2 * Math.cos(t_3)) - (t_1 * Math.sin(t_3))));
} else if (ew <= 6.7e+78) {
tmp = Math.abs(((t_2 * Math.cos(Math.atan(((eh * -eh) / ew)))) - (t_1 * Math.sin(Math.atan((Math.abs(-eh) / ew))))));
} else {
tmp = Math.abs(t_2);
}
return tmp;
}
def code(eh, ew, t): t_1 = eh * math.sin(t) t_2 = ew * math.cos(t) t_3 = math.atan((-eh / ew)) tmp = 0 if ew <= -5e+83: tmp = math.fabs(((t_2 * math.cos(t_3)) - (t_1 * math.sin(t_3)))) elif ew <= 6.7e+78: tmp = math.fabs(((t_2 * math.cos(math.atan(((eh * -eh) / ew)))) - (t_1 * math.sin(math.atan((math.fabs(-eh) / ew)))))) else: tmp = math.fabs(t_2) return tmp
function code(eh, ew, t) t_1 = Float64(eh * sin(t)) t_2 = Float64(ew * cos(t)) t_3 = atan(Float64(Float64(-eh) / ew)) tmp = 0.0 if (ew <= -5e+83) tmp = abs(Float64(Float64(t_2 * cos(t_3)) - Float64(t_1 * sin(t_3)))); elseif (ew <= 6.7e+78) tmp = abs(Float64(Float64(t_2 * cos(atan(Float64(Float64(eh * Float64(-eh)) / ew)))) - Float64(t_1 * sin(atan(Float64(abs(Float64(-eh)) / ew)))))); else tmp = abs(t_2); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh * sin(t); t_2 = ew * cos(t); t_3 = atan((-eh / ew)); tmp = 0.0; if (ew <= -5e+83) tmp = abs(((t_2 * cos(t_3)) - (t_1 * sin(t_3)))); elseif (ew <= 6.7e+78) tmp = abs(((t_2 * cos(atan(((eh * -eh) / ew)))) - (t_1 * sin(atan((abs(-eh) / ew)))))); else tmp = abs(t_2); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[ArcTan[N[((-eh) / ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -5e+83], N[Abs[N[(N[(t$95$2 * N[Cos[t$95$3], $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * N[Sin[t$95$3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 6.7e+78], N[Abs[N[(N[(t$95$2 * N[Cos[N[ArcTan[N[(N[(eh * (-eh)), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * N[Sin[N[ArcTan[N[(N[Abs[(-eh)], $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[t$95$2], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \sin t\\
t_2 := ew \cdot \cos t\\
t_3 := \tan^{-1} \left(\frac{-eh}{ew}\right)\\
\mathbf{if}\;ew \leq -5 \cdot 10^{+83}:\\
\;\;\;\;\left|t\_2 \cdot \cos t\_3 - t\_1 \cdot \sin t\_3\right|\\
\mathbf{elif}\;ew \leq 6.7 \cdot 10^{+78}:\\
\;\;\;\;\left|t\_2 \cdot \cos \tan^{-1} \left(\frac{eh \cdot \left(-eh\right)}{ew}\right) - t\_1 \cdot \sin \tan^{-1} \left(\frac{\left|-eh\right|}{ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t\_2\right|\\
\end{array}
\end{array}
if ew < -5.00000000000000029e83Initial program 99.8%
Taylor expanded in eh around 0
Applied rewrites99.0%
Taylor expanded in eh around 0
Applied rewrites98.7%
Taylor expanded in eh around 0
Applied rewrites90.1%
if -5.00000000000000029e83 < ew < 6.69999999999999967e78Initial program 99.9%
Taylor expanded in eh around 0
Applied rewrites99.9%
Taylor expanded in eh around 0
Applied rewrites98.9%
Taylor expanded in eh around 0
Applied rewrites98.9%
Taylor expanded in t around 0
Applied rewrites93.4%
if 6.69999999999999967e78 < ew Initial program 99.9%
Taylor expanded in eh around inf
Applied rewrites6.9%
Taylor expanded in t around 0
Applied rewrites92.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (cos t)))
(t_2 (atan (/ (- eh) ew)))
(t_3 (fabs (- (* t_1 (cos t_2)) (* (* eh (sin t)) (sin t_2))))))
(if (<= t -3.6e-91) t_3 (if (<= t 3.6e-282) (fabs t_1) t_3))))
double code(double eh, double ew, double t) {
double t_1 = ew * cos(t);
double t_2 = atan((-eh / ew));
double t_3 = fabs(((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))));
double tmp;
if (t <= -3.6e-91) {
tmp = t_3;
} else if (t <= 3.6e-282) {
tmp = fabs(t_1);
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_1 = ew * cos(t)
t_2 = atan((-eh / ew))
t_3 = abs(((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))))
if (t <= (-3.6d-91)) then
tmp = t_3
else if (t <= 3.6d-282) then
tmp = abs(t_1)
else
tmp = t_3
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 / ew));
double t_3 = Math.abs(((t_1 * Math.cos(t_2)) - ((eh * Math.sin(t)) * Math.sin(t_2))));
double tmp;
if (t <= -3.6e-91) {
tmp = t_3;
} else if (t <= 3.6e-282) {
tmp = Math.abs(t_1);
} else {
tmp = t_3;
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.cos(t) t_2 = math.atan((-eh / ew)) t_3 = math.fabs(((t_1 * math.cos(t_2)) - ((eh * math.sin(t)) * math.sin(t_2)))) tmp = 0 if t <= -3.6e-91: tmp = t_3 elif t <= 3.6e-282: tmp = math.fabs(t_1) else: tmp = t_3 return tmp
function code(eh, ew, t) t_1 = Float64(ew * cos(t)) t_2 = atan(Float64(Float64(-eh) / ew)) t_3 = abs(Float64(Float64(t_1 * cos(t_2)) - Float64(Float64(eh * sin(t)) * sin(t_2)))) tmp = 0.0 if (t <= -3.6e-91) tmp = t_3; elseif (t <= 3.6e-282) tmp = abs(t_1); else tmp = t_3; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * cos(t); t_2 = atan((-eh / ew)); t_3 = abs(((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2)))); tmp = 0.0; if (t <= -3.6e-91) tmp = t_3; elseif (t <= 3.6e-282) tmp = abs(t_1); else tmp = t_3; 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[((-eh) / ew), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Abs[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]], $MachinePrecision]}, If[LessEqual[t, -3.6e-91], t$95$3, If[LessEqual[t, 3.6e-282], N[Abs[t$95$1], $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
t_2 := \tan^{-1} \left(\frac{-eh}{ew}\right)\\
t_3 := \left|t\_1 \cdot \cos t\_2 - \left(eh \cdot \sin t\right) \cdot \sin t\_2\right|\\
\mathbf{if}\;t \leq -3.6 \cdot 10^{-91}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{-282}:\\
\;\;\;\;\left|t\_1\right|\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if t < -3.6e-91 or 3.5999999999999998e-282 < t Initial program 99.8%
Taylor expanded in eh around 0
Applied rewrites99.6%
Taylor expanded in eh around 0
Applied rewrites98.6%
Taylor expanded in eh around 0
Applied rewrites94.0%
if -3.6e-91 < t < 3.5999999999999998e-282Initial program 100.0%
Taylor expanded in eh around inf
Applied rewrites17.9%
Taylor expanded in t around 0
Applied rewrites86.5%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* eh (sin t))))) (if (<= eh -7.5e+105) t_1 (if (<= eh 4.4e+111) (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+105) {
tmp = t_1;
} else if (eh <= 4.4e+111) {
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+105)) then
tmp = t_1
else if (eh <= 4.4d+111) 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+105) {
tmp = t_1;
} else if (eh <= 4.4e+111) {
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+105: tmp = t_1 elif eh <= 4.4e+111: 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+105) tmp = t_1; elseif (eh <= 4.4e+111) 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+105) tmp = t_1; elseif (eh <= 4.4e+111) 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+105], t$95$1, If[LessEqual[eh, 4.4e+111], 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^{+105}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 4.4 \cdot 10^{+111}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -7.5000000000000002e105 or 4.39999999999999997e111 < eh Initial program 99.8%
Taylor expanded in eh around inf
Applied rewrites38.8%
Taylor expanded in t around 0
Applied rewrites74.1%
if -7.5000000000000002e105 < eh < 4.39999999999999997e111Initial program 99.9%
Taylor expanded in eh around inf
Applied rewrites11.8%
Taylor expanded in t around 0
Applied rewrites82.5%
(FPCore (eh ew t) :precision binary64 (fabs (* ew (cos t))))
double code(double eh, double ew, double t) {
return fabs((ew * cos(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((ew * cos(t)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * Math.cos(t)));
}
def code(eh, ew, t): return math.fabs((ew * math.cos(t)))
function code(eh, ew, t) return abs(Float64(ew * cos(t))) end
function tmp = code(eh, ew, t) tmp = abs((ew * cos(t))); end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t\right|
\end{array}
Initial program 99.8%
Taylor expanded in eh around inf
Applied rewrites22.4%
Taylor expanded in t around 0
Applied rewrites61.4%
(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 eh around inf
Applied rewrites22.4%
Taylor expanded in eh around 0
Applied rewrites9.4%
herbie shell --seed 2024321
(FPCore (eh ew t)
:name "Example 2 from Robby"
:precision binary64
:pre (TRUE)
(fabs (- (* (* ew (cos t)) (cos (atan (/ (* (- eh) (tan t)) ew)))) (* (* eh (sin t)) (sin (atan (/ (* (- eh) (tan t)) ew)))))))