
(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+140)
(atan (+ -1.0 (* (/ H (* v v)) -9.8)))
(if (<= v 5e+152)
(atan (* v (sqrt (/ 1.0 (+ (* v v) (* H -19.6))))))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -5e+140) {
tmp = atan((-1.0 + ((H / (v * v)) * -9.8)));
} else if (v <= 5e+152) {
tmp = atan((v * sqrt((1.0 / ((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+140)) then
tmp = atan(((-1.0d0) + ((h / (v * v)) * (-9.8d0))))
else if (v <= 5d+152) then
tmp = atan((v * sqrt((1.0d0 / ((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+140) {
tmp = Math.atan((-1.0 + ((H / (v * v)) * -9.8)));
} else if (v <= 5e+152) {
tmp = Math.atan((v * Math.sqrt((1.0 / ((v * v) + (H * -19.6))))));
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -5e+140: tmp = math.atan((-1.0 + ((H / (v * v)) * -9.8))) elif v <= 5e+152: tmp = math.atan((v * math.sqrt((1.0 / ((v * v) + (H * -19.6)))))) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -5e+140) tmp = atan(Float64(-1.0 + Float64(Float64(H / Float64(v * v)) * -9.8))); elseif (v <= 5e+152) tmp = atan(Float64(v * sqrt(Float64(1.0 / 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+140) tmp = atan((-1.0 + ((H / (v * v)) * -9.8))); elseif (v <= 5e+152) tmp = atan((v * sqrt((1.0 / ((v * v) + (H * -19.6)))))); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -5e+140], N[ArcTan[N[(-1.0 + N[(N[(H / N[(v * v), $MachinePrecision]), $MachinePrecision] * -9.8), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 5e+152], N[ArcTan[N[(v * N[Sqrt[N[(1.0 / N[(N[(v * v), $MachinePrecision] + N[(H * -19.6), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -5 \cdot 10^{+140}:\\
\;\;\;\;\tan^{-1} \left(-1 + \frac{H}{v \cdot v} \cdot -9.8\right)\\
\mathbf{elif}\;v \leq 5 \cdot 10^{+152}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \sqrt{\frac{1}{v \cdot v + H \cdot -19.6}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -5.00000000000000008e140Initial program 14.8%
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-eval14.8%
Simplified14.8%
Taylor expanded in v around -inf
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64100.0%
Simplified100.0%
if -5.00000000000000008e140 < v < 5e152Initial 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.8%
Simplified99.8%
if 5e152 < v Initial program 5.5%
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-eval5.5%
Simplified5.5%
Taylor expanded in v around inf
Simplified100.0%
Final simplification99.8%
(FPCore (v H) :precision binary64 (if (<= v -2e+154) (atan -1.0) (if (<= v 5e+151) (atan (/ v (sqrt (+ (* v v) (* H -19.6))))) (atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -2e+154) {
tmp = atan(-1.0);
} else if (v <= 5e+151) {
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 <= (-2d+154)) then
tmp = atan((-1.0d0))
else if (v <= 5d+151) 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 <= -2e+154) {
tmp = Math.atan(-1.0);
} else if (v <= 5e+151) {
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 <= -2e+154: tmp = math.atan(-1.0) elif v <= 5e+151: 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 <= -2e+154) tmp = atan(-1.0); elseif (v <= 5e+151) 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 <= -2e+154) tmp = atan(-1.0); elseif (v <= 5e+151) 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, -2e+154], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 5e+151], 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 -2 \cdot 10^{+154}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 5 \cdot 10^{+151}:\\
\;\;\;\;\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 < -2.00000000000000007e154Initial 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 -2.00000000000000007e154 < v < 5.0000000000000002e151Initial 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 5.0000000000000002e151 < v Initial program 5.5%
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-eval5.5%
Simplified5.5%
Taylor expanded in v around inf
Simplified100.0%
(FPCore (v H)
:precision binary64
(let* ((t_0 (/ H (* v v))))
(if (<= v -5e+23)
(atan (/ v (* v (- -1.0 (* t_0 -9.8)))))
(if (<= v 1.92e-78)
(atan (* v (sqrt (/ -0.05102040816326531 H))))
(atan (/ v (+ v (* H (+ (/ (* t_0 -48.02) v) (/ -9.8 v))))))))))
double code(double v, double H) {
double t_0 = H / (v * v);
double tmp;
if (v <= -5e+23) {
tmp = atan((v / (v * (-1.0 - (t_0 * -9.8)))));
} else if (v <= 1.92e-78) {
tmp = atan((v * sqrt((-0.05102040816326531 / H))));
} else {
tmp = atan((v / (v + (H * (((t_0 * -48.02) / v) + (-9.8 / 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 = h / (v * v)
if (v <= (-5d+23)) then
tmp = atan((v / (v * ((-1.0d0) - (t_0 * (-9.8d0))))))
else if (v <= 1.92d-78) then
tmp = atan((v * sqrt(((-0.05102040816326531d0) / h))))
else
tmp = atan((v / (v + (h * (((t_0 * (-48.02d0)) / v) + ((-9.8d0) / v))))))
end if
code = tmp
end function
public static double code(double v, double H) {
double t_0 = H / (v * v);
double tmp;
if (v <= -5e+23) {
tmp = Math.atan((v / (v * (-1.0 - (t_0 * -9.8)))));
} else if (v <= 1.92e-78) {
tmp = Math.atan((v * Math.sqrt((-0.05102040816326531 / H))));
} else {
tmp = Math.atan((v / (v + (H * (((t_0 * -48.02) / v) + (-9.8 / v))))));
}
return tmp;
}
def code(v, H): t_0 = H / (v * v) tmp = 0 if v <= -5e+23: tmp = math.atan((v / (v * (-1.0 - (t_0 * -9.8))))) elif v <= 1.92e-78: tmp = math.atan((v * math.sqrt((-0.05102040816326531 / H)))) else: tmp = math.atan((v / (v + (H * (((t_0 * -48.02) / v) + (-9.8 / v)))))) return tmp
function code(v, H) t_0 = Float64(H / Float64(v * v)) tmp = 0.0 if (v <= -5e+23) tmp = atan(Float64(v / Float64(v * Float64(-1.0 - Float64(t_0 * -9.8))))); elseif (v <= 1.92e-78) tmp = atan(Float64(v * sqrt(Float64(-0.05102040816326531 / H)))); else tmp = atan(Float64(v / Float64(v + Float64(H * Float64(Float64(Float64(t_0 * -48.02) / v) + Float64(-9.8 / v)))))); end return tmp end
function tmp_2 = code(v, H) t_0 = H / (v * v); tmp = 0.0; if (v <= -5e+23) tmp = atan((v / (v * (-1.0 - (t_0 * -9.8))))); elseif (v <= 1.92e-78) tmp = atan((v * sqrt((-0.05102040816326531 / H)))); else tmp = atan((v / (v + (H * (((t_0 * -48.02) / v) + (-9.8 / v)))))); end tmp_2 = tmp; end
code[v_, H_] := Block[{t$95$0 = N[(H / N[(v * v), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -5e+23], N[ArcTan[N[(v / N[(v * N[(-1.0 - N[(t$95$0 * -9.8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 1.92e-78], N[ArcTan[N[(v * N[Sqrt[N[(-0.05102040816326531 / H), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(v + N[(H * N[(N[(N[(t$95$0 * -48.02), $MachinePrecision] / v), $MachinePrecision] + N[(-9.8 / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{H}{v \cdot v}\\
\mathbf{if}\;v \leq -5 \cdot 10^{+23}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v \cdot \left(-1 - t\_0 \cdot -9.8\right)}\right)\\
\mathbf{elif}\;v \leq 1.92 \cdot 10^{-78}:\\
\;\;\;\;\tan^{-1} \left(v \cdot \sqrt{\frac{-0.05102040816326531}{H}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + H \cdot \left(\frac{t\_0 \cdot -48.02}{v} + \frac{-9.8}{v}\right)}\right)\\
\end{array}
\end{array}
if v < -4.9999999999999999e23Initial program 46.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-eval46.7%
Simplified46.7%
Taylor expanded in v around -inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6495.4%
Simplified95.4%
if -4.9999999999999999e23 < v < 1.92000000000000005e-78Initial program 99.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-eval99.6%
Simplified99.6%
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.7%
Simplified99.7%
Taylor expanded in H around inf
/-lowering-/.f6491.0%
Simplified91.0%
if 1.92000000000000005e-78 < v Initial program 52.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-eval52.7%
Simplified52.7%
Taylor expanded in H around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
associate-*r/N/A
unpow3N/A
unpow2N/A
associate-/r*N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-rgt-identityN/A
times-fracN/A
metadata-evalN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6486.5%
Simplified86.5%
Final simplification90.9%
(FPCore (v H) :precision binary64 (if (<= v -4e-297) (atan (/ v (* v (- -1.0 (* (/ H (* v v)) -9.8))))) (atan (/ v (+ v (/ H (/ v -9.8)))))))
double code(double v, double H) {
double tmp;
if (v <= -4e-297) {
tmp = atan((v / (v * (-1.0 - ((H / (v * v)) * -9.8)))));
} else {
tmp = atan((v / (v + (H / (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 <= (-4d-297)) then
tmp = atan((v / (v * ((-1.0d0) - ((h / (v * v)) * (-9.8d0))))))
else
tmp = atan((v / (v + (h / (v / (-9.8d0))))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -4e-297) {
tmp = Math.atan((v / (v * (-1.0 - ((H / (v * v)) * -9.8)))));
} else {
tmp = Math.atan((v / (v + (H / (v / -9.8)))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -4e-297: tmp = math.atan((v / (v * (-1.0 - ((H / (v * v)) * -9.8))))) else: tmp = math.atan((v / (v + (H / (v / -9.8))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -4e-297) tmp = atan(Float64(v / Float64(v * Float64(-1.0 - Float64(Float64(H / Float64(v * v)) * -9.8))))); else tmp = atan(Float64(v / Float64(v + Float64(H / Float64(v / -9.8))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -4e-297) tmp = atan((v / (v * (-1.0 - ((H / (v * v)) * -9.8))))); else tmp = atan((v / (v + (H / (v / -9.8))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -4e-297], N[ArcTan[N[(v / N[(v * N[(-1.0 - N[(N[(H / N[(v * v), $MachinePrecision]), $MachinePrecision] * -9.8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(v + N[(H / N[(v / -9.8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -4 \cdot 10^{-297}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v \cdot \left(-1 - \frac{H}{v \cdot v} \cdot -9.8\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + \frac{H}{\frac{v}{-9.8}}}\right)\\
\end{array}
\end{array}
if v < -4.00000000000000016e-297Initial program 69.8%
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.8%
Simplified69.8%
Taylor expanded in v around -inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6463.7%
Simplified63.7%
if -4.00000000000000016e-297 < v Initial program 65.9%
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.9%
Simplified65.9%
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.4%
Simplified68.4%
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6469.2%
Applied egg-rr69.2%
Final simplification66.1%
(FPCore (v H)
:precision binary64
(if (<= v -3.8e-203)
(atan -1.0)
(if (<= v 1.7e-124)
(atan (* (/ v (/ H v)) -0.10204081632653061))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -3.8e-203) {
tmp = atan(-1.0);
} else if (v <= 1.7e-124) {
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 <= (-3.8d-203)) then
tmp = atan((-1.0d0))
else if (v <= 1.7d-124) 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 <= -3.8e-203) {
tmp = Math.atan(-1.0);
} else if (v <= 1.7e-124) {
tmp = Math.atan(((v / (H / v)) * -0.10204081632653061));
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -3.8e-203: tmp = math.atan(-1.0) elif v <= 1.7e-124: 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 <= -3.8e-203) tmp = atan(-1.0); elseif (v <= 1.7e-124) tmp = atan(Float64(Float64(v / Float64(H / v)) * -0.10204081632653061)); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -3.8e-203) tmp = atan(-1.0); elseif (v <= 1.7e-124) tmp = atan(((v / (H / v)) * -0.10204081632653061)); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -3.8e-203], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 1.7e-124], N[ArcTan[N[(N[(v / N[(H / v), $MachinePrecision]), $MachinePrecision] * -0.10204081632653061), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -3.8 \cdot 10^{-203}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 1.7 \cdot 10^{-124}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\frac{H}{v}} \cdot -0.10204081632653061\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -3.80000000000000025e-203Initial program 64.9%
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-eval64.9%
Simplified64.9%
Taylor expanded in v around -inf
Simplified69.9%
if -3.80000000000000025e-203 < v < 1.7e-124Initial program 99.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-eval99.6%
Simplified99.6%
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-*.f6424.1%
Simplified24.1%
Taylor expanded in v around 0
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6424.1%
Simplified24.1%
associate-/r/N/A
associate-*l/N/A
clear-numN/A
associate-*l/N/A
inv-powN/A
unpow-prod-downN/A
inv-powN/A
clear-numN/A
*-lowering-*.f64N/A
clear-numN/A
associate-/r*N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
metadata-eval24.1%
Applied egg-rr24.1%
if 1.7e-124 < v Initial program 56.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-eval56.4%
Simplified56.4%
Taylor expanded in v around inf
Simplified80.6%
(FPCore (v H) :precision binary64 (if (<= v -3.8e-203) (atan -1.0) (atan (/ v (+ v (/ H (/ v -9.8)))))))
double code(double v, double H) {
double tmp;
if (v <= -3.8e-203) {
tmp = atan(-1.0);
} else {
tmp = atan((v / (v + (H / (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 <= (-3.8d-203)) then
tmp = atan((-1.0d0))
else
tmp = atan((v / (v + (h / (v / (-9.8d0))))))
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -3.8e-203) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan((v / (v + (H / (v / -9.8)))));
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -3.8e-203: tmp = math.atan(-1.0) else: tmp = math.atan((v / (v + (H / (v / -9.8))))) return tmp
function code(v, H) tmp = 0.0 if (v <= -3.8e-203) tmp = atan(-1.0); else tmp = atan(Float64(v / Float64(v + Float64(H / Float64(v / -9.8))))); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -3.8e-203) tmp = atan(-1.0); else tmp = atan((v / (v + (H / (v / -9.8))))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -3.8e-203], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[N[(v / N[(v + N[(H / N[(v / -9.8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -3.8 \cdot 10^{-203}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + \frac{H}{\frac{v}{-9.8}}}\right)\\
\end{array}
\end{array}
if v < -3.80000000000000025e-203Initial program 64.9%
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-eval64.9%
Simplified64.9%
Taylor expanded in v around -inf
Simplified69.9%
if -3.80000000000000025e-203 < v Initial program 70.9%
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-eval70.9%
Simplified70.9%
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-*.f6461.3%
Simplified61.3%
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6462.0%
Applied egg-rr62.0%
Final simplification65.8%
(FPCore (v H) :precision binary64 (if (<= v -3.8e-203) (atan -1.0) (atan (/ v (+ v (/ (* H -9.8) v))))))
double code(double v, double H) {
double tmp;
if (v <= -3.8e-203) {
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 <= (-3.8d-203)) 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 <= -3.8e-203) {
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 <= -3.8e-203: 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 <= -3.8e-203) 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 <= -3.8e-203) tmp = atan(-1.0); else tmp = atan((v / (v + ((H * -9.8) / v)))); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -3.8e-203], 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 -3.8 \cdot 10^{-203}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{v + \frac{H \cdot -9.8}{v}}\right)\\
\end{array}
\end{array}
if v < -3.80000000000000025e-203Initial program 64.9%
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-eval64.9%
Simplified64.9%
Taylor expanded in v around -inf
Simplified69.9%
if -3.80000000000000025e-203 < v Initial program 70.9%
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-eval70.9%
Simplified70.9%
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-*.f6461.3%
Simplified61.3%
(FPCore (v H) :precision binary64 (if (<= v -5e-311) (atan -1.0) (atan 1.0)))
double code(double v, double H) {
double tmp;
if (v <= -5e-311) {
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-311)) 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-311) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -5e-311: tmp = math.atan(-1.0) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -5e-311) 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-311) tmp = atan(-1.0); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -5e-311], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -5.00000000000023e-311Initial program 70.0%
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-eval70.0%
Simplified70.0%
Taylor expanded in v around -inf
Simplified60.2%
if -5.00000000000023e-311 < v Initial program 65.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-eval65.6%
Simplified65.6%
Taylor expanded in v around inf
Simplified64.4%
(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 68.0%
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-eval68.0%
Simplified68.0%
Taylor expanded in v around -inf
Simplified34.4%
herbie shell --seed 2024155
(FPCore (v H)
:name "Optimal throwing angle"
:precision binary64
(atan (/ v (sqrt (- (* v v) (* (* 2.0 9.8) H))))))