
(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 9 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(eh * Float64(tan(t) / Float64(-ew)))) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(eh * Float64(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[(eh * N[(N[Tan[t], $MachinePrecision] / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - eh \cdot \left(\sin t \cdot \sin t\_1\right)\right|
\end{array}
\end{array}
Initial program 99.8%
sub-neg99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
associate-/l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* eh (sin t)) (* eh (/ -1.0 eh))) (* (* ew (cos t)) (/ -1.0 (hypot 1.0 (* (tan t) (/ eh ew))))))))
double code(double eh, double ew, double t) {
return fabs((((eh * sin(t)) * (eh * (-1.0 / eh))) - ((ew * cos(t)) * (-1.0 / hypot(1.0, (tan(t) * (eh / ew)))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.sin(t)) * (eh * (-1.0 / eh))) - ((ew * Math.cos(t)) * (-1.0 / Math.hypot(1.0, (Math.tan(t) * (eh / ew)))))));
}
def code(eh, ew, t): return math.fabs((((eh * math.sin(t)) * (eh * (-1.0 / eh))) - ((ew * math.cos(t)) * (-1.0 / math.hypot(1.0, (math.tan(t) * (eh / ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * sin(t)) * Float64(eh * Float64(-1.0 / eh))) - Float64(Float64(ew * cos(t)) * Float64(-1.0 / hypot(1.0, Float64(tan(t) * Float64(eh / ew))))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * sin(t)) * (eh * (-1.0 / eh))) - ((ew * cos(t)) * (-1.0 / hypot(1.0, (tan(t) * (eh / ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(eh * N[(-1.0 / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \sin t\right) \cdot \left(eh \cdot \frac{-1}{eh}\right) - \left(ew \cdot \cos t\right) \cdot \frac{-1}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
associate-/l*99.8%
Simplified99.8%
associate-*r*99.8%
sin-atan80.3%
associate-*r/79.4%
associate-*r/79.4%
*-commutative79.4%
associate-/l*78.6%
add-sqr-sqrt44.1%
sqrt-unprod66.9%
sqr-neg66.9%
sqrt-unprod34.1%
add-sqr-sqrt77.9%
hypot-1-def82.7%
associate-*r/82.7%
Applied egg-rr82.7%
associate-/l*88.3%
associate-*r/88.2%
*-commutative88.2%
associate-/l*88.2%
associate-/l*88.4%
associate-*r/90.6%
*-commutative90.6%
associate-/l*90.7%
Simplified90.7%
Taylor expanded in ew around 0 99.2%
cos-atan99.2%
hypot-1-def99.2%
associate-*r/99.2%
*-commutative99.2%
associate-/l*99.2%
add-sqr-sqrt55.8%
sqrt-unprod91.7%
sqr-neg91.7%
sqrt-unprod43.4%
add-sqr-sqrt99.2%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -9.8e-60) (not (<= ew 4.4e-91))) (fabs (* ew (* (cos t) (cos (atan (/ eh (/ (- ew) (tan t)))))))) (fabs (* eh (sin t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -9.8e-60) || !(ew <= 4.4e-91)) {
tmp = fabs((ew * (cos(t) * cos(atan((eh / (-ew / tan(t))))))));
} else {
tmp = fabs((eh * sin(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 <= (-9.8d-60)) .or. (.not. (ew <= 4.4d-91))) then
tmp = abs((ew * (cos(t) * cos(atan((eh / (-ew / tan(t))))))))
else
tmp = abs((eh * sin(t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -9.8e-60) || !(ew <= 4.4e-91)) {
tmp = Math.abs((ew * (Math.cos(t) * Math.cos(Math.atan((eh / (-ew / Math.tan(t))))))));
} else {
tmp = Math.abs((eh * Math.sin(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -9.8e-60) or not (ew <= 4.4e-91): tmp = math.fabs((ew * (math.cos(t) * math.cos(math.atan((eh / (-ew / math.tan(t)))))))) else: tmp = math.fabs((eh * math.sin(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -9.8e-60) || !(ew <= 4.4e-91)) tmp = abs(Float64(ew * Float64(cos(t) * cos(atan(Float64(eh / Float64(Float64(-ew) / tan(t)))))))); else tmp = abs(Float64(eh * sin(t))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -9.8e-60) || ~((ew <= 4.4e-91))) tmp = abs((ew * (cos(t) * cos(atan((eh / (-ew / tan(t)))))))); else tmp = abs((eh * sin(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -9.8e-60], N[Not[LessEqual[ew, 4.4e-91]], $MachinePrecision]], N[Abs[N[(ew * N[(N[Cos[t], $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[((-ew) / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -9.8 \cdot 10^{-60} \lor \neg \left(ew \leq 4.4 \cdot 10^{-91}\right):\\
\;\;\;\;\left|ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{eh}{\frac{-ew}{\tan t}}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\end{array}
\end{array}
if ew < -9.79999999999999977e-60 or 4.4000000000000002e-91 < ew Initial program 99.8%
sub-neg99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in ew around inf 84.2%
*-commutative84.2%
mul-1-neg84.2%
associate-*l/84.2%
associate-/r/84.2%
distribute-neg-frac284.2%
Simplified84.2%
if -9.79999999999999977e-60 < ew < 4.4000000000000002e-91Initial program 99.9%
sub-neg99.9%
associate-*l*99.9%
distribute-rgt-neg-in99.9%
cancel-sign-sub99.9%
associate-/l*99.9%
Simplified99.9%
associate-*r*99.9%
sin-atan55.6%
associate-*r/55.3%
associate-*r/55.2%
*-commutative55.2%
associate-/l*55.1%
add-sqr-sqrt27.1%
sqrt-unprod50.1%
sqr-neg50.1%
sqrt-unprod27.3%
add-sqr-sqrt54.0%
hypot-1-def65.7%
associate-*r/65.6%
Applied egg-rr65.7%
associate-/l*70.9%
associate-*r/70.8%
*-commutative70.8%
associate-/l*70.7%
associate-/l*71.2%
associate-*r/75.4%
*-commutative75.4%
associate-/l*75.6%
Simplified75.6%
Taylor expanded in ew around 0 98.8%
Taylor expanded in ew around 0 76.9%
neg-mul-176.9%
distribute-rgt-neg-in76.9%
Simplified76.9%
Final simplification81.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (sin t)))
(t_2 (- (/ (* ew (cos t)) (hypot 1.0 (* (tan t) (/ eh ew)))) t_1)))
(if (<= t -6.2)
t_2
(if (<= t 0.009)
(fabs (- (* ew (cos (atan (* eh (/ (tan t) (- ew)))))) (* t eh)))
(if (<= t 2.25e+91) (fabs t_1) t_2)))))
double code(double eh, double ew, double t) {
double t_1 = eh * sin(t);
double t_2 = ((ew * cos(t)) / hypot(1.0, (tan(t) * (eh / ew)))) - t_1;
double tmp;
if (t <= -6.2) {
tmp = t_2;
} else if (t <= 0.009) {
tmp = fabs(((ew * cos(atan((eh * (tan(t) / -ew))))) - (t * eh)));
} else if (t <= 2.25e+91) {
tmp = fabs(t_1);
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double eh, double ew, double t) {
double t_1 = eh * Math.sin(t);
double t_2 = ((ew * Math.cos(t)) / Math.hypot(1.0, (Math.tan(t) * (eh / ew)))) - t_1;
double tmp;
if (t <= -6.2) {
tmp = t_2;
} else if (t <= 0.009) {
tmp = Math.abs(((ew * Math.cos(Math.atan((eh * (Math.tan(t) / -ew))))) - (t * eh)));
} else if (t <= 2.25e+91) {
tmp = Math.abs(t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(eh, ew, t): t_1 = eh * math.sin(t) t_2 = ((ew * math.cos(t)) / math.hypot(1.0, (math.tan(t) * (eh / ew)))) - t_1 tmp = 0 if t <= -6.2: tmp = t_2 elif t <= 0.009: tmp = math.fabs(((ew * math.cos(math.atan((eh * (math.tan(t) / -ew))))) - (t * eh))) elif t <= 2.25e+91: tmp = math.fabs(t_1) else: tmp = t_2 return tmp
function code(eh, ew, t) t_1 = Float64(eh * sin(t)) t_2 = Float64(Float64(Float64(ew * cos(t)) / hypot(1.0, Float64(tan(t) * Float64(eh / ew)))) - t_1) tmp = 0.0 if (t <= -6.2) tmp = t_2; elseif (t <= 0.009) tmp = abs(Float64(Float64(ew * cos(atan(Float64(eh * Float64(tan(t) / Float64(-ew)))))) - Float64(t * eh))); elseif (t <= 2.25e+91) tmp = abs(t_1); else tmp = t_2; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh * sin(t); t_2 = ((ew * cos(t)) / hypot(1.0, (tan(t) * (eh / ew)))) - t_1; tmp = 0.0; if (t <= -6.2) tmp = t_2; elseif (t <= 0.009) tmp = abs(((ew * cos(atan((eh * (tan(t) / -ew))))) - (t * eh))); elseif (t <= 2.25e+91) tmp = abs(t_1); else tmp = 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[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[t, -6.2], t$95$2, If[LessEqual[t, 0.009], N[Abs[N[(N[(ew * N[Cos[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(t * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 2.25e+91], N[Abs[t$95$1], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \sin t\\
t_2 := \frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)} - t\_1\\
\mathbf{if}\;t \leq -6.2:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 0.009:\\
\;\;\;\;\left|ew \cdot \cos \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right) - t \cdot eh\right|\\
\mathbf{elif}\;t \leq 2.25 \cdot 10^{+91}:\\
\;\;\;\;\left|t\_1\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -6.20000000000000018 or 2.25e91 < t Initial program 99.6%
sub-neg99.6%
associate-*l*99.7%
distribute-rgt-neg-in99.7%
cancel-sign-sub99.7%
associate-/l*99.7%
Simplified99.7%
associate-*r*99.6%
sin-atan76.8%
associate-*r/74.7%
associate-*r/74.7%
*-commutative74.7%
associate-/l*74.7%
add-sqr-sqrt46.6%
sqrt-unprod64.8%
sqr-neg64.8%
sqrt-unprod28.0%
add-sqr-sqrt74.3%
hypot-1-def78.3%
associate-*r/78.3%
Applied egg-rr78.3%
associate-/l*88.1%
associate-*r/88.0%
*-commutative88.0%
associate-/l*87.9%
associate-/l*88.2%
associate-*r/88.2%
*-commutative88.2%
associate-/l*88.2%
Simplified88.2%
Taylor expanded in ew around 0 99.3%
add-sqr-sqrt57.1%
fabs-sqr57.1%
add-sqr-sqrt57.9%
rgt-mult-inverse58.0%
*-commutative58.0%
Applied egg-rr58.0%
*-lft-identity58.0%
*-lft-identity58.0%
associate-*r/58.0%
associate-/r/58.0%
Simplified58.0%
if -6.20000000000000018 < t < 0.00899999999999999932Initial program 100.0%
sub-neg100.0%
associate-*l*100.0%
distribute-rgt-neg-in100.0%
cancel-sign-sub100.0%
associate-/l*100.0%
Simplified100.0%
associate-*r*100.0%
sin-atan88.2%
associate-*r/88.1%
associate-*r/88.1%
*-commutative88.1%
associate-/l*86.4%
add-sqr-sqrt44.4%
sqrt-unprod72.3%
sqr-neg72.3%
sqrt-unprod41.5%
add-sqr-sqrt85.7%
hypot-1-def89.8%
associate-*r/89.8%
Applied egg-rr89.7%
associate-/l*91.2%
associate-*r/91.3%
*-commutative91.3%
associate-/l*91.3%
associate-/l*91.3%
associate-*r/96.0%
*-commutative96.0%
associate-/l*96.0%
Simplified96.0%
Taylor expanded in ew around 0 99.3%
Taylor expanded in t around 0 97.5%
+-commutative97.5%
mul-1-neg97.5%
unsub-neg97.5%
mul-1-neg97.5%
distribute-frac-neg297.5%
associate-/l*97.5%
Simplified97.5%
if 0.00899999999999999932 < t < 2.25e91Initial program 99.7%
sub-neg99.7%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
associate-/l*99.8%
Simplified99.8%
associate-*r*99.7%
sin-atan56.5%
associate-*r/56.3%
associate-*r/56.1%
*-commutative56.1%
associate-/l*56.2%
add-sqr-sqrt32.2%
sqrt-unprod48.8%
sqr-neg48.8%
sqrt-unprod23.8%
add-sqr-sqrt54.7%
hypot-1-def66.7%
associate-*r/66.8%
Applied egg-rr66.9%
associate-/l*74.3%
associate-*r/74.0%
*-commutative74.0%
associate-/l*74.0%
associate-/l*74.4%
associate-*r/74.7%
*-commutative74.7%
associate-/l*74.7%
Simplified74.7%
Taylor expanded in ew around 0 98.3%
Taylor expanded in ew around 0 75.4%
neg-mul-175.4%
distribute-rgt-neg-in75.4%
Simplified75.4%
Final simplification78.8%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -2600000000000.0) (not (<= t 0.024))) (fabs (* eh (sin t))) (fabs (- (* ew (cos (atan (* eh (/ (tan t) (- ew)))))) (* t eh)))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -2600000000000.0) || !(t <= 0.024)) {
tmp = fabs((eh * sin(t)));
} else {
tmp = fabs(((ew * cos(atan((eh * (tan(t) / -ew))))) - (t * 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 ((t <= (-2600000000000.0d0)) .or. (.not. (t <= 0.024d0))) then
tmp = abs((eh * sin(t)))
else
tmp = abs(((ew * cos(atan((eh * (tan(t) / -ew))))) - (t * eh)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -2600000000000.0) || !(t <= 0.024)) {
tmp = Math.abs((eh * Math.sin(t)));
} else {
tmp = Math.abs(((ew * Math.cos(Math.atan((eh * (Math.tan(t) / -ew))))) - (t * eh)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -2600000000000.0) or not (t <= 0.024): tmp = math.fabs((eh * math.sin(t))) else: tmp = math.fabs(((ew * math.cos(math.atan((eh * (math.tan(t) / -ew))))) - (t * eh))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -2600000000000.0) || !(t <= 0.024)) tmp = abs(Float64(eh * sin(t))); else tmp = abs(Float64(Float64(ew * cos(atan(Float64(eh * Float64(tan(t) / Float64(-ew)))))) - Float64(t * eh))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -2600000000000.0) || ~((t <= 0.024))) tmp = abs((eh * sin(t))); else tmp = abs(((ew * cos(atan((eh * (tan(t) / -ew))))) - (t * eh))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -2600000000000.0], N[Not[LessEqual[t, 0.024]], $MachinePrecision]], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * N[Cos[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(t * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2600000000000 \lor \neg \left(t \leq 0.024\right):\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right) - t \cdot eh\right|\\
\end{array}
\end{array}
if t < -2.6e12 or 0.024 < t Initial program 99.7%
sub-neg99.7%
associate-*l*99.7%
distribute-rgt-neg-in99.7%
cancel-sign-sub99.7%
associate-/l*99.7%
Simplified99.7%
associate-*r*99.7%
sin-atan72.7%
associate-*r/71.0%
associate-*r/70.9%
*-commutative70.9%
associate-/l*70.9%
add-sqr-sqrt43.5%
sqrt-unprod61.5%
sqr-neg61.5%
sqrt-unprod27.4%
add-sqr-sqrt70.4%
hypot-1-def75.9%
associate-*r/75.9%
Applied egg-rr76.0%
associate-/l*85.4%
associate-*r/85.2%
*-commutative85.2%
associate-/l*85.1%
associate-/l*85.5%
associate-*r/85.5%
*-commutative85.5%
associate-/l*85.6%
Simplified85.6%
Taylor expanded in ew around 0 99.1%
Taylor expanded in ew around 0 52.2%
neg-mul-152.2%
distribute-rgt-neg-in52.2%
Simplified52.2%
if -2.6e12 < t < 0.024Initial program 100.0%
sub-neg100.0%
associate-*l*100.0%
distribute-rgt-neg-in100.0%
cancel-sign-sub100.0%
associate-/l*100.0%
Simplified100.0%
associate-*r*100.0%
sin-atan88.3%
associate-*r/88.2%
associate-*r/88.2%
*-commutative88.2%
associate-/l*86.5%
add-sqr-sqrt44.9%
sqrt-unprod72.5%
sqr-neg72.5%
sqrt-unprod41.2%
add-sqr-sqrt85.8%
hypot-1-def89.8%
associate-*r/89.9%
Applied egg-rr89.7%
associate-/l*91.3%
associate-*r/91.4%
*-commutative91.4%
associate-/l*91.4%
associate-/l*91.4%
associate-*r/96.0%
*-commutative96.0%
associate-/l*96.1%
Simplified96.1%
Taylor expanded in ew around 0 99.3%
Taylor expanded in t around 0 96.8%
+-commutative96.8%
mul-1-neg96.8%
unsub-neg96.8%
mul-1-neg96.8%
distribute-frac-neg296.8%
associate-/l*96.8%
Simplified96.8%
Final simplification74.0%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -2600000000000.0) (not (<= t 0.0105))) (fabs (* eh (sin t))) (fabs (- ew (* eh (* t (sin (atan (* eh (/ (tan t) (- ew)))))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -2600000000000.0) || !(t <= 0.0105)) {
tmp = fabs((eh * sin(t)));
} else {
tmp = fabs((ew - (eh * (t * sin(atan((eh * (tan(t) / -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 ((t <= (-2600000000000.0d0)) .or. (.not. (t <= 0.0105d0))) then
tmp = abs((eh * sin(t)))
else
tmp = abs((ew - (eh * (t * sin(atan((eh * (tan(t) / -ew))))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -2600000000000.0) || !(t <= 0.0105)) {
tmp = Math.abs((eh * Math.sin(t)));
} else {
tmp = Math.abs((ew - (eh * (t * Math.sin(Math.atan((eh * (Math.tan(t) / -ew))))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -2600000000000.0) or not (t <= 0.0105): tmp = math.fabs((eh * math.sin(t))) else: tmp = math.fabs((ew - (eh * (t * math.sin(math.atan((eh * (math.tan(t) / -ew)))))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -2600000000000.0) || !(t <= 0.0105)) tmp = abs(Float64(eh * sin(t))); else tmp = abs(Float64(ew - Float64(eh * Float64(t * sin(atan(Float64(eh * Float64(tan(t) / Float64(-ew))))))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -2600000000000.0) || ~((t <= 0.0105))) tmp = abs((eh * sin(t))); else tmp = abs((ew - (eh * (t * sin(atan((eh * (tan(t) / -ew)))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -2600000000000.0], N[Not[LessEqual[t, 0.0105]], $MachinePrecision]], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew - N[(eh * N[(t * N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2600000000000 \lor \neg \left(t \leq 0.0105\right):\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew - eh \cdot \left(t \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right)\right)\right|\\
\end{array}
\end{array}
if t < -2.6e12 or 0.0105000000000000007 < t Initial program 99.7%
sub-neg99.7%
associate-*l*99.7%
distribute-rgt-neg-in99.7%
cancel-sign-sub99.7%
associate-/l*99.7%
Simplified99.7%
associate-*r*99.7%
sin-atan72.7%
associate-*r/71.0%
associate-*r/70.9%
*-commutative70.9%
associate-/l*70.9%
add-sqr-sqrt43.5%
sqrt-unprod61.5%
sqr-neg61.5%
sqrt-unprod27.4%
add-sqr-sqrt70.4%
hypot-1-def75.9%
associate-*r/75.9%
Applied egg-rr76.0%
associate-/l*85.4%
associate-*r/85.2%
*-commutative85.2%
associate-/l*85.1%
associate-/l*85.5%
associate-*r/85.5%
*-commutative85.5%
associate-/l*85.6%
Simplified85.6%
Taylor expanded in ew around 0 99.1%
Taylor expanded in ew around 0 52.2%
neg-mul-152.2%
distribute-rgt-neg-in52.2%
Simplified52.2%
if -2.6e12 < t < 0.0105000000000000007Initial program 100.0%
sub-neg100.0%
associate-*l*100.0%
distribute-rgt-neg-in100.0%
cancel-sign-sub100.0%
associate-/l*100.0%
Simplified100.0%
add-cube-cbrt98.3%
pow398.3%
Applied egg-rr98.3%
Taylor expanded in t around 0 96.5%
mul-1-neg96.5%
unsub-neg96.5%
mul-1-neg96.5%
associate-/l*96.5%
distribute-rgt-neg-in96.5%
Simplified96.5%
Final simplification73.8%
(FPCore (eh ew t)
:precision binary64
(if (<= ew -6.5e+56)
(fabs ew)
(if (<= ew 1.9e-89)
(fabs (* eh (sin t)))
(+ ew (* eh (* t (sin (atan (/ (* eh (tan t)) ew)))))))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -6.5e+56) {
tmp = fabs(ew);
} else if (ew <= 1.9e-89) {
tmp = fabs((eh * sin(t)));
} else {
tmp = ew + (eh * (t * sin(atan(((eh * tan(t)) / 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 <= (-6.5d+56)) then
tmp = abs(ew)
else if (ew <= 1.9d-89) then
tmp = abs((eh * sin(t)))
else
tmp = ew + (eh * (t * sin(atan(((eh * tan(t)) / ew)))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (ew <= -6.5e+56) {
tmp = Math.abs(ew);
} else if (ew <= 1.9e-89) {
tmp = Math.abs((eh * Math.sin(t)));
} else {
tmp = ew + (eh * (t * Math.sin(Math.atan(((eh * Math.tan(t)) / ew)))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if ew <= -6.5e+56: tmp = math.fabs(ew) elif ew <= 1.9e-89: tmp = math.fabs((eh * math.sin(t))) else: tmp = ew + (eh * (t * math.sin(math.atan(((eh * math.tan(t)) / ew))))) return tmp
function code(eh, ew, t) tmp = 0.0 if (ew <= -6.5e+56) tmp = abs(ew); elseif (ew <= 1.9e-89) tmp = abs(Float64(eh * sin(t))); else tmp = Float64(ew + Float64(eh * Float64(t * sin(atan(Float64(Float64(eh * tan(t)) / ew)))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (ew <= -6.5e+56) tmp = abs(ew); elseif (ew <= 1.9e-89) tmp = abs((eh * sin(t))); else tmp = ew + (eh * (t * sin(atan(((eh * tan(t)) / ew))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[ew, -6.5e+56], N[Abs[ew], $MachinePrecision], If[LessEqual[ew, 1.9e-89], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(ew + N[(eh * N[(t * 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}
\mathbf{if}\;ew \leq -6.5 \cdot 10^{+56}:\\
\;\;\;\;\left|ew\right|\\
\mathbf{elif}\;ew \leq 1.9 \cdot 10^{-89}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;ew + eh \cdot \left(t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right)\\
\end{array}
\end{array}
if ew < -6.5000000000000001e56Initial program 99.6%
sub-neg99.6%
associate-*l*99.6%
distribute-rgt-neg-in99.6%
cancel-sign-sub99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in t around 0 60.7%
mul-1-neg60.7%
associate-*l/60.7%
associate-/r/60.7%
distribute-neg-frac260.7%
Simplified60.7%
cos-atan60.6%
hypot-1-def60.6%
distribute-neg-frac60.6%
Applied egg-rr60.6%
associate-/r/60.6%
Simplified60.6%
Taylor expanded in ew around inf 60.7%
if -6.5000000000000001e56 < ew < 1.9000000000000001e-89Initial program 99.9%
sub-neg99.9%
associate-*l*99.9%
distribute-rgt-neg-in99.9%
cancel-sign-sub99.9%
associate-/l*99.9%
Simplified99.9%
associate-*r*99.9%
sin-atan61.1%
associate-*r/60.7%
associate-*r/60.6%
*-commutative60.6%
associate-/l*60.5%
add-sqr-sqrt34.0%
sqrt-unprod54.3%
sqr-neg54.3%
sqrt-unprod25.9%
add-sqr-sqrt59.7%
hypot-1-def69.7%
associate-*r/69.7%
Applied egg-rr69.8%
associate-/l*77.6%
associate-*r/77.5%
*-commutative77.5%
associate-/l*77.4%
associate-/l*77.8%
associate-*r/81.0%
*-commutative81.0%
associate-/l*81.1%
Simplified81.1%
Taylor expanded in ew around 0 99.0%
Taylor expanded in ew around 0 70.4%
neg-mul-170.4%
distribute-rgt-neg-in70.4%
Simplified70.4%
if 1.9000000000000001e-89 < ew Initial program 99.8%
sub-neg99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
associate-/l*99.8%
Simplified99.8%
add-sqr-sqrt80.8%
fabs-sqr80.8%
pow280.8%
Applied egg-rr80.8%
Taylor expanded in t around 0 62.4%
Final simplification65.9%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -7.8e-146) (not (<= t 5.8e-41))) (fabs (* eh (sin t))) (fabs ew)))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -7.8e-146) || !(t <= 5.8e-41)) {
tmp = fabs((eh * sin(t)));
} else {
tmp = fabs(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 ((t <= (-7.8d-146)) .or. (.not. (t <= 5.8d-41))) then
tmp = abs((eh * sin(t)))
else
tmp = abs(ew)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -7.8e-146) || !(t <= 5.8e-41)) {
tmp = Math.abs((eh * Math.sin(t)));
} else {
tmp = Math.abs(ew);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -7.8e-146) or not (t <= 5.8e-41): tmp = math.fabs((eh * math.sin(t))) else: tmp = math.fabs(ew) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -7.8e-146) || !(t <= 5.8e-41)) tmp = abs(Float64(eh * sin(t))); else tmp = abs(ew); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -7.8e-146) || ~((t <= 5.8e-41))) tmp = abs((eh * sin(t))); else tmp = abs(ew); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -7.8e-146], N[Not[LessEqual[t, 5.8e-41]], $MachinePrecision]], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[ew], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.8 \cdot 10^{-146} \lor \neg \left(t \leq 5.8 \cdot 10^{-41}\right):\\
\;\;\;\;\left|eh \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew\right|\\
\end{array}
\end{array}
if t < -7.80000000000000005e-146 or 5.79999999999999955e-41 < t Initial program 99.7%
sub-neg99.7%
associate-*l*99.7%
distribute-rgt-neg-in99.7%
cancel-sign-sub99.7%
associate-/l*99.7%
Simplified99.7%
associate-*r*99.7%
sin-atan72.2%
associate-*r/70.7%
associate-*r/70.6%
*-commutative70.6%
associate-/l*70.6%
add-sqr-sqrt43.7%
sqrt-unprod60.5%
sqr-neg60.5%
sqrt-unprod26.8%
add-sqr-sqrt70.1%
hypot-1-def76.5%
associate-*r/76.5%
Applied egg-rr76.6%
associate-/l*84.9%
associate-*r/84.7%
*-commutative84.7%
associate-/l*84.7%
associate-/l*85.0%
associate-*r/85.6%
*-commutative85.6%
associate-/l*85.7%
Simplified85.7%
Taylor expanded in ew around 0 99.2%
Taylor expanded in ew around 0 52.5%
neg-mul-152.5%
distribute-rgt-neg-in52.5%
Simplified52.5%
if -7.80000000000000005e-146 < t < 5.79999999999999955e-41Initial program 100.0%
sub-neg100.0%
associate-*l*100.0%
distribute-rgt-neg-in100.0%
cancel-sign-sub100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in t around 0 83.4%
mul-1-neg83.4%
associate-*l/83.4%
associate-/r/83.4%
distribute-neg-frac283.4%
Simplified83.4%
cos-atan83.3%
hypot-1-def83.3%
distribute-neg-frac83.3%
Applied egg-rr83.3%
associate-/r/83.2%
Simplified83.2%
Taylor expanded in ew around inf 83.5%
Final simplification64.1%
(FPCore (eh ew t) :precision binary64 (fabs ew))
double code(double eh, double ew, double t) {
return fabs(ew);
}
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)
end function
public static double code(double eh, double ew, double t) {
return Math.abs(ew);
}
def code(eh, ew, t): return math.fabs(ew)
function code(eh, ew, t) return abs(ew) end
function tmp = code(eh, ew, t) tmp = abs(ew); end
code[eh_, ew_, t_] := N[Abs[ew], $MachinePrecision]
\begin{array}{l}
\\
\left|ew\right|
\end{array}
Initial program 99.8%
sub-neg99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
cancel-sign-sub99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t around 0 42.5%
mul-1-neg42.5%
associate-*l/42.5%
associate-/r/42.5%
distribute-neg-frac242.5%
Simplified42.5%
cos-atan42.2%
hypot-1-def42.2%
distribute-neg-frac42.2%
Applied egg-rr42.2%
associate-/r/42.2%
Simplified42.2%
Taylor expanded in ew around inf 42.7%
herbie shell --seed 2024111
(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)))))))