
(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 12 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 v) (* 19.6 H))) (t_1 (/ v (sqrt t_0))))
(if (<= t_1 -5e-322)
(atan (* v (sqrt (/ 1.0 t_0))))
(if (<= t_1 0.0)
(atan (/ v (fabs (- v (* 9.8 (/ H v))))))
(atan (/ v (sqrt (fma v v (* H -19.6)))))))))
double code(double v, double H) {
double t_0 = (v * v) - (19.6 * H);
double t_1 = v / sqrt(t_0);
double tmp;
if (t_1 <= -5e-322) {
tmp = atan((v * sqrt((1.0 / t_0))));
} else if (t_1 <= 0.0) {
tmp = atan((v / fabs((v - (9.8 * (H / v))))));
} else {
tmp = atan((v / sqrt(fma(v, v, (H * -19.6)))));
}
return tmp;
}
function code(v, H) t_0 = Float64(Float64(v * v) - Float64(19.6 * H)) t_1 = Float64(v / sqrt(t_0)) tmp = 0.0 if (t_1 <= -5e-322) tmp = atan(Float64(v * sqrt(Float64(1.0 / t_0)))); elseif (t_1 <= 0.0) tmp = atan(Float64(v / abs(Float64(v - Float64(9.8 * Float64(H / v)))))); else tmp = atan(Float64(v / sqrt(fma(v, v, Float64(H * -19.6))))); end return tmp end
code[v_, H_] := Block[{t$95$0 = N[(N[(v * v), $MachinePrecision] - N[(19.6 * H), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(v / N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-322], N[ArcTan[N[(v * N[Sqrt[N[(1.0 / t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[ArcTan[N[(v / N[Abs[N[(v - N[(9.8 * N[(H / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[Sqrt[N[(v * v + N[(H * -19.6), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := v \cdot v - 19.6 \cdot H\\
t_1 := \frac{v}{\sqrt{t\_0}}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-322}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \sqrt{\frac{1}{t\_0}}\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\left|v - 9.8 \cdot \frac{H}{v}\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\sqrt{\mathsf{fma}\left(v, v, H \cdot -19.6\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)))) < -4.99006e-322Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around 0 99.8%
pow299.8%
Applied egg-rr99.8%
if -4.99006e-322 < (/.f64 v (sqrt.f64 (-.f64 (*.f64 v v) (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 49/5 binary64)) H)))) < 0.0Initial program 10.7%
sqr-neg10.7%
sqr-neg10.7%
fma-neg10.7%
*-commutative10.7%
distribute-rgt-neg-in10.7%
metadata-eval10.7%
metadata-eval10.7%
Simplified10.7%
Taylor expanded in H around 0 65.7%
add-sqr-sqrt60.4%
sqrt-unprod10.7%
pow210.7%
+-commutative10.7%
fma-define10.7%
Applied egg-rr10.7%
unpow210.7%
rem-sqrt-square99.4%
fma-undefine99.4%
associate-*r/98.9%
*-commutative98.9%
associate-/l*99.4%
metadata-eval99.4%
associate-*r/99.4%
rem-cube-cbrt99.4%
fma-define99.4%
rem-cube-cbrt99.4%
associate-*r/99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in H around inf 99.4%
if 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%
fma-neg99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.6%
(FPCore (v H)
:precision binary64
(let* ((t_0 (- (* v v) (* 19.6 H))) (t_1 (/ v (sqrt t_0))))
(if (<= t_1 -5e-322)
(atan (* v (sqrt (/ 1.0 t_0))))
(if (<= t_1 0.0) (atan (/ v (fabs (- v (* 9.8 (/ H v)))))) (atan t_1)))))
double code(double v, double H) {
double t_0 = (v * v) - (19.6 * H);
double t_1 = v / sqrt(t_0);
double tmp;
if (t_1 <= -5e-322) {
tmp = atan((v * sqrt((1.0 / t_0))));
} else if (t_1 <= 0.0) {
tmp = atan((v / fabs((v - (9.8 * (H / v))))));
} else {
tmp = atan(t_1);
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (v * v) - (19.6d0 * h)
t_1 = v / sqrt(t_0)
if (t_1 <= (-5d-322)) then
tmp = atan((v * sqrt((1.0d0 / t_0))))
else if (t_1 <= 0.0d0) then
tmp = atan((v / abs((v - (9.8d0 * (h / v))))))
else
tmp = atan(t_1)
end if
code = tmp
end function
public static double code(double v, double H) {
double t_0 = (v * v) - (19.6 * H);
double t_1 = v / Math.sqrt(t_0);
double tmp;
if (t_1 <= -5e-322) {
tmp = Math.atan((v * Math.sqrt((1.0 / t_0))));
} else if (t_1 <= 0.0) {
tmp = Math.atan((v / Math.abs((v - (9.8 * (H / v))))));
} else {
tmp = Math.atan(t_1);
}
return tmp;
}
def code(v, H): t_0 = (v * v) - (19.6 * H) t_1 = v / math.sqrt(t_0) tmp = 0 if t_1 <= -5e-322: tmp = math.atan((v * math.sqrt((1.0 / t_0)))) elif t_1 <= 0.0: tmp = math.atan((v / math.fabs((v - (9.8 * (H / v)))))) else: tmp = math.atan(t_1) return tmp
function code(v, H) t_0 = Float64(Float64(v * v) - Float64(19.6 * H)) t_1 = Float64(v / sqrt(t_0)) tmp = 0.0 if (t_1 <= -5e-322) tmp = atan(Float64(v * sqrt(Float64(1.0 / t_0)))); elseif (t_1 <= 0.0) tmp = atan(Float64(v / abs(Float64(v - Float64(9.8 * Float64(H / v)))))); else tmp = atan(t_1); end return tmp end
function tmp_2 = code(v, H) t_0 = (v * v) - (19.6 * H); t_1 = v / sqrt(t_0); tmp = 0.0; if (t_1 <= -5e-322) tmp = atan((v * sqrt((1.0 / t_0)))); elseif (t_1 <= 0.0) tmp = atan((v / abs((v - (9.8 * (H / v)))))); else tmp = atan(t_1); end tmp_2 = tmp; end
code[v_, H_] := Block[{t$95$0 = N[(N[(v * v), $MachinePrecision] - N[(19.6 * H), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(v / N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-322], N[ArcTan[N[(v * N[Sqrt[N[(1.0 / t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[ArcTan[N[(v / N[Abs[N[(v - N[(9.8 * N[(H / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := v \cdot v - 19.6 \cdot H\\
t_1 := \frac{v}{\sqrt{t\_0}}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-322}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \sqrt{\frac{1}{t\_0}}\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\left|v - 9.8 \cdot \frac{H}{v}\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} t\_1\\
\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)))) < -4.99006e-322Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in v around 0 99.8%
pow299.8%
Applied egg-rr99.8%
if -4.99006e-322 < (/.f64 v (sqrt.f64 (-.f64 (*.f64 v v) (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 49/5 binary64)) H)))) < 0.0Initial program 10.7%
sqr-neg10.7%
sqr-neg10.7%
fma-neg10.7%
*-commutative10.7%
distribute-rgt-neg-in10.7%
metadata-eval10.7%
metadata-eval10.7%
Simplified10.7%
Taylor expanded in H around 0 65.7%
add-sqr-sqrt60.4%
sqrt-unprod10.7%
pow210.7%
+-commutative10.7%
fma-define10.7%
Applied egg-rr10.7%
unpow210.7%
rem-sqrt-square99.4%
fma-undefine99.4%
associate-*r/98.9%
*-commutative98.9%
associate-/l*99.4%
metadata-eval99.4%
associate-*r/99.4%
rem-cube-cbrt99.4%
fma-define99.4%
rem-cube-cbrt99.4%
associate-*r/99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in H around inf 99.4%
if 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%
metadata-eval99.7%
Simplified99.7%
Final simplification99.6%
(FPCore (v H) :precision binary64 (if (<= (* 19.6 H) -1e-301) (atan (* v (/ 1.0 (hypot v (sqrt (* H -19.6)))))) (atan (/ v (fabs (- v (* 9.8 (/ H v))))))))
double code(double v, double H) {
double tmp;
if ((19.6 * H) <= -1e-301) {
tmp = atan((v * (1.0 / hypot(v, sqrt((H * -19.6))))));
} else {
tmp = atan((v / fabs((v - (9.8 * (H / v))))));
}
return tmp;
}
public static double code(double v, double H) {
double tmp;
if ((19.6 * H) <= -1e-301) {
tmp = Math.atan((v * (1.0 / Math.hypot(v, Math.sqrt((H * -19.6))))));
} else {
tmp = Math.atan((v / Math.abs((v - (9.8 * (H / v))))));
}
return tmp;
}
def code(v, H): tmp = 0 if (19.6 * H) <= -1e-301: tmp = math.atan((v * (1.0 / math.hypot(v, math.sqrt((H * -19.6)))))) else: tmp = math.atan((v / math.fabs((v - (9.8 * (H / v)))))) return tmp
function code(v, H) tmp = 0.0 if (Float64(19.6 * H) <= -1e-301) tmp = atan(Float64(v * Float64(1.0 / hypot(v, sqrt(Float64(H * -19.6)))))); else tmp = atan(Float64(v / abs(Float64(v - Float64(9.8 * Float64(H / v)))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if ((19.6 * H) <= -1e-301) tmp = atan((v * (1.0 / hypot(v, sqrt((H * -19.6)))))); else tmp = atan((v / abs((v - (9.8 * (H / v)))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[N[(19.6 * H), $MachinePrecision], -1e-301], N[ArcTan[N[(v * N[(1.0 / N[Sqrt[v ^ 2 + N[Sqrt[N[(H * -19.6), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[Abs[N[(v - N[(9.8 * N[(H / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;19.6 \cdot H \leq -1 \cdot 10^{-301}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \frac{1}{\mathsf{hypot}\left(v, \sqrt{H \cdot -19.6}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\left|v - 9.8 \cdot \frac{H}{v}\right|}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 49/5 binary64)) H) < -1.00000000000000007e-301Initial program 72.7%
metadata-eval72.7%
Simplified72.7%
Taylor expanded in v around 0 72.7%
sqrt-div72.6%
metadata-eval72.6%
add-cube-cbrt72.3%
unpow372.3%
pow272.3%
div-inv72.4%
clear-num71.7%
Applied egg-rr72.0%
associate-/r/72.6%
fma-undefine72.6%
add-sqr-sqrt72.6%
hypot-define99.2%
Applied egg-rr99.2%
if -1.00000000000000007e-301 < (*.f64 (*.f64 #s(literal 2 binary64) #s(literal 49/5 binary64)) H) Initial program 59.7%
sqr-neg59.7%
sqr-neg59.7%
fma-neg59.7%
*-commutative59.7%
distribute-rgt-neg-in59.7%
metadata-eval59.7%
metadata-eval59.7%
Simplified59.7%
Taylor expanded in H around 0 52.7%
add-sqr-sqrt51.8%
sqrt-unprod59.7%
pow259.7%
+-commutative59.7%
fma-define59.7%
Applied egg-rr59.7%
unpow259.7%
rem-sqrt-square100.0%
fma-undefine100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
metadata-eval100.0%
associate-*r/100.0%
rem-cube-cbrt100.0%
fma-define100.0%
rem-cube-cbrt100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in H around inf 100.0%
Final simplification99.4%
(FPCore (v H)
:precision binary64
(if (<= v -3.1e+69)
(atan (/ v (fabs (- v (* 9.8 (/ H v))))))
(if (<= v 1.2e+60)
(atan (/ v (sqrt (- (* v v) (* 19.6 H)))))
(atan (/ v (+ v (* (/ H v) -9.8)))))))
double code(double v, double H) {
double tmp;
if (v <= -3.1e+69) {
tmp = atan((v / fabs((v - (9.8 * (H / v))))));
} else if (v <= 1.2e+60) {
tmp = atan((v / sqrt(((v * v) - (19.6 * H)))));
} else {
tmp = atan((v / (v + ((H / v) * -9.8))));
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-3.1d+69)) then
tmp = atan((v / abs((v - (9.8d0 * (h / v))))))
else if (v <= 1.2d+60) then
tmp = atan((v / sqrt(((v * v) - (19.6d0 * h)))))
else
tmp = atan((v / (v + ((h / v) * (-9.8d0)))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -3.1e+69) {
tmp = Math.atan((v / Math.abs((v - (9.8 * (H / v))))));
} else if (v <= 1.2e+60) {
tmp = Math.atan((v / Math.sqrt(((v * v) - (19.6 * H)))));
} else {
tmp = Math.atan((v / (v + ((H / v) * -9.8))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -3.1e+69: tmp = math.atan((v / math.fabs((v - (9.8 * (H / v)))))) elif v <= 1.2e+60: tmp = math.atan((v / math.sqrt(((v * v) - (19.6 * H))))) else: tmp = math.atan((v / (v + ((H / v) * -9.8)))) return tmp
function code(v, H) tmp = 0.0 if (v <= -3.1e+69) tmp = atan(Float64(v / abs(Float64(v - Float64(9.8 * Float64(H / v)))))); elseif (v <= 1.2e+60) tmp = atan(Float64(v / sqrt(Float64(Float64(v * v) - Float64(19.6 * H))))); else tmp = atan(Float64(v / Float64(v + Float64(Float64(H / v) * -9.8)))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -3.1e+69) tmp = atan((v / abs((v - (9.8 * (H / v)))))); elseif (v <= 1.2e+60) tmp = atan((v / sqrt(((v * v) - (19.6 * H))))); else tmp = atan((v / (v + ((H / v) * -9.8)))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -3.1e+69], N[ArcTan[N[(v / N[Abs[N[(v - N[(9.8 * N[(H / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 1.2e+60], N[ArcTan[N[(v / N[Sqrt[N[(N[(v * v), $MachinePrecision] - N[(19.6 * H), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(v + N[(N[(H / v), $MachinePrecision] * -9.8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -3.1 \cdot 10^{+69}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\left|v - 9.8 \cdot \frac{H}{v}\right|}\right)\\
\mathbf{elif}\;v \leq 1.2 \cdot 10^{+60}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - 19.6 \cdot H}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + \frac{H}{v} \cdot -9.8}\right)\\
\end{array}
\end{array}
if v < -3.0999999999999998e69Initial program 31.7%
sqr-neg31.7%
sqr-neg31.7%
fma-neg31.7%
*-commutative31.7%
distribute-rgt-neg-in31.7%
metadata-eval31.7%
metadata-eval31.7%
Simplified31.7%
Taylor expanded in H around 0 1.6%
add-sqr-sqrt0.0%
sqrt-unprod31.7%
pow231.7%
+-commutative31.7%
fma-define31.7%
Applied egg-rr31.7%
unpow231.7%
rem-sqrt-square98.7%
fma-undefine98.7%
associate-*r/97.8%
*-commutative97.8%
associate-/l*98.7%
metadata-eval98.7%
associate-*r/98.7%
rem-cube-cbrt98.7%
fma-define98.7%
rem-cube-cbrt98.7%
associate-*r/98.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in H around inf 98.7%
if -3.0999999999999998e69 < v < 1.2e60Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
if 1.2e60 < v Initial program 34.1%
sqr-neg34.1%
sqr-neg34.1%
fma-neg34.1%
*-commutative34.1%
distribute-rgt-neg-in34.1%
metadata-eval34.1%
metadata-eval34.1%
Simplified34.1%
Taylor expanded in H around 0 100.0%
Final simplification99.6%
(FPCore (v H)
:precision binary64
(if (<= v -1.22e-76)
(atan (/ v (fabs (- v (* 9.8 (/ H v))))))
(if (<= v 8e-27)
(atan (* v (sqrt (/ -0.05102040816326531 H))))
(atan (/ v (+ v (/ 1.0 (/ v (* H -9.8)))))))))
double code(double v, double H) {
double tmp;
if (v <= -1.22e-76) {
tmp = atan((v / fabs((v - (9.8 * (H / v))))));
} else if (v <= 8e-27) {
tmp = atan((v * sqrt((-0.05102040816326531 / H))));
} else {
tmp = atan((v / (v + (1.0 / (v / (H * -9.8))))));
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-1.22d-76)) then
tmp = atan((v / abs((v - (9.8d0 * (h / v))))))
else if (v <= 8d-27) then
tmp = atan((v * sqrt(((-0.05102040816326531d0) / h))))
else
tmp = atan((v / (v + (1.0d0 / (v / (h * (-9.8d0)))))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -1.22e-76) {
tmp = Math.atan((v / Math.abs((v - (9.8 * (H / v))))));
} else if (v <= 8e-27) {
tmp = Math.atan((v * Math.sqrt((-0.05102040816326531 / H))));
} else {
tmp = Math.atan((v / (v + (1.0 / (v / (H * -9.8))))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -1.22e-76: tmp = math.atan((v / math.fabs((v - (9.8 * (H / v)))))) elif v <= 8e-27: tmp = math.atan((v * math.sqrt((-0.05102040816326531 / H)))) else: tmp = math.atan((v / (v + (1.0 / (v / (H * -9.8)))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -1.22e-76) tmp = atan(Float64(v / abs(Float64(v - Float64(9.8 * Float64(H / v)))))); elseif (v <= 8e-27) tmp = atan(Float64(v * sqrt(Float64(-0.05102040816326531 / H)))); else tmp = atan(Float64(v / Float64(v + Float64(1.0 / Float64(v / Float64(H * -9.8)))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -1.22e-76) tmp = atan((v / abs((v - (9.8 * (H / v)))))); elseif (v <= 8e-27) tmp = atan((v * sqrt((-0.05102040816326531 / H)))); else tmp = atan((v / (v + (1.0 / (v / (H * -9.8)))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -1.22e-76], N[ArcTan[N[(v / N[Abs[N[(v - N[(9.8 * N[(H / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 8e-27], N[ArcTan[N[(v * N[Sqrt[N[(-0.05102040816326531 / H), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(v + N[(1.0 / N[(v / N[(H * -9.8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -1.22 \cdot 10^{-76}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\left|v - 9.8 \cdot \frac{H}{v}\right|}\right)\\
\mathbf{elif}\;v \leq 8 \cdot 10^{-27}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \sqrt{\frac{-0.05102040816326531}{H}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + \frac{1}{\frac{v}{H \cdot -9.8}}}\right)\\
\end{array}
\end{array}
if v < -1.22e-76Initial program 60.9%
sqr-neg60.9%
sqr-neg60.9%
fma-neg60.9%
*-commutative60.9%
distribute-rgt-neg-in60.9%
metadata-eval60.9%
metadata-eval60.9%
Simplified60.9%
Taylor expanded in H around 0 1.7%
add-sqr-sqrt0.0%
sqrt-unprod51.2%
pow251.2%
+-commutative51.2%
fma-define51.2%
Applied egg-rr51.2%
unpow251.2%
rem-sqrt-square89.6%
fma-undefine89.6%
associate-*r/89.1%
*-commutative89.1%
associate-/l*89.6%
metadata-eval89.6%
associate-*r/89.6%
rem-cube-cbrt89.6%
fma-define89.6%
rem-cube-cbrt89.6%
associate-*r/89.6%
metadata-eval89.6%
Simplified89.6%
Taylor expanded in H around inf 89.6%
if -1.22e-76 < v < 8.0000000000000003e-27Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in v around 0 99.5%
Taylor expanded in v around 0 90.9%
if 8.0000000000000003e-27 < v Initial program 47.4%
sqr-neg47.4%
sqr-neg47.4%
fma-neg47.4%
*-commutative47.4%
distribute-rgt-neg-in47.4%
metadata-eval47.4%
metadata-eval47.4%
Simplified47.4%
Taylor expanded in H around 0 92.4%
associate-*r/92.4%
clear-num92.4%
*-commutative92.4%
Applied egg-rr92.4%
(FPCore (v H)
:precision binary64
(if (<= v -1.22e-76)
(atan (+ (/ (* (/ H v) -9.8) v) -1.0))
(if (<= v 1.26e-26)
(atan (* v (sqrt (/ -0.05102040816326531 H))))
(atan (/ v (+ v (/ 1.0 (/ v (* H -9.8)))))))))
double code(double v, double H) {
double tmp;
if (v <= -1.22e-76) {
tmp = atan(((((H / v) * -9.8) / v) + -1.0));
} else if (v <= 1.26e-26) {
tmp = atan((v * sqrt((-0.05102040816326531 / H))));
} else {
tmp = atan((v / (v + (1.0 / (v / (H * -9.8))))));
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-1.22d-76)) then
tmp = atan(((((h / v) * (-9.8d0)) / v) + (-1.0d0)))
else if (v <= 1.26d-26) then
tmp = atan((v * sqrt(((-0.05102040816326531d0) / h))))
else
tmp = atan((v / (v + (1.0d0 / (v / (h * (-9.8d0)))))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -1.22e-76) {
tmp = Math.atan(((((H / v) * -9.8) / v) + -1.0));
} else if (v <= 1.26e-26) {
tmp = Math.atan((v * Math.sqrt((-0.05102040816326531 / H))));
} else {
tmp = Math.atan((v / (v + (1.0 / (v / (H * -9.8))))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -1.22e-76: tmp = math.atan(((((H / v) * -9.8) / v) + -1.0)) elif v <= 1.26e-26: tmp = math.atan((v * math.sqrt((-0.05102040816326531 / H)))) else: tmp = math.atan((v / (v + (1.0 / (v / (H * -9.8)))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -1.22e-76) tmp = atan(Float64(Float64(Float64(Float64(H / v) * -9.8) / v) + -1.0)); elseif (v <= 1.26e-26) tmp = atan(Float64(v * sqrt(Float64(-0.05102040816326531 / H)))); else tmp = atan(Float64(v / Float64(v + Float64(1.0 / Float64(v / Float64(H * -9.8)))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -1.22e-76) tmp = atan(((((H / v) * -9.8) / v) + -1.0)); elseif (v <= 1.26e-26) tmp = atan((v * sqrt((-0.05102040816326531 / H)))); else tmp = atan((v / (v + (1.0 / (v / (H * -9.8)))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -1.22e-76], N[ArcTan[N[(N[(N[(N[(H / v), $MachinePrecision] * -9.8), $MachinePrecision] / v), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 1.26e-26], N[ArcTan[N[(v * N[Sqrt[N[(-0.05102040816326531 / H), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(v + N[(1.0 / N[(v / N[(H * -9.8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -1.22 \cdot 10^{-76}:\\
\;\;\;\;\tan^{-1} \left(\frac{\frac{H}{v} \cdot -9.8}{v} + -1\right)\\
\mathbf{elif}\;v \leq 1.26 \cdot 10^{-26}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \sqrt{\frac{-0.05102040816326531}{H}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + \frac{1}{\frac{v}{H \cdot -9.8}}}\right)\\
\end{array}
\end{array}
if v < -1.22e-76Initial program 60.9%
metadata-eval60.9%
Simplified60.9%
Taylor expanded in v around -inf 88.9%
associate-*r/88.5%
pow288.5%
associate-/r*88.5%
associate-*r/89.0%
Applied egg-rr89.0%
if -1.22e-76 < v < 1.26000000000000002e-26Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in v around 0 99.5%
Taylor expanded in v around 0 90.9%
if 1.26000000000000002e-26 < v Initial program 47.4%
sqr-neg47.4%
sqr-neg47.4%
fma-neg47.4%
*-commutative47.4%
distribute-rgt-neg-in47.4%
metadata-eval47.4%
metadata-eval47.4%
Simplified47.4%
Taylor expanded in H around 0 92.4%
associate-*r/92.4%
clear-num92.4%
*-commutative92.4%
Applied egg-rr92.4%
Final simplification90.9%
(FPCore (v H)
:precision binary64
(if (<= v -1.65e-137)
(atan (+ (/ (* (/ H v) -9.8) v) -1.0))
(if (<= v 9.2e-76)
(atan (* v (* v (/ -0.10204081632653061 H))))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -1.65e-137) {
tmp = atan(((((H / v) * -9.8) / v) + -1.0));
} else if (v <= 9.2e-76) {
tmp = atan((v * (v * (-0.10204081632653061 / 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 <= (-1.65d-137)) then
tmp = atan(((((h / v) * (-9.8d0)) / v) + (-1.0d0)))
else if (v <= 9.2d-76) then
tmp = atan((v * (v * ((-0.10204081632653061d0) / h))))
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-137) {
tmp = Math.atan(((((H / v) * -9.8) / v) + -1.0));
} else if (v <= 9.2e-76) {
tmp = Math.atan((v * (v * (-0.10204081632653061 / H))));
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -1.65e-137: tmp = math.atan(((((H / v) * -9.8) / v) + -1.0)) elif v <= 9.2e-76: tmp = math.atan((v * (v * (-0.10204081632653061 / H)))) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -1.65e-137) tmp = atan(Float64(Float64(Float64(Float64(H / v) * -9.8) / v) + -1.0)); elseif (v <= 9.2e-76) tmp = atan(Float64(v * Float64(v * Float64(-0.10204081632653061 / H)))); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -1.65e-137) tmp = atan(((((H / v) * -9.8) / v) + -1.0)); elseif (v <= 9.2e-76) tmp = atan((v * (v * (-0.10204081632653061 / H)))); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -1.65e-137], N[ArcTan[N[(N[(N[(N[(H / v), $MachinePrecision] * -9.8), $MachinePrecision] / v), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 9.2e-76], N[ArcTan[N[(v * N[(v * N[(-0.10204081632653061 / H), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -1.65 \cdot 10^{-137}:\\
\;\;\;\;\tan^{-1} \left(\frac{\frac{H}{v} \cdot -9.8}{v} + -1\right)\\
\mathbf{elif}\;v \leq 9.2 \cdot 10^{-76}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \left(v \cdot \frac{-0.10204081632653061}{H}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -1.6500000000000001e-137Initial program 65.4%
metadata-eval65.4%
Simplified65.4%
Taylor expanded in v around -inf 84.5%
associate-*r/84.2%
pow284.2%
associate-/r*84.2%
associate-*r/84.7%
Applied egg-rr84.7%
if -1.6500000000000001e-137 < v < 9.20000000000000025e-76Initial program 99.6%
sqr-neg99.6%
sqr-neg99.6%
fma-neg99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in H around 0 18.6%
Taylor expanded in v around 0 18.6%
*-un-lft-identity18.6%
*-un-lft-identity18.6%
*-commutative18.6%
times-frac18.6%
clear-num18.6%
div-inv18.6%
metadata-eval18.6%
Applied egg-rr18.6%
*-lft-identity18.6%
*-commutative18.6%
associate-*r/18.6%
associate-*l/18.6%
*-commutative18.6%
associate-/l*18.6%
Simplified18.6%
if 9.20000000000000025e-76 < v Initial program 52.4%
metadata-eval52.4%
Simplified52.4%
Taylor expanded in v around inf 87.0%
Final simplification68.9%
(FPCore (v H)
:precision binary64
(if (<= v -1.55e-173)
(atan -1.0)
(if (<= v 9.2e-76)
(atan (* v (* v (/ -0.10204081632653061 H))))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -1.55e-173) {
tmp = atan(-1.0);
} else if (v <= 9.2e-76) {
tmp = atan((v * (v * (-0.10204081632653061 / 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 <= (-1.55d-173)) then
tmp = atan((-1.0d0))
else if (v <= 9.2d-76) then
tmp = atan((v * (v * ((-0.10204081632653061d0) / h))))
else
tmp = atan(1.0d0)
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -1.55e-173) {
tmp = Math.atan(-1.0);
} else if (v <= 9.2e-76) {
tmp = Math.atan((v * (v * (-0.10204081632653061 / H))));
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -1.55e-173: tmp = math.atan(-1.0) elif v <= 9.2e-76: tmp = math.atan((v * (v * (-0.10204081632653061 / H)))) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -1.55e-173) tmp = atan(-1.0); elseif (v <= 9.2e-76) tmp = atan(Float64(v * Float64(v * Float64(-0.10204081632653061 / H)))); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -1.55e-173) tmp = atan(-1.0); elseif (v <= 9.2e-76) tmp = atan((v * (v * (-0.10204081632653061 / H)))); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -1.55e-173], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 9.2e-76], N[ArcTan[N[(v * N[(v * N[(-0.10204081632653061 / H), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -1.55 \cdot 10^{-173}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 9.2 \cdot 10^{-76}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \left(v \cdot \frac{-0.10204081632653061}{H}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -1.55000000000000003e-173Initial program 68.3%
metadata-eval68.3%
Simplified68.3%
Taylor expanded in v around -inf 77.7%
if -1.55000000000000003e-173 < v < 9.20000000000000025e-76Initial program 99.6%
sqr-neg99.6%
sqr-neg99.6%
fma-neg99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in H around 0 20.7%
Taylor expanded in v around 0 20.7%
*-un-lft-identity20.7%
*-un-lft-identity20.7%
*-commutative20.7%
times-frac20.7%
clear-num20.7%
div-inv20.7%
metadata-eval20.7%
Applied egg-rr20.7%
*-lft-identity20.7%
*-commutative20.7%
associate-*r/20.6%
associate-*l/20.7%
*-commutative20.7%
associate-/l*20.7%
Simplified20.7%
if 9.20000000000000025e-76 < v Initial program 52.4%
metadata-eval52.4%
Simplified52.4%
Taylor expanded in v around inf 87.0%
(FPCore (v H) :precision binary64 (if (<= v -2.4e-138) (atan (+ (/ (* (/ H v) -9.8) v) -1.0)) (atan (/ v (+ v (/ 1.0 (/ v (* H -9.8))))))))
double code(double v, double H) {
double tmp;
if (v <= -2.4e-138) {
tmp = atan(((((H / v) * -9.8) / v) + -1.0));
} else {
tmp = atan((v / (v + (1.0 / (v / (H * -9.8))))));
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-2.4d-138)) then
tmp = atan(((((h / v) * (-9.8d0)) / v) + (-1.0d0)))
else
tmp = atan((v / (v + (1.0d0 / (v / (h * (-9.8d0)))))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -2.4e-138) {
tmp = Math.atan(((((H / v) * -9.8) / v) + -1.0));
} else {
tmp = Math.atan((v / (v + (1.0 / (v / (H * -9.8))))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -2.4e-138: tmp = math.atan(((((H / v) * -9.8) / v) + -1.0)) else: tmp = math.atan((v / (v + (1.0 / (v / (H * -9.8)))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -2.4e-138) tmp = atan(Float64(Float64(Float64(Float64(H / v) * -9.8) / v) + -1.0)); else tmp = atan(Float64(v / Float64(v + Float64(1.0 / Float64(v / Float64(H * -9.8)))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -2.4e-138) tmp = atan(((((H / v) * -9.8) / v) + -1.0)); else tmp = atan((v / (v + (1.0 / (v / (H * -9.8)))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -2.4e-138], N[ArcTan[N[(N[(N[(N[(H / v), $MachinePrecision] * -9.8), $MachinePrecision] / v), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(v + N[(1.0 / N[(v / N[(H * -9.8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -2.4 \cdot 10^{-138}:\\
\;\;\;\;\tan^{-1} \left(\frac{\frac{H}{v} \cdot -9.8}{v} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + \frac{1}{\frac{v}{H \cdot -9.8}}}\right)\\
\end{array}
\end{array}
if v < -2.3999999999999999e-138Initial program 65.4%
metadata-eval65.4%
Simplified65.4%
Taylor expanded in v around -inf 84.5%
associate-*r/84.2%
pow284.2%
associate-/r*84.2%
associate-*r/84.7%
Applied egg-rr84.7%
if -2.3999999999999999e-138 < v Initial program 70.6%
sqr-neg70.6%
sqr-neg70.6%
fma-neg70.6%
*-commutative70.6%
distribute-rgt-neg-in70.6%
metadata-eval70.6%
metadata-eval70.6%
Simplified70.6%
Taylor expanded in H around 0 61.1%
associate-*r/61.1%
clear-num61.1%
*-commutative61.1%
Applied egg-rr61.1%
Final simplification69.1%
(FPCore (v H) :precision binary64 (let* ((t_0 (* (/ H v) -9.8))) (if (<= v -2.5e-141) (atan (+ (/ t_0 v) -1.0)) (atan (/ v (+ v t_0))))))
double code(double v, double H) {
double t_0 = (H / v) * -9.8;
double tmp;
if (v <= -2.5e-141) {
tmp = atan(((t_0 / v) + -1.0));
} else {
tmp = atan((v / (v + t_0)));
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: t_0
real(8) :: tmp
t_0 = (h / v) * (-9.8d0)
if (v <= (-2.5d-141)) then
tmp = atan(((t_0 / v) + (-1.0d0)))
else
tmp = atan((v / (v + t_0)))
end if
code = tmp
end function
public static double code(double v, double H) {
double t_0 = (H / v) * -9.8;
double tmp;
if (v <= -2.5e-141) {
tmp = Math.atan(((t_0 / v) + -1.0));
} else {
tmp = Math.atan((v / (v + t_0)));
}
return tmp;
}
def code(v, H): t_0 = (H / v) * -9.8 tmp = 0 if v <= -2.5e-141: tmp = math.atan(((t_0 / v) + -1.0)) else: tmp = math.atan((v / (v + t_0))) return tmp
function code(v, H) t_0 = Float64(Float64(H / v) * -9.8) tmp = 0.0 if (v <= -2.5e-141) tmp = atan(Float64(Float64(t_0 / v) + -1.0)); else tmp = atan(Float64(v / Float64(v + t_0))); end return tmp end
function tmp_2 = code(v, H) t_0 = (H / v) * -9.8; tmp = 0.0; if (v <= -2.5e-141) tmp = atan(((t_0 / v) + -1.0)); else tmp = atan((v / (v + t_0))); end tmp_2 = tmp; end
code[v_, H_] := Block[{t$95$0 = N[(N[(H / v), $MachinePrecision] * -9.8), $MachinePrecision]}, If[LessEqual[v, -2.5e-141], N[ArcTan[N[(N[(t$95$0 / v), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(v + t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{H}{v} \cdot -9.8\\
\mathbf{if}\;v \leq -2.5 \cdot 10^{-141}:\\
\;\;\;\;\tan^{-1} \left(\frac{t\_0}{v} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + t\_0}\right)\\
\end{array}
\end{array}
if v < -2.5e-141Initial program 65.4%
metadata-eval65.4%
Simplified65.4%
Taylor expanded in v around -inf 84.5%
associate-*r/84.2%
pow284.2%
associate-/r*84.2%
associate-*r/84.7%
Applied egg-rr84.7%
if -2.5e-141 < v Initial program 70.6%
sqr-neg70.6%
sqr-neg70.6%
fma-neg70.6%
*-commutative70.6%
distribute-rgt-neg-in70.6%
metadata-eval70.6%
metadata-eval70.6%
Simplified70.6%
Taylor expanded in H around 0 61.1%
Final simplification69.1%
(FPCore (v H) :precision binary64 (if (<= v -5.8e-304) (atan -1.0) (atan 1.0)))
double code(double v, double H) {
double tmp;
if (v <= -5.8e-304) {
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 <= (-5.8d-304)) 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 <= -5.8e-304) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -5.8e-304: tmp = math.atan(-1.0) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -5.8e-304) tmp = atan(-1.0); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -5.8e-304) tmp = atan(-1.0); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -5.8e-304], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -5.8 \cdot 10^{-304}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -5.8e-304Initial program 73.0%
metadata-eval73.0%
Simplified73.0%
Taylor expanded in v around -inf 66.5%
if -5.8e-304 < v Initial program 65.5%
metadata-eval65.5%
Simplified65.5%
Taylor expanded in v around inf 64.1%
(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 68.8%
metadata-eval68.8%
Simplified68.8%
Taylor expanded in v around -inf 30.1%
herbie shell --seed 2024141
(FPCore (v H)
:name "Optimal throwing angle"
:precision binary64
(atan (/ v (sqrt (- (* v v) (* (* 2.0 9.8) H))))))