
(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 8 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 -2e+154)
(atan -1.0)
(if (<= v 1e+116)
(atan (* v (sqrt (/ 1.0 (- (* v v) (* 19.6 H))))))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -2e+154) {
tmp = atan(-1.0);
} else if (v <= 1e+116) {
tmp = atan((v * sqrt((1.0 / ((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 <= (-2d+154)) then
tmp = atan((-1.0d0))
else if (v <= 1d+116) then
tmp = atan((v * sqrt((1.0d0 / ((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 <= -2e+154) {
tmp = Math.atan(-1.0);
} else if (v <= 1e+116) {
tmp = Math.atan((v * Math.sqrt((1.0 / ((v * v) - (19.6 * H))))));
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -2e+154: tmp = math.atan(-1.0) elif v <= 1e+116: tmp = math.atan((v * math.sqrt((1.0 / ((v * v) - (19.6 * H)))))) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -2e+154) tmp = atan(-1.0); elseif (v <= 1e+116) tmp = atan(Float64(v * sqrt(Float64(1.0 / 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 <= -2e+154) tmp = atan(-1.0); elseif (v <= 1e+116) tmp = atan((v * sqrt((1.0 / ((v * v) - (19.6 * H)))))); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -2e+154], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 1e+116], 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[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -2 \cdot 10^{+154}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 10^{+116}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \sqrt{\frac{1}{v \cdot v - 19.6 \cdot H}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -2.00000000000000007e154Initial program 3.1%
metadata-eval3.1%
Simplified3.1%
Taylor expanded in v around -inf 100.0%
if -2.00000000000000007e154 < v < 1.00000000000000002e116Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in v around 0 99.8%
pow299.8%
Applied egg-rr99.8%
if 1.00000000000000002e116 < v Initial program 27.8%
metadata-eval27.8%
Simplified27.8%
Taylor expanded in v around inf 100.0%
(FPCore (v H) :precision binary64 (if (<= v -2e+154) (atan -1.0) (if (<= v 2e+117) (atan (/ v (sqrt (- (* v v) (* 19.6 H))))) (atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -2e+154) {
tmp = atan(-1.0);
} else if (v <= 2e+117) {
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 <= (-2d+154)) then
tmp = atan((-1.0d0))
else if (v <= 2d+117) 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 <= -2e+154) {
tmp = Math.atan(-1.0);
} else if (v <= 2e+117) {
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 <= -2e+154: tmp = math.atan(-1.0) elif v <= 2e+117: 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 <= -2e+154) tmp = atan(-1.0); elseif (v <= 2e+117) 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 <= -2e+154) tmp = atan(-1.0); elseif (v <= 2e+117) 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, -2e+154], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 2e+117], 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 -2 \cdot 10^{+154}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 2 \cdot 10^{+117}:\\
\;\;\;\;\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 < -2.00000000000000007e154Initial program 3.1%
metadata-eval3.1%
Simplified3.1%
Taylor expanded in v around -inf 100.0%
if -2.00000000000000007e154 < v < 2.0000000000000001e117Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
if 2.0000000000000001e117 < v Initial program 27.8%
metadata-eval27.8%
Simplified27.8%
Taylor expanded in v around inf 100.0%
(FPCore (v H)
:precision binary64
(if (<= v -4.5e-41)
(atan (+ -1.0 (* -9.8 (/ H (* v v)))))
(if (<= v 7.6e-90)
(atan (* v (sqrt (/ -0.05102040816326531 H))))
(atan (/ v (+ v (* -9.8 (/ H v))))))))
double code(double v, double H) {
double tmp;
if (v <= -4.5e-41) {
tmp = atan((-1.0 + (-9.8 * (H / (v * v)))));
} else if (v <= 7.6e-90) {
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 <= (-4.5d-41)) then
tmp = atan(((-1.0d0) + ((-9.8d0) * (h / (v * v)))))
else if (v <= 7.6d-90) 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 <= -4.5e-41) {
tmp = Math.atan((-1.0 + (-9.8 * (H / (v * v)))));
} else if (v <= 7.6e-90) {
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 <= -4.5e-41: tmp = math.atan((-1.0 + (-9.8 * (H / (v * v))))) elif v <= 7.6e-90: 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 <= -4.5e-41) tmp = atan(Float64(-1.0 + Float64(-9.8 * Float64(H / Float64(v * v))))); elseif (v <= 7.6e-90) 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 <= -4.5e-41) tmp = atan((-1.0 + (-9.8 * (H / (v * v))))); elseif (v <= 7.6e-90) 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, -4.5e-41], N[ArcTan[N[(-1.0 + N[(-9.8 * N[(H / N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 7.6e-90], 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 -4.5 \cdot 10^{-41}:\\
\;\;\;\;\tan^{-1} \left(-1 + -9.8 \cdot \frac{H}{v \cdot v}\right)\\
\mathbf{elif}\;v \leq 7.6 \cdot 10^{-90}:\\
\;\;\;\;\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 < -4.5e-41Initial program 57.4%
metadata-eval57.4%
Simplified57.4%
Taylor expanded in v around -inf 94.9%
pow257.5%
Applied egg-rr94.9%
if -4.5e-41 < v < 7.6e-90Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in v around 0 99.6%
Taylor expanded in v around 0 95.3%
if 7.6e-90 < v Initial program 59.0%
sqr-neg59.0%
sqr-neg59.0%
fma-neg59.0%
*-commutative59.0%
distribute-rgt-neg-in59.0%
metadata-eval59.0%
metadata-eval59.0%
Simplified59.0%
Taylor expanded in H around 0 88.9%
Final simplification92.9%
(FPCore (v H)
:precision binary64
(if (<= v -7.6e-125)
(atan (+ -1.0 (* -9.8 (/ H (* v v)))))
(if (<= v 1.32e-96)
(atan (* -0.10204081632653061 (/ v (/ H v))))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -7.6e-125) {
tmp = atan((-1.0 + (-9.8 * (H / (v * v)))));
} else if (v <= 1.32e-96) {
tmp = atan((-0.10204081632653061 * (v / (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 <= (-7.6d-125)) then
tmp = atan(((-1.0d0) + ((-9.8d0) * (h / (v * v)))))
else if (v <= 1.32d-96) then
tmp = atan(((-0.10204081632653061d0) * (v / (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 <= -7.6e-125) {
tmp = Math.atan((-1.0 + (-9.8 * (H / (v * v)))));
} else if (v <= 1.32e-96) {
tmp = Math.atan((-0.10204081632653061 * (v / (H / v))));
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -7.6e-125: tmp = math.atan((-1.0 + (-9.8 * (H / (v * v))))) elif v <= 1.32e-96: tmp = math.atan((-0.10204081632653061 * (v / (H / v)))) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -7.6e-125) tmp = atan(Float64(-1.0 + Float64(-9.8 * Float64(H / Float64(v * v))))); elseif (v <= 1.32e-96) tmp = atan(Float64(-0.10204081632653061 * Float64(v / Float64(H / v)))); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -7.6e-125) tmp = atan((-1.0 + (-9.8 * (H / (v * v))))); elseif (v <= 1.32e-96) tmp = atan((-0.10204081632653061 * (v / (H / v)))); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -7.6e-125], N[ArcTan[N[(-1.0 + N[(-9.8 * N[(H / N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 1.32e-96], N[ArcTan[N[(-0.10204081632653061 * N[(v / N[(H / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -7.6 \cdot 10^{-125}:\\
\;\;\;\;\tan^{-1} \left(-1 + -9.8 \cdot \frac{H}{v \cdot v}\right)\\
\mathbf{elif}\;v \leq 1.32 \cdot 10^{-96}:\\
\;\;\;\;\tan^{-1} \left(-0.10204081632653061 \cdot \frac{v}{\frac{H}{v}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -7.6000000000000002e-125Initial program 61.4%
metadata-eval61.4%
Simplified61.4%
Taylor expanded in v around -inf 89.0%
pow261.4%
Applied egg-rr89.0%
if -7.6000000000000002e-125 < v < 1.32e-96Initial program 99.4%
sqr-neg99.4%
sqr-neg99.4%
fma-neg99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in H around 0 29.9%
Taylor expanded in v around 0 29.9%
*-un-lft-identity29.9%
times-frac29.9%
metadata-eval29.9%
Applied egg-rr29.9%
if 1.32e-96 < v Initial program 59.0%
metadata-eval59.0%
Simplified59.0%
Taylor expanded in v around inf 88.4%
Final simplification75.4%
(FPCore (v H)
:precision binary64
(if (<= v -6.8e-175)
(atan -1.0)
(if (<= v 1.32e-96)
(atan (* -0.10204081632653061 (/ v (/ H v))))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -6.8e-175) {
tmp = atan(-1.0);
} else if (v <= 1.32e-96) {
tmp = atan((-0.10204081632653061 * (v / (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 <= (-6.8d-175)) then
tmp = atan((-1.0d0))
else if (v <= 1.32d-96) then
tmp = atan(((-0.10204081632653061d0) * (v / (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 <= -6.8e-175) {
tmp = Math.atan(-1.0);
} else if (v <= 1.32e-96) {
tmp = Math.atan((-0.10204081632653061 * (v / (H / v))));
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -6.8e-175: tmp = math.atan(-1.0) elif v <= 1.32e-96: tmp = math.atan((-0.10204081632653061 * (v / (H / v)))) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -6.8e-175) tmp = atan(-1.0); elseif (v <= 1.32e-96) tmp = atan(Float64(-0.10204081632653061 * Float64(v / Float64(H / v)))); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -6.8e-175) tmp = atan(-1.0); elseif (v <= 1.32e-96) tmp = atan((-0.10204081632653061 * (v / (H / v)))); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -6.8e-175], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 1.32e-96], N[ArcTan[N[(-0.10204081632653061 * N[(v / N[(H / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -6.8 \cdot 10^{-175}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 1.32 \cdot 10^{-96}:\\
\;\;\;\;\tan^{-1} \left(-0.10204081632653061 \cdot \frac{v}{\frac{H}{v}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -6.8e-175Initial program 63.0%
metadata-eval63.0%
Simplified63.0%
Taylor expanded in v around -inf 84.8%
if -6.8e-175 < v < 1.32e-96Initial program 99.4%
sqr-neg99.4%
sqr-neg99.4%
fma-neg99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in H around 0 32.4%
Taylor expanded in v around 0 32.4%
*-un-lft-identity32.4%
times-frac32.4%
metadata-eval32.4%
Applied egg-rr32.4%
if 1.32e-96 < v Initial program 59.0%
metadata-eval59.0%
Simplified59.0%
Taylor expanded in v around inf 88.4%
(FPCore (v H) :precision binary64 (if (<= v -7.2e-125) (atan (+ -1.0 (* -9.8 (/ H (* v v))))) (atan (/ v (+ v (* -9.8 (/ H v)))))))
double code(double v, double H) {
double tmp;
if (v <= -7.2e-125) {
tmp = atan((-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 <= (-7.2d-125)) then
tmp = atan(((-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 <= -7.2e-125) {
tmp = Math.atan((-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 <= -7.2e-125: tmp = math.atan((-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 <= -7.2e-125) tmp = atan(Float64(-1.0 + Float64(-9.8 * Float64(H / Float64(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 <= -7.2e-125) tmp = atan((-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, -7.2e-125], N[ArcTan[N[(-1.0 + N[(-9.8 * N[(H / N[(v * v), $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 -7.2 \cdot 10^{-125}:\\
\;\;\;\;\tan^{-1} \left(-1 + -9.8 \cdot \frac{H}{v \cdot v}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + -9.8 \cdot \frac{H}{v}}\right)\\
\end{array}
\end{array}
if v < -7.2000000000000004e-125Initial program 61.4%
metadata-eval61.4%
Simplified61.4%
Taylor expanded in v around -inf 89.0%
pow261.4%
Applied egg-rr89.0%
if -7.2000000000000004e-125 < v Initial program 74.8%
sqr-neg74.8%
sqr-neg74.8%
fma-neg74.8%
*-commutative74.8%
distribute-rgt-neg-in74.8%
metadata-eval74.8%
metadata-eval74.8%
Simplified74.8%
Taylor expanded in H around 0 65.8%
Final simplification75.6%
(FPCore (v H) :precision binary64 (if (<= v 3.4e-302) (atan -1.0) (atan 1.0)))
double code(double v, double H) {
double tmp;
if (v <= 3.4e-302) {
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 <= 3.4d-302) 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 <= 3.4e-302) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= 3.4e-302: tmp = math.atan(-1.0) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= 3.4e-302) tmp = atan(-1.0); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= 3.4e-302) tmp = atan(-1.0); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, 3.4e-302], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 3.4 \cdot 10^{-302}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < 3.4e-302Initial program 68.5%
metadata-eval68.5%
Simplified68.5%
Taylor expanded in v around -inf 72.6%
if 3.4e-302 < v Initial program 69.8%
metadata-eval69.8%
Simplified69.8%
Taylor expanded in v around inf 65.9%
(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 69.2%
metadata-eval69.2%
Simplified69.2%
Taylor expanded in v around -inf 38.6%
herbie shell --seed 2024132
(FPCore (v H)
:name "Optimal throwing angle"
:precision binary64
(atan (/ v (sqrt (- (* v v) (* (* 2.0 9.8) H))))))