
(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 1e+106) (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 <= 1e+106) {
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 <= 1d+106) 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 <= 1e+106) {
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 <= 1e+106: 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 <= 1e+106) 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 <= 1e+106) 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, 1e+106], 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 10^{+106}:\\
\;\;\;\;\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%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval3.1%
Simplified3.1%
Taylor expanded in v around -inf
Simplified100.0%
if -5.00000000000000004e154 < v < 1.00000000000000009e106Initial program 99.7%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval99.7%
Simplified99.7%
if 1.00000000000000009e106 < v Initial program 25.6%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval25.6%
Simplified25.6%
Taylor expanded in v around inf
Simplified100.0%
(FPCore (v H)
:precision binary64
(if (<= v -1.1e-19)
(atan (* v (/ 1.0 (- (* 9.8 (/ H v)) v))))
(if (<= v 2e-50)
(atan (/ v (sqrt (* H -19.6))))
(atan (/ v (* v (+ 1.0 (* (/ H (* v v)) -9.8))))))))
double code(double v, double H) {
double tmp;
if (v <= -1.1e-19) {
tmp = atan((v * (1.0 / ((9.8 * (H / v)) - v))));
} else if (v <= 2e-50) {
tmp = atan((v / sqrt((H * -19.6))));
} else {
tmp = atan((v / (v * (1.0 + ((H / (v * v)) * -9.8)))));
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-1.1d-19)) then
tmp = atan((v * (1.0d0 / ((9.8d0 * (h / v)) - v))))
else if (v <= 2d-50) then
tmp = atan((v / sqrt((h * (-19.6d0)))))
else
tmp = atan((v / (v * (1.0d0 + ((h / (v * v)) * (-9.8d0))))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -1.1e-19) {
tmp = Math.atan((v * (1.0 / ((9.8 * (H / v)) - v))));
} else if (v <= 2e-50) {
tmp = Math.atan((v / Math.sqrt((H * -19.6))));
} else {
tmp = Math.atan((v / (v * (1.0 + ((H / (v * v)) * -9.8)))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -1.1e-19: tmp = math.atan((v * (1.0 / ((9.8 * (H / v)) - v)))) elif v <= 2e-50: tmp = math.atan((v / math.sqrt((H * -19.6)))) else: tmp = math.atan((v / (v * (1.0 + ((H / (v * v)) * -9.8))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -1.1e-19) tmp = atan(Float64(v * Float64(1.0 / Float64(Float64(9.8 * Float64(H / v)) - v)))); elseif (v <= 2e-50) tmp = atan(Float64(v / sqrt(Float64(H * -19.6)))); else tmp = atan(Float64(v / Float64(v * Float64(1.0 + Float64(Float64(H / Float64(v * v)) * -9.8))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -1.1e-19) tmp = atan((v * (1.0 / ((9.8 * (H / v)) - v)))); elseif (v <= 2e-50) tmp = atan((v / sqrt((H * -19.6)))); else tmp = atan((v / (v * (1.0 + ((H / (v * v)) * -9.8))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -1.1e-19], N[ArcTan[N[(v * N[(1.0 / N[(N[(9.8 * N[(H / v), $MachinePrecision]), $MachinePrecision] - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 2e-50], N[ArcTan[N[(v / N[Sqrt[N[(H * -19.6), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(v * N[(1.0 + N[(N[(H / N[(v * v), $MachinePrecision]), $MachinePrecision] * -9.8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -1.1 \cdot 10^{-19}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \frac{1}{9.8 \cdot \frac{H}{v} - v}\right)\\
\mathbf{elif}\;v \leq 2 \cdot 10^{-50}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\sqrt{H \cdot -19.6}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v \cdot \left(1 + \frac{H}{v \cdot v} \cdot -9.8\right)}\right)\\
\end{array}
\end{array}
if v < -1.0999999999999999e-19Initial program 48.1%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval48.1%
Simplified48.1%
Taylor expanded in v around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6490.9%
Simplified90.9%
distribute-lft-inN/A
*-rgt-identityN/A
associate--r+N/A
neg-sub0N/A
--lowering--.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6490.9%
Applied egg-rr90.9%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
Applied egg-rr90.9%
if -1.0999999999999999e-19 < v < 2.00000000000000002e-50Initial program 99.7%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval99.7%
Simplified99.7%
Taylor expanded in v around 0
*-lowering-*.f6485.4%
Simplified85.4%
if 2.00000000000000002e-50 < v Initial program 48.6%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval48.6%
Simplified48.6%
Taylor expanded in v around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6493.5%
Simplified93.5%
Final simplification90.1%
(FPCore (v H)
:precision binary64
(if (<= v -2.35e+20)
(atan (* v (/ 1.0 (- (* 9.8 (/ H v)) v))))
(if (<= v 2.45e-49)
(atan (* v (sqrt (/ -0.05102040816326531 H))))
(atan (/ v (* v (+ 1.0 (* (/ H (* v v)) -9.8))))))))
double code(double v, double H) {
double tmp;
if (v <= -2.35e+20) {
tmp = atan((v * (1.0 / ((9.8 * (H / v)) - v))));
} else if (v <= 2.45e-49) {
tmp = atan((v * sqrt((-0.05102040816326531 / H))));
} else {
tmp = atan((v / (v * (1.0 + ((H / (v * v)) * -9.8)))));
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-2.35d+20)) then
tmp = atan((v * (1.0d0 / ((9.8d0 * (h / v)) - v))))
else if (v <= 2.45d-49) then
tmp = atan((v * sqrt(((-0.05102040816326531d0) / h))))
else
tmp = atan((v / (v * (1.0d0 + ((h / (v * v)) * (-9.8d0))))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -2.35e+20) {
tmp = Math.atan((v * (1.0 / ((9.8 * (H / v)) - v))));
} else if (v <= 2.45e-49) {
tmp = Math.atan((v * Math.sqrt((-0.05102040816326531 / H))));
} else {
tmp = Math.atan((v / (v * (1.0 + ((H / (v * v)) * -9.8)))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -2.35e+20: tmp = math.atan((v * (1.0 / ((9.8 * (H / v)) - v)))) elif v <= 2.45e-49: tmp = math.atan((v * math.sqrt((-0.05102040816326531 / H)))) else: tmp = math.atan((v / (v * (1.0 + ((H / (v * v)) * -9.8))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -2.35e+20) tmp = atan(Float64(v * Float64(1.0 / Float64(Float64(9.8 * Float64(H / v)) - v)))); elseif (v <= 2.45e-49) tmp = atan(Float64(v * sqrt(Float64(-0.05102040816326531 / H)))); else tmp = atan(Float64(v / Float64(v * Float64(1.0 + Float64(Float64(H / Float64(v * v)) * -9.8))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -2.35e+20) tmp = atan((v * (1.0 / ((9.8 * (H / v)) - v)))); elseif (v <= 2.45e-49) tmp = atan((v * sqrt((-0.05102040816326531 / H)))); else tmp = atan((v / (v * (1.0 + ((H / (v * v)) * -9.8))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -2.35e+20], N[ArcTan[N[(v * N[(1.0 / N[(N[(9.8 * N[(H / v), $MachinePrecision]), $MachinePrecision] - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 2.45e-49], N[ArcTan[N[(v * N[Sqrt[N[(-0.05102040816326531 / H), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(v * N[(1.0 + N[(N[(H / N[(v * v), $MachinePrecision]), $MachinePrecision] * -9.8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -2.35 \cdot 10^{+20}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \frac{1}{9.8 \cdot \frac{H}{v} - v}\right)\\
\mathbf{elif}\;v \leq 2.45 \cdot 10^{-49}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \sqrt{\frac{-0.05102040816326531}{H}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v \cdot \left(1 + \frac{H}{v \cdot v} \cdot -9.8\right)}\right)\\
\end{array}
\end{array}
if v < -2.35e20Initial program 43.3%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval43.3%
Simplified43.3%
Taylor expanded in v around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6494.3%
Simplified94.3%
distribute-lft-inN/A
*-rgt-identityN/A
associate--r+N/A
neg-sub0N/A
--lowering--.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6494.3%
Applied egg-rr94.3%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
Applied egg-rr94.3%
if -2.35e20 < v < 2.4500000000000001e-49Initial program 99.7%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval99.7%
Simplified99.7%
Taylor expanded in v around 0
atan-lowering-atan.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6499.6%
Simplified99.6%
Taylor expanded in H around inf
/-lowering-/.f6483.3%
Simplified83.3%
if 2.4500000000000001e-49 < v Initial program 48.6%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval48.6%
Simplified48.6%
Taylor expanded in v around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6493.5%
Simplified93.5%
Final simplification90.1%
(FPCore (v H)
:precision binary64
(if (<= v -5e-106)
(atan -1.0)
(if (<= v 1.75e-109)
(atan (* (/ v H) (* v -0.10204081632653061)))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -5e-106) {
tmp = atan(-1.0);
} else if (v <= 1.75e-109) {
tmp = atan(((v / H) * (v * -0.10204081632653061)));
} 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-106)) then
tmp = atan((-1.0d0))
else if (v <= 1.75d-109) then
tmp = atan(((v / h) * (v * (-0.10204081632653061d0))))
else
tmp = atan(1.0d0)
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -5e-106) {
tmp = Math.atan(-1.0);
} else if (v <= 1.75e-109) {
tmp = Math.atan(((v / H) * (v * -0.10204081632653061)));
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -5e-106: tmp = math.atan(-1.0) elif v <= 1.75e-109: tmp = math.atan(((v / H) * (v * -0.10204081632653061))) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -5e-106) tmp = atan(-1.0); elseif (v <= 1.75e-109) tmp = atan(Float64(Float64(v / H) * Float64(v * -0.10204081632653061))); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -5e-106) tmp = atan(-1.0); elseif (v <= 1.75e-109) tmp = atan(((v / H) * (v * -0.10204081632653061))); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -5e-106], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 1.75e-109], N[ArcTan[N[(N[(v / H), $MachinePrecision] * N[(v * -0.10204081632653061), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -5 \cdot 10^{-106}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 1.75 \cdot 10^{-109}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{H} \cdot \left(v \cdot -0.10204081632653061\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -4.99999999999999983e-106Initial program 58.1%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval58.1%
Simplified58.1%
Taylor expanded in v around -inf
Simplified82.1%
if -4.99999999999999983e-106 < v < 1.75e-109Initial program 99.7%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval99.7%
Simplified99.7%
pow1/2N/A
flip-+N/A
fmm-defN/A
*-commutativeN/A
clear-numN/A
inv-powN/A
pow-powN/A
metadata-evalN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
Applied egg-rr99.7%
Taylor expanded in v around inf
*-lowering-*.f64N/A
metadata-evalN/A
cancel-sign-sub-invN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6429.7%
Simplified29.7%
Taylor expanded in v around 0
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6429.7%
Simplified29.7%
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6429.9%
Applied egg-rr29.9%
if 1.75e-109 < v Initial program 53.6%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval53.6%
Simplified53.6%
Taylor expanded in v around inf
Simplified88.5%
Final simplification73.2%
(FPCore (v H) :precision binary64 (if (<= v -2e-306) (atan (* v (/ 1.0 (- (* 9.8 (/ H v)) v)))) (atan (/ v (+ v (/ (* H -9.8) v))))))
double code(double v, double H) {
double tmp;
if (v <= -2e-306) {
tmp = atan((v * (1.0 / ((9.8 * (H / v)) - v))));
} else {
tmp = atan((v / (v + ((H * -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 <= (-2d-306)) then
tmp = atan((v * (1.0d0 / ((9.8d0 * (h / v)) - v))))
else
tmp = atan((v / (v + ((h * (-9.8d0)) / v))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -2e-306) {
tmp = Math.atan((v * (1.0 / ((9.8 * (H / v)) - v))));
} else {
tmp = Math.atan((v / (v + ((H * -9.8) / v))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -2e-306: tmp = math.atan((v * (1.0 / ((9.8 * (H / v)) - v)))) else: tmp = math.atan((v / (v + ((H * -9.8) / v)))) return tmp
function code(v, H) tmp = 0.0 if (v <= -2e-306) tmp = atan(Float64(v * Float64(1.0 / Float64(Float64(9.8 * Float64(H / v)) - v)))); else tmp = atan(Float64(v / Float64(v + Float64(Float64(H * -9.8) / v)))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -2e-306) tmp = atan((v * (1.0 / ((9.8 * (H / v)) - v)))); else tmp = atan((v / (v + ((H * -9.8) / v)))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -2e-306], N[ArcTan[N[(v * N[(1.0 / N[(N[(9.8 * N[(H / v), $MachinePrecision]), $MachinePrecision] - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(v + N[(N[(H * -9.8), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -2 \cdot 10^{-306}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \frac{1}{9.8 \cdot \frac{H}{v} - v}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + \frac{H \cdot -9.8}{v}}\right)\\
\end{array}
\end{array}
if v < -2.00000000000000006e-306Initial program 67.6%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval67.6%
Simplified67.6%
Taylor expanded in v around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6470.5%
Simplified70.5%
distribute-lft-inN/A
*-rgt-identityN/A
associate--r+N/A
neg-sub0N/A
--lowering--.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6470.5%
Applied egg-rr70.5%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
Applied egg-rr70.5%
if -2.00000000000000006e-306 < v Initial program 63.7%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval63.7%
Simplified63.7%
Taylor expanded in H around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6475.6%
Simplified75.6%
Final simplification73.3%
(FPCore (v H) :precision binary64 (if (<= v -5e-106) (atan -1.0) (atan (/ v (+ v (/ (* H -9.8) v))))))
double code(double v, double H) {
double tmp;
if (v <= -5e-106) {
tmp = atan(-1.0);
} else {
tmp = atan((v / (v + ((H * -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 <= (-5d-106)) then
tmp = atan((-1.0d0))
else
tmp = atan((v / (v + ((h * (-9.8d0)) / v))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -5e-106) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan((v / (v + ((H * -9.8) / v))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -5e-106: tmp = math.atan(-1.0) else: tmp = math.atan((v / (v + ((H * -9.8) / v)))) return tmp
function code(v, H) tmp = 0.0 if (v <= -5e-106) tmp = atan(-1.0); else tmp = atan(Float64(v / Float64(v + Float64(Float64(H * -9.8) / v)))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -5e-106) tmp = atan(-1.0); else tmp = atan((v / (v + ((H * -9.8) / v)))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -5e-106], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[N[(v / N[(v + N[(N[(H * -9.8), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -5 \cdot 10^{-106}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + \frac{H \cdot -9.8}{v}}\right)\\
\end{array}
\end{array}
if v < -4.99999999999999983e-106Initial program 58.1%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval58.1%
Simplified58.1%
Taylor expanded in v around -inf
Simplified82.1%
if -4.99999999999999983e-106 < v Initial program 69.3%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval69.3%
Simplified69.3%
Taylor expanded in H around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6468.7%
Simplified68.7%
(FPCore (v H) :precision binary64 (if (<= v -5e-106) (atan -1.0) (atan (/ v (+ v (/ 9.8 (/ v H)))))))
double code(double v, double H) {
double tmp;
if (v <= -5e-106) {
tmp = atan(-1.0);
} else {
tmp = atan((v / (v + (9.8 / (v / H)))));
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-5d-106)) then
tmp = atan((-1.0d0))
else
tmp = atan((v / (v + (9.8d0 / (v / h)))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -5e-106) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan((v / (v + (9.8 / (v / H)))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -5e-106: tmp = math.atan(-1.0) else: tmp = math.atan((v / (v + (9.8 / (v / H))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -5e-106) tmp = atan(-1.0); else tmp = atan(Float64(v / Float64(v + Float64(9.8 / Float64(v / H))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -5e-106) tmp = atan(-1.0); else tmp = atan((v / (v + (9.8 / (v / H))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -5e-106], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[N[(v / N[(v + N[(9.8 / N[(v / H), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -5 \cdot 10^{-106}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + \frac{9.8}{\frac{v}{H}}}\right)\\
\end{array}
\end{array}
if v < -4.99999999999999983e-106Initial program 58.1%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval58.1%
Simplified58.1%
Taylor expanded in v around -inf
Simplified82.1%
if -4.99999999999999983e-106 < v Initial program 69.3%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval69.3%
Simplified69.3%
Taylor expanded in v around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6411.2%
Simplified11.2%
distribute-lft-inN/A
*-rgt-identityN/A
associate--r+N/A
neg-sub0N/A
--lowering--.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6411.2%
Applied egg-rr11.2%
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
Applied egg-rr11.2%
Applied egg-rr68.2%
(FPCore (v H) :precision binary64 (if (<= v -4e-310) (atan -1.0) (atan 1.0)))
double code(double v, double H) {
double tmp;
if (v <= -4e-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 <= (-4d-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 <= -4e-310) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -4e-310: tmp = math.atan(-1.0) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -4e-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 <= -4e-310) tmp = atan(-1.0); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -4e-310], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -3.999999999999988e-310Initial program 67.6%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval67.6%
Simplified67.6%
Taylor expanded in v around -inf
Simplified64.3%
if -3.999999999999988e-310 < v Initial program 63.7%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval63.7%
Simplified63.7%
Taylor expanded in v around inf
Simplified70.0%
(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 65.4%
atan-lowering-atan.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval65.4%
Simplified65.4%
Taylor expanded in v around -inf
Simplified29.6%
herbie shell --seed 2024145
(FPCore (v H)
:name "Optimal throwing angle"
:precision binary64
(atan (/ v (sqrt (- (* v v) (* (* 2.0 9.8) H))))))