
(FPCore (v H) :precision binary64 (atan (/ v (sqrt (- (* v v) (* (* 2.0 9.8) H))))))
double code(double v, double H) {
return atan((v / sqrt(((v * v) - ((2.0 * 9.8) * H)))));
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
code = atan((v / sqrt(((v * v) - ((2.0d0 * 9.8d0) * h)))))
end function
public static double code(double v, double H) {
return Math.atan((v / Math.sqrt(((v * v) - ((2.0 * 9.8) * H)))));
}
def code(v, H): return math.atan((v / math.sqrt(((v * v) - ((2.0 * 9.8) * H)))))
function code(v, H) return atan(Float64(v / sqrt(Float64(Float64(v * v) - Float64(Float64(2.0 * 9.8) * H))))) end
function tmp = code(v, H) tmp = atan((v / sqrt(((v * v) - ((2.0 * 9.8) * H))))); end
code[v_, H_] := N[ArcTan[N[(v / N[Sqrt[N[(N[(v * v), $MachinePrecision] - N[(N[(2.0 * 9.8), $MachinePrecision] * H), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (v H) :precision binary64 (atan (/ v (sqrt (- (* v v) (* (* 2.0 9.8) H))))))
double code(double v, double H) {
return atan((v / sqrt(((v * v) - ((2.0 * 9.8) * H)))));
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
code = atan((v / sqrt(((v * v) - ((2.0d0 * 9.8d0) * h)))))
end function
public static double code(double v, double H) {
return Math.atan((v / Math.sqrt(((v * v) - ((2.0 * 9.8) * H)))));
}
def code(v, H): return math.atan((v / math.sqrt(((v * v) - ((2.0 * 9.8) * H)))))
function code(v, H) return atan(Float64(v / sqrt(Float64(Float64(v * v) - Float64(Float64(2.0 * 9.8) * H))))) end
function tmp = code(v, H) tmp = atan((v / sqrt(((v * v) - ((2.0 * 9.8) * H))))); end
code[v_, H_] := N[ArcTan[N[(v / N[Sqrt[N[(N[(v * v), $MachinePrecision] - N[(N[(2.0 * 9.8), $MachinePrecision] * H), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right)
\end{array}
(FPCore (v H)
:precision binary64
(if (<= v -2e+157)
(atan -1.0)
(if (<= v 1.22e+57)
(atan (/ v (sqrt (- (* v v) (* 19.6 H)))))
(atan (/ v (+ v (* -9.8 (/ H v))))))))
double code(double v, double H) {
double tmp;
if (v <= -2e+157) {
tmp = atan(-1.0);
} else if (v <= 1.22e+57) {
tmp = atan((v / sqrt(((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 <= (-2d+157)) then
tmp = atan((-1.0d0))
else if (v <= 1.22d+57) then
tmp = atan((v / sqrt(((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 <= -2e+157) {
tmp = Math.atan(-1.0);
} else if (v <= 1.22e+57) {
tmp = Math.atan((v / Math.sqrt(((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 <= -2e+157: tmp = math.atan(-1.0) elif v <= 1.22e+57: tmp = math.atan((v / math.sqrt(((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 <= -2e+157) tmp = atan(-1.0); elseif (v <= 1.22e+57) tmp = atan(Float64(v / sqrt(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 <= -2e+157) tmp = atan(-1.0); elseif (v <= 1.22e+57) tmp = atan((v / sqrt(((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, -2e+157], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 1.22e+57], 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[(-9.8 * N[(H / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -2 \cdot 10^{+157}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 1.22 \cdot 10^{+57}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\sqrt{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.99999999999999997e157Initial program 3.1%
sqr-neg3.1%
sqr-neg3.1%
metadata-eval3.1%
Simplified3.1%
Taylor expanded in v around -inf 100.0%
if -1.99999999999999997e157 < v < 1.22e57Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
metadata-eval99.7%
Simplified99.7%
if 1.22e57 < v Initial program 31.8%
sqr-neg31.8%
sqr-neg31.8%
metadata-eval31.8%
Simplified31.8%
Taylor expanded in H around 0 98.6%
(FPCore (v H)
:precision binary64
(if (<= v -1.7e-19)
(atan -1.0)
(if (<= v 2.3e-79)
(atan (* v (sqrt (/ -0.05102040816326531 H))))
(if (<= v 8.5e+29)
(atan (/ v (* v (+ 1.0 (* (/ H v) (/ -9.8 v))))))
(if (<= v 6.8e+31)
(atan (* v (/ 1.0 (sqrt (* H -19.6)))))
(atan (/ v (+ v (* -9.8 (/ H v))))))))))
double code(double v, double H) {
double tmp;
if (v <= -1.7e-19) {
tmp = atan(-1.0);
} else if (v <= 2.3e-79) {
tmp = atan((v * sqrt((-0.05102040816326531 / H))));
} else if (v <= 8.5e+29) {
tmp = atan((v / (v * (1.0 + ((H / v) * (-9.8 / v))))));
} else if (v <= 6.8e+31) {
tmp = atan((v * (1.0 / sqrt((H * -19.6)))));
} else {
tmp = atan((v / (v + (-9.8 * (H / v)))));
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-1.7d-19)) then
tmp = atan((-1.0d0))
else if (v <= 2.3d-79) then
tmp = atan((v * sqrt(((-0.05102040816326531d0) / h))))
else if (v <= 8.5d+29) then
tmp = atan((v / (v * (1.0d0 + ((h / v) * ((-9.8d0) / v))))))
else if (v <= 6.8d+31) then
tmp = atan((v * (1.0d0 / sqrt((h * (-19.6d0))))))
else
tmp = atan((v / (v + ((-9.8d0) * (h / v)))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -1.7e-19) {
tmp = Math.atan(-1.0);
} else if (v <= 2.3e-79) {
tmp = Math.atan((v * Math.sqrt((-0.05102040816326531 / H))));
} else if (v <= 8.5e+29) {
tmp = Math.atan((v / (v * (1.0 + ((H / v) * (-9.8 / v))))));
} else if (v <= 6.8e+31) {
tmp = Math.atan((v * (1.0 / Math.sqrt((H * -19.6)))));
} else {
tmp = Math.atan((v / (v + (-9.8 * (H / v)))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -1.7e-19: tmp = math.atan(-1.0) elif v <= 2.3e-79: tmp = math.atan((v * math.sqrt((-0.05102040816326531 / H)))) elif v <= 8.5e+29: tmp = math.atan((v / (v * (1.0 + ((H / v) * (-9.8 / v)))))) elif v <= 6.8e+31: tmp = math.atan((v * (1.0 / math.sqrt((H * -19.6))))) else: tmp = math.atan((v / (v + (-9.8 * (H / v))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -1.7e-19) tmp = atan(-1.0); elseif (v <= 2.3e-79) tmp = atan(Float64(v * sqrt(Float64(-0.05102040816326531 / H)))); elseif (v <= 8.5e+29) tmp = atan(Float64(v / Float64(v * Float64(1.0 + Float64(Float64(H / v) * Float64(-9.8 / v)))))); elseif (v <= 6.8e+31) tmp = atan(Float64(v * Float64(1.0 / sqrt(Float64(H * -19.6))))); else tmp = atan(Float64(v / Float64(v + Float64(-9.8 * Float64(H / v))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -1.7e-19) tmp = atan(-1.0); elseif (v <= 2.3e-79) tmp = atan((v * sqrt((-0.05102040816326531 / H)))); elseif (v <= 8.5e+29) tmp = atan((v / (v * (1.0 + ((H / v) * (-9.8 / v)))))); elseif (v <= 6.8e+31) tmp = atan((v * (1.0 / sqrt((H * -19.6))))); else tmp = atan((v / (v + (-9.8 * (H / v))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -1.7e-19], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 2.3e-79], N[ArcTan[N[(v * N[Sqrt[N[(-0.05102040816326531 / H), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 8.5e+29], N[ArcTan[N[(v / N[(v * N[(1.0 + N[(N[(H / v), $MachinePrecision] * N[(-9.8 / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 6.8e+31], N[ArcTan[N[(v * N[(1.0 / N[Sqrt[N[(H * -19.6), $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.7 \cdot 10^{-19}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 2.3 \cdot 10^{-79}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \sqrt{\frac{-0.05102040816326531}{H}}\right)\\
\mathbf{elif}\;v \leq 8.5 \cdot 10^{+29}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v \cdot \left(1 + \frac{H}{v} \cdot \frac{-9.8}{v}\right)}\right)\\
\mathbf{elif}\;v \leq 6.8 \cdot 10^{+31}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \frac{1}{\sqrt{H \cdot -19.6}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + -9.8 \cdot \frac{H}{v}}\right)\\
\end{array}
\end{array}
if v < -1.7000000000000001e-19Initial program 53.5%
sqr-neg53.5%
sqr-neg53.5%
metadata-eval53.5%
Simplified53.5%
Taylor expanded in v around -inf 91.4%
if -1.7000000000000001e-19 < v < 2.30000000000000012e-79Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in v around 0 99.6%
Taylor expanded in v around 0 89.0%
if 2.30000000000000012e-79 < v < 8.5000000000000006e29Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in v around inf 71.4%
associate-*r/71.4%
Simplified71.4%
*-commutative71.4%
unpow271.4%
times-frac71.4%
Applied egg-rr71.4%
if 8.5000000000000006e29 < v < 6.7999999999999996e31Initial program 99.2%
sqr-neg99.2%
sqr-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in v around 0 99.2%
Taylor expanded in v around 0 99.2%
clear-num99.2%
sqrt-div99.2%
metadata-eval99.2%
div-inv99.2%
metadata-eval100.0%
Applied egg-rr100.0%
if 6.7999999999999996e31 < v Initial program 37.9%
sqr-neg37.9%
sqr-neg37.9%
metadata-eval37.9%
Simplified37.9%
Taylor expanded in H around 0 96.3%
(FPCore (v H)
:precision binary64
(let* ((t_0 (atan (* v (sqrt (/ -0.05102040816326531 H))))))
(if (<= v -4.5e-19)
(atan -1.0)
(if (<= v 2.2e-79)
t_0
(if (<= v 8.6e+29)
(atan (/ v (* v (+ 1.0 (* (/ H v) (/ -9.8 v))))))
(if (<= v 2.1e+31) t_0 (atan (/ v (+ v (* -9.8 (/ H v)))))))))))
double code(double v, double H) {
double t_0 = atan((v * sqrt((-0.05102040816326531 / H))));
double tmp;
if (v <= -4.5e-19) {
tmp = atan(-1.0);
} else if (v <= 2.2e-79) {
tmp = t_0;
} else if (v <= 8.6e+29) {
tmp = atan((v / (v * (1.0 + ((H / v) * (-9.8 / v))))));
} else if (v <= 2.1e+31) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = atan((v * sqrt(((-0.05102040816326531d0) / h))))
if (v <= (-4.5d-19)) then
tmp = atan((-1.0d0))
else if (v <= 2.2d-79) then
tmp = t_0
else if (v <= 8.6d+29) then
tmp = atan((v / (v * (1.0d0 + ((h / v) * ((-9.8d0) / v))))))
else if (v <= 2.1d+31) then
tmp = t_0
else
tmp = atan((v / (v + ((-9.8d0) * (h / v)))))
end if
code = tmp
end function
public static double code(double v, double H) {
double t_0 = Math.atan((v * Math.sqrt((-0.05102040816326531 / H))));
double tmp;
if (v <= -4.5e-19) {
tmp = Math.atan(-1.0);
} else if (v <= 2.2e-79) {
tmp = t_0;
} else if (v <= 8.6e+29) {
tmp = Math.atan((v / (v * (1.0 + ((H / v) * (-9.8 / v))))));
} else if (v <= 2.1e+31) {
tmp = t_0;
} else {
tmp = Math.atan((v / (v + (-9.8 * (H / v)))));
}
return tmp;
}
def code(v, H): t_0 = math.atan((v * math.sqrt((-0.05102040816326531 / H)))) tmp = 0 if v <= -4.5e-19: tmp = math.atan(-1.0) elif v <= 2.2e-79: tmp = t_0 elif v <= 8.6e+29: tmp = math.atan((v / (v * (1.0 + ((H / v) * (-9.8 / v)))))) elif v <= 2.1e+31: tmp = t_0 else: tmp = math.atan((v / (v + (-9.8 * (H / v))))) return tmp
function code(v, H) t_0 = atan(Float64(v * sqrt(Float64(-0.05102040816326531 / H)))) tmp = 0.0 if (v <= -4.5e-19) tmp = atan(-1.0); elseif (v <= 2.2e-79) tmp = t_0; elseif (v <= 8.6e+29) tmp = atan(Float64(v / Float64(v * Float64(1.0 + Float64(Float64(H / v) * Float64(-9.8 / v)))))); elseif (v <= 2.1e+31) tmp = t_0; else tmp = atan(Float64(v / Float64(v + Float64(-9.8 * Float64(H / v))))); end return tmp end
function tmp_2 = code(v, H) t_0 = atan((v * sqrt((-0.05102040816326531 / H)))); tmp = 0.0; if (v <= -4.5e-19) tmp = atan(-1.0); elseif (v <= 2.2e-79) tmp = t_0; elseif (v <= 8.6e+29) tmp = atan((v / (v * (1.0 + ((H / v) * (-9.8 / v)))))); elseif (v <= 2.1e+31) tmp = t_0; else tmp = atan((v / (v + (-9.8 * (H / v))))); end tmp_2 = tmp; end
code[v_, H_] := Block[{t$95$0 = N[ArcTan[N[(v * N[Sqrt[N[(-0.05102040816326531 / H), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[v, -4.5e-19], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 2.2e-79], t$95$0, If[LessEqual[v, 8.6e+29], N[ArcTan[N[(v / N[(v * N[(1.0 + N[(N[(H / v), $MachinePrecision] * N[(-9.8 / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 2.1e+31], t$95$0, N[ArcTan[N[(v / N[(v + N[(-9.8 * N[(H / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1} \left(v \cdot \sqrt{\frac{-0.05102040816326531}{H}}\right)\\
\mathbf{if}\;v \leq -4.5 \cdot 10^{-19}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 2.2 \cdot 10^{-79}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;v \leq 8.6 \cdot 10^{+29}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v \cdot \left(1 + \frac{H}{v} \cdot \frac{-9.8}{v}\right)}\right)\\
\mathbf{elif}\;v \leq 2.1 \cdot 10^{+31}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + -9.8 \cdot \frac{H}{v}}\right)\\
\end{array}
\end{array}
if v < -4.50000000000000013e-19Initial program 53.5%
sqr-neg53.5%
sqr-neg53.5%
metadata-eval53.5%
Simplified53.5%
Taylor expanded in v around -inf 91.4%
if -4.50000000000000013e-19 < v < 2.1999999999999999e-79 or 8.6000000000000006e29 < v < 2.09999999999999979e31Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in v around 0 99.6%
Taylor expanded in v around 0 89.2%
if 2.1999999999999999e-79 < v < 8.6000000000000006e29Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in v around inf 71.4%
associate-*r/71.4%
Simplified71.4%
*-commutative71.4%
unpow271.4%
times-frac71.4%
Applied egg-rr71.4%
if 2.09999999999999979e31 < v Initial program 37.9%
sqr-neg37.9%
sqr-neg37.9%
metadata-eval37.9%
Simplified37.9%
Taylor expanded in H around 0 96.3%
(FPCore (v H) :precision binary64 (if (<= v -9.6e-95) (atan -1.0) (atan (/ v (* v (+ 1.0 (* (/ H v) (/ -9.8 v))))))))
double code(double v, double H) {
double tmp;
if (v <= -9.6e-95) {
tmp = atan(-1.0);
} else {
tmp = atan((v / (v * (1.0 + ((H / v) * (-9.8 / v))))));
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-9.6d-95)) then
tmp = atan((-1.0d0))
else
tmp = atan((v / (v * (1.0d0 + ((h / v) * ((-9.8d0) / v))))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -9.6e-95) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan((v / (v * (1.0 + ((H / v) * (-9.8 / v))))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -9.6e-95: tmp = math.atan(-1.0) else: tmp = math.atan((v / (v * (1.0 + ((H / v) * (-9.8 / v)))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -9.6e-95) tmp = atan(-1.0); else tmp = atan(Float64(v / Float64(v * Float64(1.0 + Float64(Float64(H / v) * Float64(-9.8 / v)))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -9.6e-95) tmp = atan(-1.0); else tmp = atan((v / (v * (1.0 + ((H / v) * (-9.8 / v)))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -9.6e-95], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[N[(v / N[(v * N[(1.0 + N[(N[(H / v), $MachinePrecision] * N[(-9.8 / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -9.6 \cdot 10^{-95}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v \cdot \left(1 + \frac{H}{v} \cdot \frac{-9.8}{v}\right)}\right)\\
\end{array}
\end{array}
if v < -9.6e-95Initial program 61.4%
sqr-neg61.4%
sqr-neg61.4%
metadata-eval61.4%
Simplified61.4%
Taylor expanded in v around -inf 84.3%
if -9.6e-95 < v Initial program 71.0%
sqr-neg71.0%
sqr-neg71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in v around inf 63.4%
associate-*r/63.4%
Simplified63.4%
*-commutative63.4%
unpow263.4%
times-frac63.4%
Applied egg-rr63.4%
(FPCore (v H)
:precision binary64
(if (<= v -1.08e-158)
(atan -1.0)
(if (<= v 2.05e-253)
(atan (/ (* v (* v -0.10204081632653061)) H))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -1.08e-158) {
tmp = atan(-1.0);
} else if (v <= 2.05e-253) {
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.08d-158)) then
tmp = atan((-1.0d0))
else if (v <= 2.05d-253) 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.08e-158) {
tmp = Math.atan(-1.0);
} else if (v <= 2.05e-253) {
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.08e-158: tmp = math.atan(-1.0) elif v <= 2.05e-253: 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.08e-158) tmp = atan(-1.0); elseif (v <= 2.05e-253) tmp = atan(Float64(Float64(v * Float64(v * -0.10204081632653061)) / H)); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -1.08e-158) tmp = atan(-1.0); elseif (v <= 2.05e-253) tmp = atan(((v * (v * -0.10204081632653061)) / H)); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -1.08e-158], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 2.05e-253], N[ArcTan[N[(N[(v * N[(v * -0.10204081632653061), $MachinePrecision]), $MachinePrecision] / H), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -1.08 \cdot 10^{-158}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 2.05 \cdot 10^{-253}:\\
\;\;\;\;\tan^{-1} \left(\frac{v \cdot \left(v \cdot -0.10204081632653061\right)}{H}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -1.08e-158Initial program 64.6%
sqr-neg64.6%
sqr-neg64.6%
metadata-eval64.6%
Simplified64.6%
Taylor expanded in v around -inf 78.9%
if -1.08e-158 < v < 2.05000000000000001e-253Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in H around 0 29.1%
associate-*r/29.1%
Simplified29.1%
clear-num29.1%
inv-pow29.1%
*-un-lft-identity29.1%
times-frac29.1%
metadata-eval29.1%
Applied egg-rr29.1%
unpow-129.1%
Simplified29.1%
clear-num29.1%
associate-/r/29.1%
associate-/r*29.1%
metadata-eval29.1%
Applied egg-rr29.1%
Taylor expanded in v around 0 29.1%
*-commutative29.1%
associate-*r/29.1%
*-commutative29.1%
associate-*r/29.2%
Applied egg-rr29.2%
if 2.05000000000000001e-253 < v Initial program 62.0%
sqr-neg62.0%
sqr-neg62.0%
metadata-eval62.0%
Simplified62.0%
Taylor expanded in v around inf 72.4%
(FPCore (v H)
:precision binary64
(if (<= v -6e-162)
(atan -1.0)
(if (<= v 2.05e-253)
(atan (* v (* -0.10204081632653061 (/ v H))))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -6e-162) {
tmp = atan(-1.0);
} else if (v <= 2.05e-253) {
tmp = atan((v * (-0.10204081632653061 * (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 <= (-6d-162)) then
tmp = atan((-1.0d0))
else if (v <= 2.05d-253) then
tmp = atan((v * ((-0.10204081632653061d0) * (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 <= -6e-162) {
tmp = Math.atan(-1.0);
} else if (v <= 2.05e-253) {
tmp = Math.atan((v * (-0.10204081632653061 * (v / H))));
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -6e-162: tmp = math.atan(-1.0) elif v <= 2.05e-253: tmp = math.atan((v * (-0.10204081632653061 * (v / H)))) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -6e-162) tmp = atan(-1.0); elseif (v <= 2.05e-253) tmp = atan(Float64(v * Float64(-0.10204081632653061 * Float64(v / H)))); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -6e-162) tmp = atan(-1.0); elseif (v <= 2.05e-253) tmp = atan((v * (-0.10204081632653061 * (v / H)))); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -6e-162], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 2.05e-253], N[ArcTan[N[(v * N[(-0.10204081632653061 * N[(v / H), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -6 \cdot 10^{-162}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 2.05 \cdot 10^{-253}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \left(-0.10204081632653061 \cdot \frac{v}{H}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -5.99999999999999997e-162Initial program 64.6%
sqr-neg64.6%
sqr-neg64.6%
metadata-eval64.6%
Simplified64.6%
Taylor expanded in v around -inf 78.9%
if -5.99999999999999997e-162 < v < 2.05000000000000001e-253Initial program 99.7%
sqr-neg99.7%
sqr-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in H around 0 29.1%
associate-*r/29.1%
Simplified29.1%
clear-num29.1%
inv-pow29.1%
*-un-lft-identity29.1%
times-frac29.1%
metadata-eval29.1%
Applied egg-rr29.1%
unpow-129.1%
Simplified29.1%
clear-num29.1%
associate-/r/29.1%
associate-/r*29.1%
metadata-eval29.1%
Applied egg-rr29.1%
Taylor expanded in v around 0 29.1%
if 2.05000000000000001e-253 < v Initial program 62.0%
sqr-neg62.0%
sqr-neg62.0%
metadata-eval62.0%
Simplified62.0%
Taylor expanded in v around inf 72.4%
Final simplification69.4%
(FPCore (v H) :precision binary64 (if (<= v -9.6e-95) (atan -1.0) (atan (/ 1.0 (/ (+ v (* H (/ -9.8 v))) v)))))
double code(double v, double H) {
double tmp;
if (v <= -9.6e-95) {
tmp = atan(-1.0);
} else {
tmp = atan((1.0 / ((v + (H * (-9.8 / v))) / v)));
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-9.6d-95)) then
tmp = atan((-1.0d0))
else
tmp = atan((1.0d0 / ((v + (h * ((-9.8d0) / v))) / v)))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -9.6e-95) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan((1.0 / ((v + (H * (-9.8 / v))) / v)));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -9.6e-95: tmp = math.atan(-1.0) else: tmp = math.atan((1.0 / ((v + (H * (-9.8 / v))) / v))) return tmp
function code(v, H) tmp = 0.0 if (v <= -9.6e-95) tmp = atan(-1.0); else tmp = atan(Float64(1.0 / Float64(Float64(v + Float64(H * Float64(-9.8 / v))) / v))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -9.6e-95) tmp = atan(-1.0); else tmp = atan((1.0 / ((v + (H * (-9.8 / v))) / v))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -9.6e-95], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[N[(1.0 / N[(N[(v + N[(H * N[(-9.8 / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -9.6 \cdot 10^{-95}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{1}{\frac{v + H \cdot \frac{-9.8}{v}}{v}}\right)\\
\end{array}
\end{array}
if v < -9.6e-95Initial program 61.4%
sqr-neg61.4%
sqr-neg61.4%
metadata-eval61.4%
Simplified61.4%
Taylor expanded in v around -inf 84.3%
if -9.6e-95 < v Initial program 71.0%
sqr-neg71.0%
sqr-neg71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in H around 0 63.4%
associate-*r/63.4%
Simplified63.4%
clear-num63.4%
inv-pow63.4%
*-un-lft-identity63.4%
times-frac63.4%
metadata-eval63.4%
Applied egg-rr63.4%
unpow-163.4%
Simplified63.4%
associate-*r/63.4%
associate-/r/63.4%
*-commutative63.4%
Applied egg-rr63.4%
clear-num63.4%
inv-pow63.4%
associate-*l/63.4%
*-commutative63.4%
times-frac63.4%
metadata-eval63.4%
Applied egg-rr63.4%
unpow-163.4%
associate-*r/63.4%
*-commutative63.4%
associate-/l*63.4%
Simplified63.4%
(FPCore (v H) :precision binary64 (if (<= v -9.6e-95) (atan -1.0) (atan (/ v (+ v (* -9.8 (/ H v)))))))
double code(double v, double H) {
double tmp;
if (v <= -9.6e-95) {
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 <= (-9.6d-95)) 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 <= -9.6e-95) {
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 <= -9.6e-95: 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 <= -9.6e-95) 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 <= -9.6e-95) tmp = atan(-1.0); else tmp = atan((v / (v + (-9.8 * (H / v))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -9.6e-95], 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 -9.6 \cdot 10^{-95}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + -9.8 \cdot \frac{H}{v}}\right)\\
\end{array}
\end{array}
if v < -9.6e-95Initial program 61.4%
sqr-neg61.4%
sqr-neg61.4%
metadata-eval61.4%
Simplified61.4%
Taylor expanded in v around -inf 84.3%
if -9.6e-95 < v Initial program 71.0%
sqr-neg71.0%
sqr-neg71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in H around 0 63.4%
(FPCore (v H) :precision binary64 (if (<= v -9.6e-60) (atan -1.0) (atan 1.0)))
double code(double v, double H) {
double tmp;
if (v <= -9.6e-60) {
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 <= (-9.6d-60)) 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 <= -9.6e-60) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -9.6e-60: tmp = math.atan(-1.0) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -9.6e-60) tmp = atan(-1.0); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -9.6e-60) tmp = atan(-1.0); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -9.6e-60], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -9.6 \cdot 10^{-60}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -9.60000000000000038e-60Initial program 58.1%
sqr-neg58.1%
sqr-neg58.1%
metadata-eval58.1%
Simplified58.1%
Taylor expanded in v around -inf 88.7%
if -9.60000000000000038e-60 < v Initial program 72.1%
sqr-neg72.1%
sqr-neg72.1%
metadata-eval72.1%
Simplified72.1%
Taylor expanded in v around inf 53.7%
(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 67.7%
sqr-neg67.7%
sqr-neg67.7%
metadata-eval67.7%
Simplified67.7%
Taylor expanded in v around -inf 30.9%
herbie shell --seed 2024107
(FPCore (v H)
:name "Optimal throwing angle"
:precision binary64
(atan (/ v (sqrt (- (* v v) (* (* 2.0 9.8) H))))))