
(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 7 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 -1e+155) (atan (/ v (- (fma (/ H v) -9.8 v)))) (if (<= v 1.5e+123) (atan (/ v (sqrt (fma v v (* -19.6 H))))) (atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -1e+155) {
tmp = atan((v / -fma((H / v), -9.8, v)));
} else if (v <= 1.5e+123) {
tmp = atan((v / sqrt(fma(v, v, (-19.6 * H)))));
} else {
tmp = atan(1.0);
}
return tmp;
}
function code(v, H) tmp = 0.0 if (v <= -1e+155) tmp = atan(Float64(v / Float64(-fma(Float64(H / v), -9.8, v)))); elseif (v <= 1.5e+123) tmp = atan(Float64(v / sqrt(fma(v, v, Float64(-19.6 * H))))); else tmp = atan(1.0); end return tmp end
code[v_, H_] := If[LessEqual[v, -1e+155], N[ArcTan[N[(v / (-N[(N[(H / v), $MachinePrecision] * -9.8 + v), $MachinePrecision])), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 1.5e+123], N[ArcTan[N[(v / N[Sqrt[N[(v * v + N[(-19.6 * H), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -1 \cdot 10^{+155}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{-\mathsf{fma}\left(\frac{H}{v}, -9.8, v\right)}\right)\\
\mathbf{elif}\;v \leq 1.5 \cdot 10^{+123}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\sqrt{\mathsf{fma}\left(v, v, -19.6 \cdot H\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -1.00000000000000001e155Initial program 3.1%
Taylor expanded in v around -inf
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*r/N/A
associate-*l/N/A
unpow2N/A
times-fracN/A
*-commutativeN/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
*-inversesN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites99.6%
Applied rewrites99.6%
if -1.00000000000000001e155 < v < 1.50000000000000004e123Initial program 99.8%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
metadata-eval99.8
Applied rewrites99.8%
if 1.50000000000000004e123 < v Initial program 25.3%
Taylor expanded in v around inf
Applied rewrites100.0%
(FPCore (v H)
:precision binary64
(if (<= v -6e-12)
(atan (/ v (- (fma (/ H v) -9.8 v))))
(if (<= v 6.2e-16)
(atan (* (sqrt (/ -0.05102040816326531 H)) v))
(atan (/ v (fma (/ -9.8 v) H v))))))
double code(double v, double H) {
double tmp;
if (v <= -6e-12) {
tmp = atan((v / -fma((H / v), -9.8, v)));
} else if (v <= 6.2e-16) {
tmp = atan((sqrt((-0.05102040816326531 / H)) * v));
} else {
tmp = atan((v / fma((-9.8 / v), H, v)));
}
return tmp;
}
function code(v, H) tmp = 0.0 if (v <= -6e-12) tmp = atan(Float64(v / Float64(-fma(Float64(H / v), -9.8, v)))); elseif (v <= 6.2e-16) tmp = atan(Float64(sqrt(Float64(-0.05102040816326531 / H)) * v)); else tmp = atan(Float64(v / fma(Float64(-9.8 / v), H, v))); end return tmp end
code[v_, H_] := If[LessEqual[v, -6e-12], N[ArcTan[N[(v / (-N[(N[(H / v), $MachinePrecision] * -9.8 + v), $MachinePrecision])), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 6.2e-16], N[ArcTan[N[(N[Sqrt[N[(-0.05102040816326531 / H), $MachinePrecision]], $MachinePrecision] * v), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(N[(-9.8 / v), $MachinePrecision] * H + v), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -6 \cdot 10^{-12}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{-\mathsf{fma}\left(\frac{H}{v}, -9.8, v\right)}\right)\\
\mathbf{elif}\;v \leq 6.2 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1} \left(\sqrt{\frac{-0.05102040816326531}{H}} \cdot v\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\mathsf{fma}\left(\frac{-9.8}{v}, H, v\right)}\right)\\
\end{array}
\end{array}
if v < -6.0000000000000003e-12Initial program 54.4%
Taylor expanded in v around -inf
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*r/N/A
associate-*l/N/A
unpow2N/A
times-fracN/A
*-commutativeN/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
*-inversesN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites92.7%
Applied rewrites92.7%
if -6.0000000000000003e-12 < v < 6.2000000000000002e-16Initial program 99.7%
/-rgt-identityN/A
clear-numN/A
frac-2negN/A
metadata-evalN/A
distribute-frac-neg2N/A
lower-/.f64N/A
metadata-evalN/A
frac-2negN/A
lower-/.f6499.6
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lift-*.f64N/A
metadata-evalN/A
metadata-eval99.6
Applied rewrites99.6%
Taylor expanded in v around 0
lower-atan.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in v around 0
Applied rewrites87.2%
if 6.2000000000000002e-16 < v Initial program 54.0%
Taylor expanded in H around 0
+-commutativeN/A
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6489.4
Applied rewrites89.4%
(FPCore (v H)
:precision binary64
(if (<= v -6e-12)
(atan (fma (/ -9.8 v) (/ H v) -1.0))
(if (<= v 6.2e-16)
(atan (* (sqrt (/ -0.05102040816326531 H)) v))
(atan (/ v (fma (/ -9.8 v) H v))))))
double code(double v, double H) {
double tmp;
if (v <= -6e-12) {
tmp = atan(fma((-9.8 / v), (H / v), -1.0));
} else if (v <= 6.2e-16) {
tmp = atan((sqrt((-0.05102040816326531 / H)) * v));
} else {
tmp = atan((v / fma((-9.8 / v), H, v)));
}
return tmp;
}
function code(v, H) tmp = 0.0 if (v <= -6e-12) tmp = atan(fma(Float64(-9.8 / v), Float64(H / v), -1.0)); elseif (v <= 6.2e-16) tmp = atan(Float64(sqrt(Float64(-0.05102040816326531 / H)) * v)); else tmp = atan(Float64(v / fma(Float64(-9.8 / v), H, v))); end return tmp end
code[v_, H_] := If[LessEqual[v, -6e-12], N[ArcTan[N[(N[(-9.8 / v), $MachinePrecision] * N[(H / v), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 6.2e-16], N[ArcTan[N[(N[Sqrt[N[(-0.05102040816326531 / H), $MachinePrecision]], $MachinePrecision] * v), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(v / N[(N[(-9.8 / v), $MachinePrecision] * H + v), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -6 \cdot 10^{-12}:\\
\;\;\;\;\tan^{-1} \left(\mathsf{fma}\left(\frac{-9.8}{v}, \frac{H}{v}, -1\right)\right)\\
\mathbf{elif}\;v \leq 6.2 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1} \left(\sqrt{\frac{-0.05102040816326531}{H}} \cdot v\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{v}{\mathsf{fma}\left(\frac{-9.8}{v}, H, v\right)}\right)\\
\end{array}
\end{array}
if v < -6.0000000000000003e-12Initial program 54.4%
lift-/.f64N/A
frac-2negN/A
neg-sub0N/A
div-subN/A
frac-subN/A
sqr-negN/A
remove-double-negN/A
remove-double-negN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
Applied rewrites52.9%
Taylor expanded in v around -inf
sub-negN/A
associate-*r/N/A
unpow2N/A
times-fracN/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f6492.3
Applied rewrites92.3%
if -6.0000000000000003e-12 < v < 6.2000000000000002e-16Initial program 99.7%
/-rgt-identityN/A
clear-numN/A
frac-2negN/A
metadata-evalN/A
distribute-frac-neg2N/A
lower-/.f64N/A
metadata-evalN/A
frac-2negN/A
lower-/.f6499.6
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lift-*.f64N/A
metadata-evalN/A
metadata-eval99.6
Applied rewrites99.6%
Taylor expanded in v around 0
lower-atan.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in v around 0
Applied rewrites87.2%
if 6.2000000000000002e-16 < v Initial program 54.0%
Taylor expanded in H around 0
+-commutativeN/A
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6489.4
Applied rewrites89.4%
(FPCore (v H)
:precision binary64
(if (<= v -6e-12)
(atan (fma (/ -9.8 v) (/ H v) -1.0))
(if (<= v 6.2e-16)
(atan (* (sqrt (/ -0.05102040816326531 H)) v))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -6e-12) {
tmp = atan(fma((-9.8 / v), (H / v), -1.0));
} else if (v <= 6.2e-16) {
tmp = atan((sqrt((-0.05102040816326531 / H)) * v));
} else {
tmp = atan(1.0);
}
return tmp;
}
function code(v, H) tmp = 0.0 if (v <= -6e-12) tmp = atan(fma(Float64(-9.8 / v), Float64(H / v), -1.0)); elseif (v <= 6.2e-16) tmp = atan(Float64(sqrt(Float64(-0.05102040816326531 / H)) * v)); else tmp = atan(1.0); end return tmp end
code[v_, H_] := If[LessEqual[v, -6e-12], N[ArcTan[N[(N[(-9.8 / v), $MachinePrecision] * N[(H / v), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision], If[LessEqual[v, 6.2e-16], N[ArcTan[N[(N[Sqrt[N[(-0.05102040816326531 / H), $MachinePrecision]], $MachinePrecision] * v), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -6 \cdot 10^{-12}:\\
\;\;\;\;\tan^{-1} \left(\mathsf{fma}\left(\frac{-9.8}{v}, \frac{H}{v}, -1\right)\right)\\
\mathbf{elif}\;v \leq 6.2 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1} \left(\sqrt{\frac{-0.05102040816326531}{H}} \cdot v\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -6.0000000000000003e-12Initial program 54.4%
lift-/.f64N/A
frac-2negN/A
neg-sub0N/A
div-subN/A
frac-subN/A
sqr-negN/A
remove-double-negN/A
remove-double-negN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
Applied rewrites52.9%
Taylor expanded in v around -inf
sub-negN/A
associate-*r/N/A
unpow2N/A
times-fracN/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f6492.3
Applied rewrites92.3%
if -6.0000000000000003e-12 < v < 6.2000000000000002e-16Initial program 99.7%
/-rgt-identityN/A
clear-numN/A
frac-2negN/A
metadata-evalN/A
distribute-frac-neg2N/A
lower-/.f64N/A
metadata-evalN/A
frac-2negN/A
lower-/.f6499.6
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lift-*.f64N/A
metadata-evalN/A
metadata-eval99.6
Applied rewrites99.6%
Taylor expanded in v around 0
lower-atan.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in v around 0
Applied rewrites87.2%
if 6.2000000000000002e-16 < v Initial program 54.0%
Taylor expanded in v around inf
Applied rewrites89.2%
(FPCore (v H)
:precision binary64
(if (<= v -6e-12)
(atan -1.0)
(if (<= v 6.2e-16)
(atan (* (sqrt (/ -0.05102040816326531 H)) v))
(atan 1.0))))
double code(double v, double H) {
double tmp;
if (v <= -6e-12) {
tmp = atan(-1.0);
} else if (v <= 6.2e-16) {
tmp = atan((sqrt((-0.05102040816326531 / 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 <= (-6d-12)) then
tmp = atan((-1.0d0))
else if (v <= 6.2d-16) then
tmp = atan((sqrt(((-0.05102040816326531d0) / 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 <= -6e-12) {
tmp = Math.atan(-1.0);
} else if (v <= 6.2e-16) {
tmp = Math.atan((Math.sqrt((-0.05102040816326531 / H)) * v));
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -6e-12: tmp = math.atan(-1.0) elif v <= 6.2e-16: tmp = math.atan((math.sqrt((-0.05102040816326531 / H)) * v)) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -6e-12) tmp = atan(-1.0); elseif (v <= 6.2e-16) tmp = atan(Float64(sqrt(Float64(-0.05102040816326531 / H)) * v)); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -6e-12) tmp = atan(-1.0); elseif (v <= 6.2e-16) tmp = atan((sqrt((-0.05102040816326531 / H)) * v)); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -6e-12], N[ArcTan[-1.0], $MachinePrecision], If[LessEqual[v, 6.2e-16], N[ArcTan[N[(N[Sqrt[N[(-0.05102040816326531 / H), $MachinePrecision]], $MachinePrecision] * v), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -6 \cdot 10^{-12}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{elif}\;v \leq 6.2 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1} \left(\sqrt{\frac{-0.05102040816326531}{H}} \cdot v\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -6.0000000000000003e-12Initial program 54.4%
Taylor expanded in v around -inf
Applied rewrites92.1%
if -6.0000000000000003e-12 < v < 6.2000000000000002e-16Initial program 99.7%
/-rgt-identityN/A
clear-numN/A
frac-2negN/A
metadata-evalN/A
distribute-frac-neg2N/A
lower-/.f64N/A
metadata-evalN/A
frac-2negN/A
lower-/.f6499.6
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lift-*.f64N/A
metadata-evalN/A
metadata-eval99.6
Applied rewrites99.6%
Taylor expanded in v around 0
lower-atan.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in v around 0
Applied rewrites87.2%
if 6.2000000000000002e-16 < v Initial program 54.0%
Taylor expanded in v around inf
Applied rewrites89.2%
(FPCore (v H) :precision binary64 (if (<= v -3.8e-308) (atan -1.0) (atan 1.0)))
double code(double v, double H) {
double tmp;
if (v <= -3.8e-308) {
tmp = atan(-1.0);
} else {
tmp = atan(1.0);
}
return tmp;
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
real(8) :: tmp
if (v <= (-3.8d-308)) then
tmp = atan((-1.0d0))
else
tmp = atan(1.0d0)
end if
code = tmp
end function
public static double code(double v, double H) {
double tmp;
if (v <= -3.8e-308) {
tmp = Math.atan(-1.0);
} else {
tmp = Math.atan(1.0);
}
return tmp;
}
def code(v, H): tmp = 0 if v <= -3.8e-308: tmp = math.atan(-1.0) else: tmp = math.atan(1.0) return tmp
function code(v, H) tmp = 0.0 if (v <= -3.8e-308) tmp = atan(-1.0); else tmp = atan(1.0); end return tmp end
function tmp_2 = code(v, H) tmp = 0.0; if (v <= -3.8e-308) tmp = atan(-1.0); else tmp = atan(1.0); end tmp_2 = tmp; end
code[v_, H_] := If[LessEqual[v, -3.8e-308], N[ArcTan[-1.0], $MachinePrecision], N[ArcTan[1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -3.8 \cdot 10^{-308}:\\
\;\;\;\;\tan^{-1} -1\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} 1\\
\end{array}
\end{array}
if v < -3.79999999999999975e-308Initial program 69.1%
Taylor expanded in v around -inf
Applied rewrites66.8%
if -3.79999999999999975e-308 < v Initial program 72.3%
Taylor expanded in v around inf
Applied rewrites60.9%
(FPCore (v H) :precision binary64 (atan -1.0))
double code(double v, double H) {
return atan(-1.0);
}
real(8) function code(v, h)
real(8), intent (in) :: v
real(8), intent (in) :: h
code = atan((-1.0d0))
end function
public static double code(double v, double H) {
return Math.atan(-1.0);
}
def code(v, H): return math.atan(-1.0)
function code(v, H) return atan(-1.0) end
function tmp = code(v, H) tmp = atan(-1.0); end
code[v_, H_] := N[ArcTan[-1.0], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1} -1
\end{array}
Initial program 70.7%
Taylor expanded in v around -inf
Applied rewrites33.8%
herbie shell --seed 2024284
(FPCore (v H)
:name "Optimal throwing angle"
:precision binary64
(atan (/ v (sqrt (- (* v v) (* (* 2.0 9.8) H))))))