
(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 9 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
(if (<= v -1e+154)
(atan -1.0)
(if (<= v 2e+134)
(atan (* v (sqrt (/ 1.0 (- (* v v) (* 19.6 H))))))
(atan (/ v (+ v (* -9.8 (/ H v))))))))
double code(double v, double H) {
double tmp;
if (v <= -1e+154) {
tmp = atan(-1.0);
} else if (v <= 2e+134) {
tmp = atan((v * sqrt((1.0 / ((v * v) - (19.6 * 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 <= (-1d+154)) then
tmp = atan((-1.0d0))
else if (v <= 2d+134) then
tmp = atan((v * sqrt((1.0d0 / ((v * v) - (19.6d0 * 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 <= -1e+154) {
tmp = Math.atan(-1.0);
} else if (v <= 2e+134) {
tmp = Math.atan((v * Math.sqrt((1.0 / ((v * v) - (19.6 * H))))));
} else {
tmp = Math.atan((v / (v + (-9.8 * (H / v)))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -1e+154: tmp = math.atan(-1.0) elif v <= 2e+134: tmp = math.atan((v * math.sqrt((1.0 / ((v * v) - (19.6 * H)))))) else: tmp = math.atan((v / (v + (-9.8 * (H / v))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -1e+154) tmp = atan(-1.0); elseif (v <= 2e+134) tmp = atan(Float64(v * sqrt(Float64(1.0 / Float64(Float64(v * v) - Float64(19.6 * 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 <= -1e+154) tmp = atan(-1.0); elseif (v <= 2e+134) tmp = atan((v * sqrt((1.0 / ((v * v) - (19.6 * H)))))); else tmp = atan((v / (v + (-9.8 * (H / v))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -1e+154], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 2e+134], N[ArcTan[N[(v * N[Sqrt[N[(1.0 / N[(N[(v * v), $MachinePrecision] - N[(19.6 * H), $MachinePrecision]), $MachinePrecision]), $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 -1 \cdot 10^{+154}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 2 \cdot 10^{+134}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \sqrt{\frac{1}{v \cdot v - 19.6 \cdot H}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + -9.8 \cdot \frac{H}{v}}\right)\\
\end{array}
\end{array}
if v < -1.00000000000000004e154Initial program 3.1%
sqr-neg3.1%
sqr-neg3.1%
metadata-eval3.1%
Simplified3.1%
Taylor expanded in v around -inf 100.0%
if -1.00000000000000004e154 < v < 1.99999999999999984e134Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in v around 0 99.7%
unpow299.7%
Applied egg-rr99.7%
if 1.99999999999999984e134 < v Initial program 15.9%
sqr-neg15.9%
sqr-neg15.9%
metadata-eval15.9%
Simplified15.9%
Taylor expanded in H around 0 100.0%
(FPCore (v H) :precision binary64 (if (<= v -1.3e+154) (atan -1.0) (if (<= v 2e+139) (atan (/ v (sqrt (- (* v v) (* 19.6 H))))) (atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -1.3e+154) {
tmp = atan(-1.0);
} else if (v <= 2e+139) {
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 <= (-1.3d+154)) then
tmp = atan((-1.0d0))
else if (v <= 2d+139) 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 <= -1.3e+154) {
tmp = Math.atan(-1.0);
} else if (v <= 2e+139) {
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 <= -1.3e+154: tmp = math.atan(-1.0) elif v <= 2e+139: 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 <= -1.3e+154) tmp = atan(-1.0); elseif (v <= 2e+139) 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 <= -1.3e+154) tmp = atan(-1.0); elseif (v <= 2e+139) 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, -1.3e+154], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 2e+139], 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 -1.3 \cdot 10^{+154}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 2 \cdot 10^{+139}:\\
\;\;\;\;\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 < -1.29999999999999994e154Initial program 3.1%
sqr-neg3.1%
sqr-neg3.1%
metadata-eval3.1%
Simplified3.1%
Taylor expanded in v around -inf 100.0%
if -1.29999999999999994e154 < v < 2.00000000000000007e139Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
metadata-eval99.7%
Simplified99.7%
if 2.00000000000000007e139 < v Initial program 10.9%
sqr-neg10.9%
sqr-neg10.9%
metadata-eval10.9%
Simplified10.9%
Taylor expanded in v around inf 100.0%
(FPCore (v H)
:precision binary64
(if (<= v -1.9e-61)
(atan (/ v (- (/ (* H 9.8) v) v)))
(if (<= v 2.15e-97)
(atan (* v (sqrt (/ -0.05102040816326531 H))))
(atan (/ v (+ v (* -9.8 (/ H v))))))))
double code(double v, double H) {
double tmp;
if (v <= -1.9e-61) {
tmp = atan((v / (((H * 9.8) / v) - v)));
} else if (v <= 2.15e-97) {
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 <= (-1.9d-61)) then
tmp = atan((v / (((h * 9.8d0) / v) - v)))
else if (v <= 2.15d-97) 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 <= -1.9e-61) {
tmp = Math.atan((v / (((H * 9.8) / v) - v)));
} else if (v <= 2.15e-97) {
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 <= -1.9e-61: tmp = math.atan((v / (((H * 9.8) / v) - v))) elif v <= 2.15e-97: 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 <= -1.9e-61) tmp = atan(Float64(v / Float64(Float64(Float64(H * 9.8) / v) - v))); elseif (v <= 2.15e-97) 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 <= -1.9e-61) tmp = atan((v / (((H * 9.8) / v) - v))); elseif (v <= 2.15e-97) 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, -1.9e-61], N[ArcTan[N[(v / N[(N[(N[(H * 9.8), $MachinePrecision] / v), $MachinePrecision] - v), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 2.15e-97], 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 -1.9 \cdot 10^{-61}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\frac{H \cdot 9.8}{v} - v}\right)\\
\mathbf{elif}\;v \leq 2.15 \cdot 10^{-97}:\\
\;\;\;\;\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 < -1.8999999999999999e-61Initial program 54.7%
sqr-neg54.7%
sqr-neg54.7%
metadata-eval54.7%
Simplified54.7%
Taylor expanded in v around -inf 90.4%
associate-*r*90.4%
neg-mul-190.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in H around 0 90.4%
+-commutative90.4%
mul-1-neg90.4%
unsub-neg90.4%
associate-*r/90.4%
*-commutative90.4%
Simplified90.4%
if -1.8999999999999999e-61 < v < 2.15e-97Initial program 99.4%
sqr-neg99.4%
sqr-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in v around 0 99.4%
Taylor expanded in v around 0 89.1%
if 2.15e-97 < v Initial program 60.5%
sqr-neg60.5%
sqr-neg60.5%
metadata-eval60.5%
Simplified60.5%
Taylor expanded in H around 0 86.2%
(FPCore (v H) :precision binary64 (if (<= v -2.9e-219) (atan (/ v (* v (- -1.0 (* -9.8 (/ (/ H v) v)))))) (atan (/ v (+ v (* -9.8 (/ H v)))))))
double code(double v, double H) {
double tmp;
if (v <= -2.9e-219) {
tmp = atan((v / (v * (-1.0 - (-9.8 * ((H / v) / v))))));
} 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.9d-219)) then
tmp = atan((v / (v * ((-1.0d0) - ((-9.8d0) * ((h / v) / v))))))
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.9e-219) {
tmp = Math.atan((v / (v * (-1.0 - (-9.8 * ((H / v) / v))))));
} else {
tmp = Math.atan((v / (v + (-9.8 * (H / v)))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -2.9e-219: tmp = math.atan((v / (v * (-1.0 - (-9.8 * ((H / v) / v)))))) else: tmp = math.atan((v / (v + (-9.8 * (H / v))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -2.9e-219) tmp = atan(Float64(v / Float64(v * Float64(-1.0 - Float64(-9.8 * Float64(Float64(H / v) / v)))))); 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.9e-219) tmp = atan((v / (v * (-1.0 - (-9.8 * ((H / v) / v)))))); else tmp = atan((v / (v + (-9.8 * (H / v))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -2.9e-219], N[ArcTan[N[(v / N[(v * N[(-1.0 - N[(-9.8 * N[(N[(H / v), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $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.9 \cdot 10^{-219}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v \cdot \left(-1 - -9.8 \cdot \frac{\frac{H}{v}}{v}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + -9.8 \cdot \frac{H}{v}}\right)\\
\end{array}
\end{array}
if v < -2.89999999999999984e-219Initial program 62.2%
sqr-neg62.2%
sqr-neg62.2%
metadata-eval62.2%
Simplified62.2%
Taylor expanded in v around -inf 80.7%
associate-*r*80.7%
neg-mul-180.7%
*-commutative80.7%
Simplified80.7%
*-un-lft-identity80.7%
unpow280.7%
times-frac80.8%
Applied egg-rr80.8%
associate-*l/80.8%
*-lft-identity80.8%
Simplified80.8%
if -2.89999999999999984e-219 < v Initial program 69.7%
sqr-neg69.7%
sqr-neg69.7%
metadata-eval69.7%
Simplified69.7%
Taylor expanded in H around 0 73.7%
Final simplification76.7%
(FPCore (v H)
:precision binary64
(if (<= v -5.1e-169)
(atan -1.0)
(if (<= v 4.8e-144)
(atan (* -0.10204081632653061 (* v (/ v H))))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -5.1e-169) {
tmp = atan(-1.0);
} else if (v <= 4.8e-144) {
tmp = atan((-0.10204081632653061 * (v * (v / 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 <= (-5.1d-169)) then
tmp = atan((-1.0d0))
else if (v <= 4.8d-144) then
tmp = atan(((-0.10204081632653061d0) * (v * (v / h))))
else
tmp = atan(1.0d0)
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -5.1e-169) {
tmp = Math.atan(-1.0);
} else if (v <= 4.8e-144) {
tmp = Math.atan((-0.10204081632653061 * (v * (v / H))));
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -5.1e-169: tmp = math.atan(-1.0) elif v <= 4.8e-144: tmp = math.atan((-0.10204081632653061 * (v * (v / H)))) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -5.1e-169) tmp = atan(-1.0); elseif (v <= 4.8e-144) tmp = atan(Float64(-0.10204081632653061 * Float64(v * Float64(v / H)))); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -5.1e-169) tmp = atan(-1.0); elseif (v <= 4.8e-144) tmp = atan((-0.10204081632653061 * (v * (v / H)))); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -5.1e-169], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 4.8e-144], N[ArcTan[N[(-0.10204081632653061 * N[(v * N[(v / H), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -5.1 \cdot 10^{-169}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 4.8 \cdot 10^{-144}:\\
\;\;\;\;\tan^{-1} \left(-0.10204081632653061 \cdot \left(v \cdot \frac{v}{H}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -5.09999999999999997e-169Initial program 60.4%
sqr-neg60.4%
sqr-neg60.4%
metadata-eval60.4%
Simplified60.4%
Taylor expanded in v around -inf 83.8%
if -5.09999999999999997e-169 < v < 4.79999999999999988e-144Initial program 99.5%
sqr-neg99.5%
sqr-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in H around 0 35.4%
Taylor expanded in v around 0 35.4%
*-un-lft-identity35.4%
*-commutative35.4%
times-frac35.4%
clear-num35.4%
div-inv35.4%
metadata-eval35.4%
Applied egg-rr35.4%
associate-*r*35.4%
associate-/r/35.4%
*-commutative35.4%
associate-/r/35.4%
Simplified35.4%
if 4.79999999999999988e-144 < v Initial program 63.9%
sqr-neg63.9%
sqr-neg63.9%
metadata-eval63.9%
Simplified63.9%
Taylor expanded in v around inf 79.3%
Final simplification76.1%
(FPCore (v H) :precision binary64 (if (<= v -2.9e-219) (atan (/ v (- (/ (* H 9.8) v) v))) (atan (/ v (+ v (* -9.8 (/ H v)))))))
double code(double v, double H) {
double tmp;
if (v <= -2.9e-219) {
tmp = atan((v / (((H * 9.8) / v) - v)));
} 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.9d-219)) then
tmp = atan((v / (((h * 9.8d0) / v) - v)))
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.9e-219) {
tmp = Math.atan((v / (((H * 9.8) / v) - v)));
} else {
tmp = Math.atan((v / (v + (-9.8 * (H / v)))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -2.9e-219: tmp = math.atan((v / (((H * 9.8) / v) - v))) else: tmp = math.atan((v / (v + (-9.8 * (H / v))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -2.9e-219) tmp = atan(Float64(v / Float64(Float64(Float64(H * 9.8) / v) - v))); 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.9e-219) tmp = atan((v / (((H * 9.8) / v) - v))); else tmp = atan((v / (v + (-9.8 * (H / v))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -2.9e-219], N[ArcTan[N[(v / N[(N[(N[(H * 9.8), $MachinePrecision] / v), $MachinePrecision] - v), $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.9 \cdot 10^{-219}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\frac{H \cdot 9.8}{v} - v}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + -9.8 \cdot \frac{H}{v}}\right)\\
\end{array}
\end{array}
if v < -2.89999999999999984e-219Initial program 62.2%
sqr-neg62.2%
sqr-neg62.2%
metadata-eval62.2%
Simplified62.2%
Taylor expanded in v around -inf 80.7%
associate-*r*80.7%
neg-mul-180.7%
*-commutative80.7%
Simplified80.7%
Taylor expanded in H around 0 80.7%
+-commutative80.7%
mul-1-neg80.7%
unsub-neg80.7%
associate-*r/80.7%
*-commutative80.7%
Simplified80.7%
if -2.89999999999999984e-219 < v Initial program 69.7%
sqr-neg69.7%
sqr-neg69.7%
metadata-eval69.7%
Simplified69.7%
Taylor expanded in H around 0 73.7%
(FPCore (v H) :precision binary64 (if (<= v -5.1e-169) (atan -1.0) (atan (/ v (+ v (* -9.8 (/ H v)))))))
double code(double v, double H) {
double tmp;
if (v <= -5.1e-169) {
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 <= (-5.1d-169)) 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 <= -5.1e-169) {
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 <= -5.1e-169: 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 <= -5.1e-169) 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 <= -5.1e-169) tmp = atan(-1.0); else tmp = atan((v / (v + (-9.8 * (H / v))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -5.1e-169], 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 -5.1 \cdot 10^{-169}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + -9.8 \cdot \frac{H}{v}}\right)\\
\end{array}
\end{array}
if v < -5.09999999999999997e-169Initial program 60.4%
sqr-neg60.4%
sqr-neg60.4%
metadata-eval60.4%
Simplified60.4%
Taylor expanded in v around -inf 83.8%
if -5.09999999999999997e-169 < v Initial program 70.6%
sqr-neg70.6%
sqr-neg70.6%
metadata-eval70.6%
Simplified70.6%
Taylor expanded in H around 0 71.5%
(FPCore (v H) :precision binary64 (if (<= v -2e-310) (atan -1.0) (atan 1.0)))
double code(double v, double H) {
double tmp;
if (v <= -2e-310) {
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 <= (-2d-310)) 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 <= -2e-310) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -2e-310: tmp = math.atan(-1.0) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -2e-310) tmp = atan(-1.0); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -2e-310) tmp = atan(-1.0); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -2e-310], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -1.999999999999994e-310Initial program 65.0%
sqr-neg65.0%
sqr-neg65.0%
metadata-eval65.0%
Simplified65.0%
Taylor expanded in v around -inf 74.2%
if -1.999999999999994e-310 < v Initial program 67.8%
sqr-neg67.8%
sqr-neg67.8%
metadata-eval67.8%
Simplified67.8%
Taylor expanded in v around inf 71.2%
(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 66.5%
sqr-neg66.5%
sqr-neg66.5%
metadata-eval66.5%
Simplified66.5%
Taylor expanded in v around -inf 34.9%
herbie shell --seed 2024181
(FPCore (v H)
:name "Optimal throwing angle"
:precision binary64
(atan (/ v (sqrt (- (* v v) (* (* 2.0 9.8) H))))))