
(FPCore (v H) :precision binary64 (atan (/ v (sqrt (- (* v v) (* (* 2.0 9.8) H))))))
double code(double v, double H) {
return atan((v / sqrt(((v * v) - ((2.0 * 9.8) * H)))));
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
code = atan((v / sqrt(((v * v) - ((2.0d0 * 9.8d0) * h)))))
end function
public static double code(double v, double H) {
return Math.atan((v / Math.sqrt(((v * v) - ((2.0 * 9.8) * H)))));
}
def code(v, H): return math.atan((v / math.sqrt(((v * v) - ((2.0 * 9.8) * H)))))
function code(v, H) return atan(Float64(v / sqrt(Float64(Float64(v * v) - Float64(Float64(2.0 * 9.8) * H))))) end
function tmp = code(v, H) tmp = atan((v / sqrt(((v * v) - ((2.0 * 9.8) * H))))); end
code[v_, H_] := N[ArcTan[N[(v / N[Sqrt[N[(N[(v * v), $MachinePrecision] - N[(N[(2.0 * 9.8), $MachinePrecision] * H), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (v H) :precision binary64 (atan (/ v (sqrt (- (* v v) (* (* 2.0 9.8) H))))))
double code(double v, double H) {
return atan((v / sqrt(((v * v) - ((2.0 * 9.8) * H)))));
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
code = atan((v / sqrt(((v * v) - ((2.0d0 * 9.8d0) * h)))))
end function
public static double code(double v, double H) {
return Math.atan((v / Math.sqrt(((v * v) - ((2.0 * 9.8) * H)))));
}
def code(v, H): return math.atan((v / math.sqrt(((v * v) - ((2.0 * 9.8) * H)))))
function code(v, H) return atan(Float64(v / sqrt(Float64(Float64(v * v) - Float64(Float64(2.0 * 9.8) * H))))) end
function tmp = code(v, H) tmp = atan((v / sqrt(((v * v) - ((2.0 * 9.8) * H))))); end
code[v_, H_] := N[ArcTan[N[(v / N[Sqrt[N[(N[(v * v), $MachinePrecision] - N[(N[(2.0 * 9.8), $MachinePrecision] * H), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right)
\end{array}
(FPCore (v H)
:precision binary64
(let* ((t_0 (/ v (sqrt (- (* v v) (* 19.6 H))))))
(if (or (<= t_0 -2e-310) (not (<= t_0 0.0)))
(atan t_0)
(atan (/ v (fabs (fma -9.8 (/ H v) v)))))))
double code(double v, double H) {
double t_0 = v / sqrt(((v * v) - (19.6 * H)));
double tmp;
if ((t_0 <= -2e-310) || !(t_0 <= 0.0)) {
tmp = atan(t_0);
} else {
tmp = atan((v / fabs(fma(-9.8, (H / v), v))));
}
return tmp;
}
function code(v, H) t_0 = Float64(v / sqrt(Float64(Float64(v * v) - Float64(19.6 * H)))) tmp = 0.0 if ((t_0 <= -2e-310) || !(t_0 <= 0.0)) tmp = atan(t_0); else tmp = atan(Float64(v / abs(fma(-9.8, Float64(H / v), v)))); end return tmp end
code[v_, H_] := Block[{t$95$0 = N[(v / N[Sqrt[N[(N[(v * v), $MachinePrecision] - N[(19.6 * H), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -2e-310], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[ArcTan[t$95$0], $MachinePrecision], N[ArcTan[N[(v / N[Abs[N[(-9.8 * N[(H / v), $MachinePrecision] + v), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{v}{\sqrt{v \cdot v - 19.6 \cdot H}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-310} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\tan^{-1} t\_0\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\left|\mathsf{fma}\left(-9.8, \frac{H}{v}, v\right)\right|}\right)\\
\end{array}
\end{array}
if (/.f64 v (sqrt.f64 (-.f64 (*.f64 v v) (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 49/5 binary64)) H)))) < -1.999999999999994e-310 or -0.0 < (/.f64 v (sqrt.f64 (-.f64 (*.f64 v v) (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 49/5 binary64)) H)))) Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
metadata-eval99.7%
Simplified99.7%
if -1.999999999999994e-310 < (/.f64 v (sqrt.f64 (-.f64 (*.f64 v v) (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 49/5 binary64)) H)))) < -0.0Initial program 14.8%
sqr-neg14.8%
sqr-neg14.8%
metadata-eval14.8%
Simplified14.8%
Taylor expanded in H around 0 45.4%
add-sqr-sqrt37.2%
sqrt-unprod14.8%
pow214.8%
+-commutative14.8%
fma-define14.8%
Applied egg-rr14.8%
unpow214.8%
rem-sqrt-square100.0%
Simplified100.0%
Final simplification99.8%
(FPCore (v H) :precision binary64 (if (<= (* 19.6 H) -1e-303) (atan (/ (/ 1.0 (hypot v (sqrt (* H -19.6)))) (/ 1.0 v))) (atan (/ v (fabs (fma -9.8 (/ H v) v))))))
double code(double v, double H) {
double tmp;
if ((19.6 * H) <= -1e-303) {
tmp = atan(((1.0 / hypot(v, sqrt((H * -19.6)))) / (1.0 / v)));
} else {
tmp = atan((v / fabs(fma(-9.8, (H / v), v))));
}
return tmp;
}
function code(v, H) tmp = 0.0 if (Float64(19.6 * H) <= -1e-303) tmp = atan(Float64(Float64(1.0 / hypot(v, sqrt(Float64(H * -19.6)))) / Float64(1.0 / v))); else tmp = atan(Float64(v / abs(fma(-9.8, Float64(H / v), v)))); end return tmp end
code[v_, H_] := If[LessEqual[N[(19.6 * H), $MachinePrecision], -1e-303], N[ArcTan[N[(N[(1.0 / N[Sqrt[v ^ 2 + N[Sqrt[N[(H * -19.6), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(1.0 / v), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[Abs[N[(-9.8 * N[(H / v), $MachinePrecision] + v), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;19.6 \cdot H \leq -1 \cdot 10^{-303}:\\
\;\;\;\;\tan^{-1} \left(\frac{\frac{1}{\mathsf{hypot}\left(v, \sqrt{H \cdot -19.6}\right)}}{\frac{1}{v}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\left|\mathsf{fma}\left(-9.8, \frac{H}{v}, v\right)\right|}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 49/5 binary64)) H) < -9.99999999999999931e-304Initial program 79.4%
sqr-neg79.4%
sqr-neg79.4%
metadata-eval79.4%
Simplified79.4%
add-cbrt-cube54.6%
pow1/351.7%
add-sqr-sqrt51.7%
pow151.7%
pow1/251.7%
pow-prod-up51.7%
sub-neg51.7%
+-commutative51.7%
*-commutative51.7%
distribute-rgt-neg-in51.7%
fma-define51.7%
metadata-eval51.7%
pow251.7%
metadata-eval51.7%
Applied egg-rr51.7%
unpow1/354.7%
Simplified54.7%
Applied egg-rr79.2%
metadata-eval79.2%
pow-flip79.0%
add-sqr-sqrt78.8%
sqrt-unprod79.0%
pow-prod-up79.1%
metadata-eval79.1%
fma-undefine79.1%
+-commutative79.1%
unpow279.1%
add-sqr-sqrt79.1%
pow1/279.1%
hypot-undefine79.1%
add-sqr-sqrt78.9%
sqrt-unprod79.1%
pow-prod-up79.0%
Applied egg-rr99.6%
if -9.99999999999999931e-304 < (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 49/5 binary64)) H) Initial program 56.4%
sqr-neg56.4%
sqr-neg56.4%
metadata-eval56.4%
Simplified56.4%
Taylor expanded in H around 0 45.9%
add-sqr-sqrt44.7%
sqrt-unprod56.4%
pow256.4%
+-commutative56.4%
fma-define56.4%
Applied egg-rr56.4%
unpow256.4%
rem-sqrt-square100.0%
Simplified100.0%
Final simplification99.7%
(FPCore (v H) :precision binary64 (if (<= (* 19.6 H) -1e-303) (atan (/ 1.0 (/ (hypot v (sqrt (* H -19.6))) v))) (atan (/ v (fabs (fma -9.8 (/ H v) v))))))
double code(double v, double H) {
double tmp;
if ((19.6 * H) <= -1e-303) {
tmp = atan((1.0 / (hypot(v, sqrt((H * -19.6))) / v)));
} else {
tmp = atan((v / fabs(fma(-9.8, (H / v), v))));
}
return tmp;
}
function code(v, H) tmp = 0.0 if (Float64(19.6 * H) <= -1e-303) tmp = atan(Float64(1.0 / Float64(hypot(v, sqrt(Float64(H * -19.6))) / v))); else tmp = atan(Float64(v / abs(fma(-9.8, Float64(H / v), v)))); end return tmp end
code[v_, H_] := If[LessEqual[N[(19.6 * H), $MachinePrecision], -1e-303], N[ArcTan[N[(1.0 / N[(N[Sqrt[v ^ 2 + N[Sqrt[N[(H * -19.6), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[Abs[N[(-9.8 * N[(H / v), $MachinePrecision] + v), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;19.6 \cdot H \leq -1 \cdot 10^{-303}:\\
\;\;\;\;\tan^{-1} \left(\frac{1}{\frac{\mathsf{hypot}\left(v, \sqrt{H \cdot -19.6}\right)}{v}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\left|\mathsf{fma}\left(-9.8, \frac{H}{v}, v\right)\right|}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 49/5 binary64)) H) < -9.99999999999999931e-304Initial program 79.4%
sqr-neg79.4%
sqr-neg79.4%
metadata-eval79.4%
Simplified79.4%
add-cbrt-cube54.6%
pow1/351.7%
add-sqr-sqrt51.7%
pow151.7%
pow1/251.7%
pow-prod-up51.7%
sub-neg51.7%
+-commutative51.7%
*-commutative51.7%
distribute-rgt-neg-in51.7%
fma-define51.7%
metadata-eval51.7%
pow251.7%
metadata-eval51.7%
Applied egg-rr51.7%
unpow1/354.7%
Simplified54.7%
Applied egg-rr79.2%
metadata-eval79.2%
pow-flip79.0%
add-sqr-sqrt78.8%
sqrt-unprod79.0%
pow-prod-up79.1%
metadata-eval79.1%
fma-undefine79.1%
+-commutative79.1%
unpow279.1%
add-sqr-sqrt79.1%
pow1/279.1%
hypot-undefine79.1%
add-sqr-sqrt78.9%
sqrt-unprod79.1%
pow-prod-up79.0%
Applied egg-rr99.0%
if -9.99999999999999931e-304 < (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 49/5 binary64)) H) Initial program 56.4%
sqr-neg56.4%
sqr-neg56.4%
metadata-eval56.4%
Simplified56.4%
Taylor expanded in H around 0 45.9%
add-sqr-sqrt44.7%
sqrt-unprod56.4%
pow256.4%
+-commutative56.4%
fma-define56.4%
Applied egg-rr56.4%
unpow256.4%
rem-sqrt-square100.0%
Simplified100.0%
Final simplification99.3%
(FPCore (v H) :precision binary64 (if (<= v -5e+154) (atan -1.0) (if (<= v 5.8e+100) (atan (/ v (sqrt (- (* v v) (* 19.6 H))))) (atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -5e+154) {
tmp = atan(-1.0);
} else if (v <= 5.8e+100) {
tmp = atan((v / sqrt(((v * v) - (19.6 * H)))));
} else {
tmp = atan(1.0);
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-5d+154)) then
tmp = atan((-1.0d0))
else if (v <= 5.8d+100) then
tmp = atan((v / sqrt(((v * v) - (19.6d0 * h)))))
else
tmp = atan(1.0d0)
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -5e+154) {
tmp = Math.atan(-1.0);
} else if (v <= 5.8e+100) {
tmp = Math.atan((v / Math.sqrt(((v * v) - (19.6 * H)))));
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -5e+154: tmp = math.atan(-1.0) elif v <= 5.8e+100: tmp = math.atan((v / math.sqrt(((v * v) - (19.6 * H))))) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -5e+154) tmp = atan(-1.0); elseif (v <= 5.8e+100) tmp = atan(Float64(v / sqrt(Float64(Float64(v * v) - Float64(19.6 * H))))); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -5e+154) tmp = atan(-1.0); elseif (v <= 5.8e+100) tmp = atan((v / sqrt(((v * v) - (19.6 * H))))); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -5e+154], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 5.8e+100], N[ArcTan[N[(v / N[Sqrt[N[(N[(v * v), $MachinePrecision] - N[(19.6 * H), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -5 \cdot 10^{+154}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 5.8 \cdot 10^{+100}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - 19.6 \cdot H}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -5.00000000000000004e154Initial program 3.1%
sqr-neg3.1%
sqr-neg3.1%
metadata-eval3.1%
Simplified3.1%
Taylor expanded in v around -inf 99.9%
if -5.00000000000000004e154 < v < 5.8000000000000001e100Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
metadata-eval99.7%
Simplified99.7%
if 5.8000000000000001e100 < v Initial program 36.2%
sqr-neg36.2%
sqr-neg36.2%
metadata-eval36.2%
Simplified36.2%
Taylor expanded in v around inf 100.0%
(FPCore (v H)
:precision binary64
(if (<= v -2.7e-47)
(atan -1.0)
(if (<= v 7.6e-31)
(atan (/ v (sqrt (* H -19.6))))
(atan (/ v (+ v (* -9.8 (/ H v))))))))
double code(double v, double H) {
double tmp;
if (v <= -2.7e-47) {
tmp = atan(-1.0);
} else if (v <= 7.6e-31) {
tmp = atan((v / sqrt((H * -19.6))));
} else {
tmp = atan((v / (v + (-9.8 * (H / v)))));
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-2.7d-47)) then
tmp = atan((-1.0d0))
else if (v <= 7.6d-31) then
tmp = atan((v / sqrt((h * (-19.6d0)))))
else
tmp = atan((v / (v + ((-9.8d0) * (h / v)))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -2.7e-47) {
tmp = Math.atan(-1.0);
} else if (v <= 7.6e-31) {
tmp = Math.atan((v / Math.sqrt((H * -19.6))));
} else {
tmp = Math.atan((v / (v + (-9.8 * (H / v)))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -2.7e-47: tmp = math.atan(-1.0) elif v <= 7.6e-31: tmp = math.atan((v / math.sqrt((H * -19.6)))) else: tmp = math.atan((v / (v + (-9.8 * (H / v))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -2.7e-47) tmp = atan(-1.0); elseif (v <= 7.6e-31) tmp = atan(Float64(v / sqrt(Float64(H * -19.6)))); else tmp = atan(Float64(v / Float64(v + Float64(-9.8 * Float64(H / v))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -2.7e-47) tmp = atan(-1.0); elseif (v <= 7.6e-31) tmp = atan((v / sqrt((H * -19.6)))); else tmp = atan((v / (v + (-9.8 * (H / v))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -2.7e-47], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 7.6e-31], N[ArcTan[N[(v / N[Sqrt[N[(H * -19.6), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(v + N[(-9.8 * N[(H / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -2.7 \cdot 10^{-47}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 7.6 \cdot 10^{-31}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\sqrt{H \cdot -19.6}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + -9.8 \cdot \frac{H}{v}}\right)\\
\end{array}
\end{array}
if v < -2.6999999999999998e-47Initial program 48.8%
sqr-neg48.8%
sqr-neg48.8%
metadata-eval48.8%
Simplified48.8%
Taylor expanded in v around -inf 92.4%
if -2.6999999999999998e-47 < v < 7.5999999999999999e-31Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in v around 0 89.0%
*-commutative89.0%
Simplified89.0%
if 7.5999999999999999e-31 < v Initial program 64.5%
sqr-neg64.5%
sqr-neg64.5%
metadata-eval64.5%
Simplified64.5%
Taylor expanded in H around 0 87.1%
(FPCore (v H)
:precision binary64
(if (<= v -5.5e-46)
(atan -1.0)
(if (<= v 1.02e-29)
(atan (* v (sqrt (/ -0.05102040816326531 H))))
(atan (/ v (+ v (* -9.8 (/ H v))))))))
double code(double v, double H) {
double tmp;
if (v <= -5.5e-46) {
tmp = atan(-1.0);
} else if (v <= 1.02e-29) {
tmp = atan((v * sqrt((-0.05102040816326531 / H))));
} else {
tmp = atan((v / (v + (-9.8 * (H / v)))));
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-5.5d-46)) then
tmp = atan((-1.0d0))
else if (v <= 1.02d-29) then
tmp = atan((v * sqrt(((-0.05102040816326531d0) / h))))
else
tmp = atan((v / (v + ((-9.8d0) * (h / v)))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -5.5e-46) {
tmp = Math.atan(-1.0);
} else if (v <= 1.02e-29) {
tmp = Math.atan((v * Math.sqrt((-0.05102040816326531 / H))));
} else {
tmp = Math.atan((v / (v + (-9.8 * (H / v)))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -5.5e-46: tmp = math.atan(-1.0) elif v <= 1.02e-29: tmp = math.atan((v * math.sqrt((-0.05102040816326531 / H)))) else: tmp = math.atan((v / (v + (-9.8 * (H / v))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -5.5e-46) tmp = atan(-1.0); elseif (v <= 1.02e-29) tmp = atan(Float64(v * sqrt(Float64(-0.05102040816326531 / H)))); else tmp = atan(Float64(v / Float64(v + Float64(-9.8 * Float64(H / v))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -5.5e-46) tmp = atan(-1.0); elseif (v <= 1.02e-29) tmp = atan((v * sqrt((-0.05102040816326531 / H)))); else tmp = atan((v / (v + (-9.8 * (H / v))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -5.5e-46], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 1.02e-29], N[ArcTan[N[(v * N[Sqrt[N[(-0.05102040816326531 / H), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(v + N[(-9.8 * N[(H / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -5.5 \cdot 10^{-46}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 1.02 \cdot 10^{-29}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \sqrt{\frac{-0.05102040816326531}{H}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + -9.8 \cdot \frac{H}{v}}\right)\\
\end{array}
\end{array}
if v < -5.49999999999999983e-46Initial program 48.8%
sqr-neg48.8%
sqr-neg48.8%
metadata-eval48.8%
Simplified48.8%
Taylor expanded in v around -inf 92.4%
if -5.49999999999999983e-46 < v < 1.01999999999999994e-29Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in v around 0 99.5%
Taylor expanded in v around 0 89.0%
if 1.01999999999999994e-29 < v Initial program 64.5%
sqr-neg64.5%
sqr-neg64.5%
metadata-eval64.5%
Simplified64.5%
Taylor expanded in H around 0 87.1%
(FPCore (v H) :precision binary64 (if (<= v -1.65e-209) (atan -1.0) (if (<= v 1.82e-131) (atan (/ v (* -9.8 (/ H v)))) (atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -1.65e-209) {
tmp = atan(-1.0);
} else if (v <= 1.82e-131) {
tmp = atan((v / (-9.8 * (H / v))));
} else {
tmp = atan(1.0);
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-1.65d-209)) then
tmp = atan((-1.0d0))
else if (v <= 1.82d-131) then
tmp = atan((v / ((-9.8d0) * (h / v))))
else
tmp = atan(1.0d0)
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -1.65e-209) {
tmp = Math.atan(-1.0);
} else if (v <= 1.82e-131) {
tmp = Math.atan((v / (-9.8 * (H / v))));
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -1.65e-209: tmp = math.atan(-1.0) elif v <= 1.82e-131: tmp = math.atan((v / (-9.8 * (H / v)))) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -1.65e-209) tmp = atan(-1.0); elseif (v <= 1.82e-131) tmp = atan(Float64(v / Float64(-9.8 * Float64(H / v)))); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -1.65e-209) tmp = atan(-1.0); elseif (v <= 1.82e-131) tmp = atan((v / (-9.8 * (H / v)))); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -1.65e-209], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 1.82e-131], N[ArcTan[N[(v / N[(-9.8 * N[(H / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -1.65 \cdot 10^{-209}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 1.82 \cdot 10^{-131}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{-9.8 \cdot \frac{H}{v}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -1.64999999999999987e-209Initial program 61.2%
sqr-neg61.2%
sqr-neg61.2%
metadata-eval61.2%
Simplified61.2%
Taylor expanded in v around -inf 75.4%
if -1.64999999999999987e-209 < v < 1.8200000000000001e-131Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in H around 0 28.8%
Taylor expanded in v around 0 28.8%
if 1.8200000000000001e-131 < v Initial program 71.4%
sqr-neg71.4%
sqr-neg71.4%
metadata-eval71.4%
Simplified71.4%
Taylor expanded in v around inf 75.4%
(FPCore (v H) :precision binary64 (if (<= v -6.5e-210) (atan -1.0) (atan (/ v (+ v (* -9.8 (/ H v)))))))
double code(double v, double H) {
double tmp;
if (v <= -6.5e-210) {
tmp = atan(-1.0);
} else {
tmp = atan((v / (v + (-9.8 * (H / v)))));
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-6.5d-210)) then
tmp = atan((-1.0d0))
else
tmp = atan((v / (v + ((-9.8d0) * (h / v)))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -6.5e-210) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan((v / (v + (-9.8 * (H / v)))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -6.5e-210: tmp = math.atan(-1.0) else: tmp = math.atan((v / (v + (-9.8 * (H / v))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -6.5e-210) tmp = atan(-1.0); else tmp = atan(Float64(v / Float64(v + Float64(-9.8 * Float64(H / v))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -6.5e-210) tmp = atan(-1.0); else tmp = atan((v / (v + (-9.8 * (H / v))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -6.5e-210], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[N[(v / N[(v + N[(-9.8 * N[(H / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -6.5 \cdot 10^{-210}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + -9.8 \cdot \frac{H}{v}}\right)\\
\end{array}
\end{array}
if v < -6.49999999999999961e-210Initial program 61.2%
sqr-neg61.2%
sqr-neg61.2%
metadata-eval61.2%
Simplified61.2%
Taylor expanded in v around -inf 75.4%
if -6.49999999999999961e-210 < v Initial program 81.2%
sqr-neg81.2%
sqr-neg81.2%
metadata-eval81.2%
Simplified81.2%
Taylor expanded in H around 0 59.7%
(FPCore (v H) :precision binary64 (if (<= v 1.15e-300) (atan -1.0) (atan 1.0)))
double code(double v, double H) {
double tmp;
if (v <= 1.15e-300) {
tmp = atan(-1.0);
} else {
tmp = atan(1.0);
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= 1.15d-300) then
tmp = atan((-1.0d0))
else
tmp = atan(1.0d0)
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= 1.15e-300) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= 1.15e-300: tmp = math.atan(-1.0) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= 1.15e-300) tmp = atan(-1.0); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= 1.15e-300) tmp = atan(-1.0); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, 1.15e-300], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 1.15 \cdot 10^{-300}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < 1.15e-300Initial program 66.9%
sqr-neg66.9%
sqr-neg66.9%
metadata-eval66.9%
Simplified66.9%
Taylor expanded in v around -inf 64.8%
if 1.15e-300 < v Initial program 78.1%
sqr-neg78.1%
sqr-neg78.1%
metadata-eval78.1%
Simplified78.1%
Taylor expanded in v around inf 58.4%
(FPCore (v H) :precision binary64 (atan -1.0))
double code(double v, double H) {
return atan(-1.0);
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
code = atan((-1.0d0))
end function
public static double code(double v, double H) {
return Math.atan(-1.0);
}
def code(v, H): return math.atan(-1.0)
function code(v, H) return atan(-1.0) end
function tmp = code(v, H) tmp = atan(-1.0); end
code[v_, H_] := N[ArcTan[-1.0], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1} -1
\end{array}
Initial program 72.2%
sqr-neg72.2%
sqr-neg72.2%
metadata-eval72.2%
Simplified72.2%
Taylor expanded in v around -inf 35.0%
herbie shell --seed 2024163
(FPCore (v H)
:name "Optimal throwing angle"
:precision binary64
(atan (/ v (sqrt (- (* v v) (* (* 2.0 9.8) H))))))