
(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 -5e+154)
(atan -1.0)
(if (<= v 5e+127)
(atan (* v (pow (fma v v (* H -19.6)) -0.5)))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -5e+154) {
tmp = atan(-1.0);
} else if (v <= 5e+127) {
tmp = atan((v * pow(fma(v, v, (H * -19.6)), -0.5)));
} else {
tmp = atan(1.0);
}
return tmp;
}
function code(v, H) tmp = 0.0 if (v <= -5e+154) tmp = atan(-1.0); elseif (v <= 5e+127) tmp = atan(Float64(v * (fma(v, v, Float64(H * -19.6)) ^ -0.5))); else tmp = atan(1.0); end return tmp end
code[v_, H_] := If[LessEqual[v, -5e+154], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 5e+127], N[ArcTan[N[(v * N[Power[N[(v * v + N[(H * -19.6), $MachinePrecision]), $MachinePrecision], -0.5], $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 \cdot 10^{+127}:\\
\;\;\;\;\tan^{-1} \left(v \cdot {\left(\mathsf{fma}\left(v, v, H \cdot -19.6\right)\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -5.00000000000000004e154Initial program 3.1%
metadata-eval3.1%
Simplified3.1%
Taylor expanded in v around -inf 100.0%
if -5.00000000000000004e154 < v < 5.0000000000000004e127Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
add-cbrt-cube63.5%
pow1/345.9%
pow345.9%
*-commutative45.9%
unpow-prod-down46.1%
metadata-eval46.1%
Applied egg-rr46.1%
unpow1/363.2%
Simplified63.2%
div-inv63.2%
metadata-eval63.2%
pow263.2%
*-commutative63.2%
metadata-eval63.2%
unpow-prod-down63.5%
pow363.5%
add-cbrt-cube99.7%
/-rgt-identity99.7%
sqrt-div99.7%
clear-num99.7%
*-commutative99.7%
Applied egg-rr99.8%
if 5.0000000000000004e127 < v Initial program 15.2%
metadata-eval15.2%
Simplified15.2%
Taylor expanded in v around inf 100.0%
Final simplification99.9%
(FPCore (v H)
:precision binary64
(if (<= v -5e+154)
(atan -1.0)
(if (<= v 1.8e+85)
(atan (/ v (sqrt (fma v v (* H -19.6)))))
(atan (/ v (* v (+ 1.0 (* (/ H (pow v 2.0)) -9.8))))))))
double code(double v, double H) {
double tmp;
if (v <= -5e+154) {
tmp = atan(-1.0);
} else if (v <= 1.8e+85) {
tmp = atan((v / sqrt(fma(v, v, (H * -19.6)))));
} else {
tmp = atan((v / (v * (1.0 + ((H / pow(v, 2.0)) * -9.8)))));
}
return tmp;
}
function code(v, H) tmp = 0.0 if (v <= -5e+154) tmp = atan(-1.0); elseif (v <= 1.8e+85) tmp = atan(Float64(v / sqrt(fma(v, v, Float64(H * -19.6))))); else tmp = atan(Float64(v / Float64(v * Float64(1.0 + Float64(Float64(H / (v ^ 2.0)) * -9.8))))); end return tmp end
code[v_, H_] := If[LessEqual[v, -5e+154], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 1.8e+85], N[ArcTan[N[(v / N[Sqrt[N[(v * v + N[(H * -19.6), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(v * N[(1.0 + N[(N[(H / N[Power[v, 2.0], $MachinePrecision]), $MachinePrecision] * -9.8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -5 \cdot 10^{+154}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 1.8 \cdot 10^{+85}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\sqrt{\mathsf{fma}\left(v, v, H \cdot -19.6\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v \cdot \left(1 + \frac{H}{{v}^{2}} \cdot -9.8\right)}\right)\\
\end{array}
\end{array}
if v < -5.00000000000000004e154Initial program 3.1%
metadata-eval3.1%
Simplified3.1%
Taylor expanded in v around -inf 100.0%
if -5.00000000000000004e154 < v < 1.7999999999999999e85Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
fma-neg99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
if 1.7999999999999999e85 < v Initial program 32.2%
sqr-neg32.2%
sqr-neg32.2%
fma-neg32.2%
*-commutative32.2%
distribute-rgt-neg-in32.2%
metadata-eval32.2%
metadata-eval32.2%
Simplified32.2%
Taylor expanded in v around inf 100.0%
*-commutative100.0%
Simplified100.0%
(FPCore (v H)
:precision binary64
(if (<= v -5e+154)
(atan -1.0)
(if (<= v 1.8e+85)
(atan (/ v (sqrt (- (* v v) (* H 19.6)))))
(atan (/ v (* v (+ 1.0 (* (/ H (pow v 2.0)) -9.8))))))))
double code(double v, double H) {
double tmp;
if (v <= -5e+154) {
tmp = atan(-1.0);
} else if (v <= 1.8e+85) {
tmp = atan((v / sqrt(((v * v) - (H * 19.6)))));
} else {
tmp = atan((v / (v * (1.0 + ((H / pow(v, 2.0)) * -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 <= (-5d+154)) then
tmp = atan((-1.0d0))
else if (v <= 1.8d+85) then
tmp = atan((v / sqrt(((v * v) - (h * 19.6d0)))))
else
tmp = atan((v / (v * (1.0d0 + ((h / (v ** 2.0d0)) * (-9.8d0))))))
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 <= 1.8e+85) {
tmp = Math.atan((v / Math.sqrt(((v * v) - (H * 19.6)))));
} else {
tmp = Math.atan((v / (v * (1.0 + ((H / Math.pow(v, 2.0)) * -9.8)))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -5e+154: tmp = math.atan(-1.0) elif v <= 1.8e+85: tmp = math.atan((v / math.sqrt(((v * v) - (H * 19.6))))) else: tmp = math.atan((v / (v * (1.0 + ((H / math.pow(v, 2.0)) * -9.8))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -5e+154) tmp = atan(-1.0); elseif (v <= 1.8e+85) tmp = atan(Float64(v / sqrt(Float64(Float64(v * v) - Float64(H * 19.6))))); else tmp = atan(Float64(v / Float64(v * Float64(1.0 + Float64(Float64(H / (v ^ 2.0)) * -9.8))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -5e+154) tmp = atan(-1.0); elseif (v <= 1.8e+85) tmp = atan((v / sqrt(((v * v) - (H * 19.6))))); else tmp = atan((v / (v * (1.0 + ((H / (v ^ 2.0)) * -9.8))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -5e+154], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 1.8e+85], N[ArcTan[N[(v / N[Sqrt[N[(N[(v * v), $MachinePrecision] - N[(H * 19.6), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(v * N[(1.0 + N[(N[(H / N[Power[v, 2.0], $MachinePrecision]), $MachinePrecision] * -9.8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -5 \cdot 10^{+154}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 1.8 \cdot 10^{+85}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - H \cdot 19.6}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v \cdot \left(1 + \frac{H}{{v}^{2}} \cdot -9.8\right)}\right)\\
\end{array}
\end{array}
if v < -5.00000000000000004e154Initial program 3.1%
metadata-eval3.1%
Simplified3.1%
Taylor expanded in v around -inf 100.0%
if -5.00000000000000004e154 < v < 1.7999999999999999e85Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
if 1.7999999999999999e85 < v Initial program 32.2%
sqr-neg32.2%
sqr-neg32.2%
fma-neg32.2%
*-commutative32.2%
distribute-rgt-neg-in32.2%
metadata-eval32.2%
metadata-eval32.2%
Simplified32.2%
Taylor expanded in v around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification99.8%
(FPCore (v H) :precision binary64 (if (<= v -5e+154) (atan -1.0) (if (<= v 5e+129) (atan (/ v (sqrt (- (* v v) (* H 19.6))))) (atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -5e+154) {
tmp = atan(-1.0);
} else if (v <= 5e+129) {
tmp = atan((v / sqrt(((v * v) - (H * 19.6)))));
} 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 <= 5d+129) then
tmp = atan((v / sqrt(((v * v) - (h * 19.6d0)))))
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 <= 5e+129) {
tmp = Math.atan((v / Math.sqrt(((v * v) - (H * 19.6)))));
} 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 <= 5e+129: tmp = math.atan((v / math.sqrt(((v * v) - (H * 19.6))))) 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 <= 5e+129) tmp = atan(Float64(v / sqrt(Float64(Float64(v * v) - Float64(H * 19.6))))); 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 <= 5e+129) tmp = atan((v / sqrt(((v * v) - (H * 19.6))))); 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, 5e+129], N[ArcTan[N[(v / N[Sqrt[N[(N[(v * v), $MachinePrecision] - N[(H * 19.6), $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 \cdot 10^{+129}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - H \cdot 19.6}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -5.00000000000000004e154Initial program 3.1%
metadata-eval3.1%
Simplified3.1%
Taylor expanded in v around -inf 100.0%
if -5.00000000000000004e154 < v < 5.0000000000000003e129Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
if 5.0000000000000003e129 < v Initial program 15.2%
metadata-eval15.2%
Simplified15.2%
Taylor expanded in v around inf 100.0%
Final simplification99.8%
(FPCore (v H)
:precision binary64
(if (<= v -5.1e-52)
(atan -1.0)
(if (<= v 7.2e-37)
(atan (* v (sqrt (/ -0.05102040816326531 H))))
(atan (/ v (+ v (* -9.8 (/ H v))))))))
double code(double v, double H) {
double tmp;
if (v <= -5.1e-52) {
tmp = atan(-1.0);
} else if (v <= 7.2e-37) {
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.1d-52)) then
tmp = atan((-1.0d0))
else if (v <= 7.2d-37) 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.1e-52) {
tmp = Math.atan(-1.0);
} else if (v <= 7.2e-37) {
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.1e-52: tmp = math.atan(-1.0) elif v <= 7.2e-37: 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.1e-52) tmp = atan(-1.0); elseif (v <= 7.2e-37) 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.1e-52) tmp = atan(-1.0); elseif (v <= 7.2e-37) 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.1e-52], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 7.2e-37], 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.1 \cdot 10^{-52}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 7.2 \cdot 10^{-37}:\\
\;\;\;\;\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.09999999999999989e-52Initial program 54.5%
metadata-eval54.5%
Simplified54.5%
Taylor expanded in v around -inf 91.8%
if -5.09999999999999989e-52 < v < 7.20000000000000014e-37Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in v around 0 99.6%
Taylor expanded in v around 0 83.9%
if 7.20000000000000014e-37 < v Initial program 53.7%
sqr-neg53.7%
sqr-neg53.7%
fma-neg53.7%
*-commutative53.7%
distribute-rgt-neg-in53.7%
metadata-eval53.7%
metadata-eval53.7%
Simplified53.7%
Taylor expanded in H around 0 92.3%
(FPCore (v H)
:precision binary64
(if (<= v -3.5e-102)
(atan -1.0)
(if (<= v 1.02e-135)
(atan (* -0.10204081632653061 (/ v (/ H v))))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -3.5e-102) {
tmp = atan(-1.0);
} else if (v <= 1.02e-135) {
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 <= (-3.5d-102)) then
tmp = atan((-1.0d0))
else if (v <= 1.02d-135) 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 <= -3.5e-102) {
tmp = Math.atan(-1.0);
} else if (v <= 1.02e-135) {
tmp = Math.atan((-0.10204081632653061 * (v / (H / v))));
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -3.5e-102: tmp = math.atan(-1.0) elif v <= 1.02e-135: 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 <= -3.5e-102) tmp = atan(-1.0); elseif (v <= 1.02e-135) 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 <= -3.5e-102) tmp = atan(-1.0); elseif (v <= 1.02e-135) tmp = atan((-0.10204081632653061 * (v / (H / v)))); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -3.5e-102], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 1.02e-135], 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 -3.5 \cdot 10^{-102}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 1.02 \cdot 10^{-135}:\\
\;\;\;\;\tan^{-1} \left(-0.10204081632653061 \cdot \frac{v}{\frac{H}{v}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -3.49999999999999986e-102Initial program 58.7%
metadata-eval58.7%
Simplified58.7%
Taylor expanded in v around -inf 84.6%
if -3.49999999999999986e-102 < v < 1.01999999999999994e-135Initial 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 22.8%
Taylor expanded in v around 0 23.3%
*-un-lft-identity23.3%
times-frac23.3%
metadata-eval23.3%
Applied egg-rr23.3%
if 1.01999999999999994e-135 < v Initial program 62.9%
metadata-eval62.9%
Simplified62.9%
Taylor expanded in v around inf 82.1%
(FPCore (v H) :precision binary64 (if (<= v -1.9e-161) (atan -1.0) (atan (/ v (+ v (* -9.8 (/ H v)))))))
double code(double v, double H) {
double tmp;
if (v <= -1.9e-161) {
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 <= (-1.9d-161)) 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 <= -1.9e-161) {
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 <= -1.9e-161: 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 <= -1.9e-161) 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 <= -1.9e-161) tmp = atan(-1.0); else tmp = atan((v / (v + (-9.8 * (H / v))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -1.9e-161], 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 -1.9 \cdot 10^{-161}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + -9.8 \cdot \frac{H}{v}}\right)\\
\end{array}
\end{array}
if v < -1.9000000000000001e-161Initial program 61.5%
metadata-eval61.5%
Simplified61.5%
Taylor expanded in v around -inf 79.2%
if -1.9000000000000001e-161 < v Initial program 70.7%
sqr-neg70.7%
sqr-neg70.7%
fma-neg70.7%
*-commutative70.7%
distribute-rgt-neg-in70.7%
metadata-eval70.7%
metadata-eval70.7%
Simplified70.7%
Taylor expanded in H around 0 71.0%
(FPCore (v H) :precision binary64 (if (<= v -5e-310) (atan -1.0) (atan 1.0)))
double code(double v, double H) {
double tmp;
if (v <= -5e-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 <= (-5d-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 <= -5e-310) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -5e-310: tmp = math.atan(-1.0) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -5e-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 <= -5e-310) tmp = atan(-1.0); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -5e-310], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -4.999999999999985e-310Initial program 64.5%
metadata-eval64.5%
Simplified64.5%
Taylor expanded in v around -inf 73.3%
if -4.999999999999985e-310 < v Initial program 68.5%
metadata-eval68.5%
Simplified68.5%
Taylor expanded in v around inf 70.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 66.5%
metadata-eval66.5%
Simplified66.5%
Taylor expanded in v around -inf 37.0%
herbie shell --seed 2024139
(FPCore (v H)
:name "Optimal throwing angle"
:precision binary64
(atan (/ v (sqrt (- (* v v) (* (* 2.0 9.8) H))))))