Optimal throwing angle

Percentage Accurate: 67.7% → 99.6%
Time: 7.9s
Alternatives: 7
Speedup: 1.3×

Specification

?
\[\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
 (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:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 7 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 67.7% accurate, 1.0× speedup?

\[\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
 (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}

Alternative 1: 99.6% accurate, 1.0× speedup?

\[\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} \]
(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}
Derivation
  1. Split input into 3 regimes
  2. if v < -1.00000000000000001e155

    1. Initial program 3.1%

      \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in v around -inf

      \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{-1 \cdot \left(v \cdot \left(1 + \frac{-49}{5} \cdot \frac{H}{{v}^{2}}\right)\right)}}\right) \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\mathsf{neg}\left(v \cdot \left(1 + \frac{-49}{5} \cdot \frac{H}{{v}^{2}}\right)\right)}}\right) \]
      2. lower-neg.f64N/A

        \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{-v \cdot \left(1 + \frac{-49}{5} \cdot \frac{H}{{v}^{2}}\right)}}\right) \]
      3. +-commutativeN/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-v \cdot \color{blue}{\left(\frac{-49}{5} \cdot \frac{H}{{v}^{2}} + 1\right)}}\right) \]
      4. distribute-rgt-inN/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-\color{blue}{\left(\left(\frac{-49}{5} \cdot \frac{H}{{v}^{2}}\right) \cdot v + 1 \cdot v\right)}}\right) \]
      5. associate-*r/N/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\color{blue}{\frac{\frac{-49}{5} \cdot H}{{v}^{2}}} \cdot v + 1 \cdot v\right)}\right) \]
      6. associate-*l/N/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\color{blue}{\frac{\left(\frac{-49}{5} \cdot H\right) \cdot v}{{v}^{2}}} + 1 \cdot v\right)}\right) \]
      7. unpow2N/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\frac{\left(\frac{-49}{5} \cdot H\right) \cdot v}{\color{blue}{v \cdot v}} + 1 \cdot v\right)}\right) \]
      8. times-fracN/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\color{blue}{\frac{\frac{-49}{5} \cdot H}{v} \cdot \frac{v}{v}} + 1 \cdot v\right)}\right) \]
      9. *-commutativeN/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\frac{\color{blue}{H \cdot \frac{-49}{5}}}{v} \cdot \frac{v}{v} + 1 \cdot v\right)}\right) \]
      10. associate-*r/N/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\color{blue}{\left(H \cdot \frac{\frac{-49}{5}}{v}\right)} \cdot \frac{v}{v} + 1 \cdot v\right)}\right) \]
      11. metadata-evalN/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\left(H \cdot \frac{\color{blue}{\mathsf{neg}\left(\frac{49}{5}\right)}}{v}\right) \cdot \frac{v}{v} + 1 \cdot v\right)}\right) \]
      12. distribute-neg-fracN/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\left(H \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{\frac{49}{5}}{v}\right)\right)}\right) \cdot \frac{v}{v} + 1 \cdot v\right)}\right) \]
      13. metadata-evalN/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\left(H \cdot \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{49}{5} \cdot 1}}{v}\right)\right)\right) \cdot \frac{v}{v} + 1 \cdot v\right)}\right) \]
      14. associate-*r/N/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\left(H \cdot \left(\mathsf{neg}\left(\color{blue}{\frac{49}{5} \cdot \frac{1}{v}}\right)\right)\right) \cdot \frac{v}{v} + 1 \cdot v\right)}\right) \]
      15. *-inversesN/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\left(H \cdot \left(\mathsf{neg}\left(\frac{49}{5} \cdot \frac{1}{v}\right)\right)\right) \cdot \color{blue}{1} + 1 \cdot v\right)}\right) \]
      16. *-lft-identityN/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\left(H \cdot \left(\mathsf{neg}\left(\frac{49}{5} \cdot \frac{1}{v}\right)\right)\right) \cdot 1 + \color{blue}{v}\right)}\right) \]
      17. lower-fma.f64N/A

        \[\leadsto \tan^{-1} \left(\frac{v}{-\color{blue}{\mathsf{fma}\left(H \cdot \left(\mathsf{neg}\left(\frac{49}{5} \cdot \frac{1}{v}\right)\right), 1, v\right)}}\right) \]
    5. Applied rewrites99.6%

      \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{-\mathsf{fma}\left(\frac{-9.8}{v} \cdot H, 1, v\right)}}\right) \]
    6. Step-by-step derivation
      1. Applied rewrites99.6%

        \[\leadsto \tan^{-1} \left(\frac{v}{-\mathsf{fma}\left(\frac{H}{v}, -9.8, v\right)}\right) \]

      if -1.00000000000000001e155 < v < 1.50000000000000004e123

      1. Initial program 99.8%

        \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift--.f64N/A

          \[\leadsto \tan^{-1} \left(\frac{v}{\sqrt{\color{blue}{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}\right) \]
        2. sub-negN/A

          \[\leadsto \tan^{-1} \left(\frac{v}{\sqrt{\color{blue}{v \cdot v + \left(\mathsf{neg}\left(\left(2 \cdot \frac{49}{5}\right) \cdot H\right)\right)}}}\right) \]
        3. lift-*.f64N/A

          \[\leadsto \tan^{-1} \left(\frac{v}{\sqrt{\color{blue}{v \cdot v} + \left(\mathsf{neg}\left(\left(2 \cdot \frac{49}{5}\right) \cdot H\right)\right)}}\right) \]
        4. lower-fma.f64N/A

          \[\leadsto \tan^{-1} \left(\frac{v}{\sqrt{\color{blue}{\mathsf{fma}\left(v, v, \mathsf{neg}\left(\left(2 \cdot \frac{49}{5}\right) \cdot H\right)\right)}}}\right) \]
        5. lift-*.f64N/A

          \[\leadsto \tan^{-1} \left(\frac{v}{\sqrt{\mathsf{fma}\left(v, v, \mathsf{neg}\left(\color{blue}{\left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right)}}\right) \]
        6. distribute-lft-neg-inN/A

          \[\leadsto \tan^{-1} \left(\frac{v}{\sqrt{\mathsf{fma}\left(v, v, \color{blue}{\left(\mathsf{neg}\left(2 \cdot \frac{49}{5}\right)\right) \cdot H}\right)}}\right) \]
        7. lower-*.f64N/A

          \[\leadsto \tan^{-1} \left(\frac{v}{\sqrt{\mathsf{fma}\left(v, v, \color{blue}{\left(\mathsf{neg}\left(2 \cdot \frac{49}{5}\right)\right) \cdot H}\right)}}\right) \]
        8. lift-*.f64N/A

          \[\leadsto \tan^{-1} \left(\frac{v}{\sqrt{\mathsf{fma}\left(v, v, \left(\mathsf{neg}\left(\color{blue}{2 \cdot \frac{49}{5}}\right)\right) \cdot H\right)}}\right) \]
        9. metadata-evalN/A

          \[\leadsto \tan^{-1} \left(\frac{v}{\sqrt{\mathsf{fma}\left(v, v, \left(\mathsf{neg}\left(\color{blue}{\frac{98}{5}}\right)\right) \cdot H\right)}}\right) \]
        10. metadata-eval99.8

          \[\leadsto \tan^{-1} \left(\frac{v}{\sqrt{\mathsf{fma}\left(v, v, \color{blue}{-19.6} \cdot H\right)}}\right) \]
      4. Applied rewrites99.8%

        \[\leadsto \tan^{-1} \left(\frac{v}{\sqrt{\color{blue}{\mathsf{fma}\left(v, v, -19.6 \cdot H\right)}}}\right) \]

      if 1.50000000000000004e123 < v

      1. Initial program 25.3%

        \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in v around inf

        \[\leadsto \tan^{-1} \color{blue}{1} \]
      4. Step-by-step derivation
        1. Applied rewrites100.0%

          \[\leadsto \tan^{-1} \color{blue}{1} \]
      5. Recombined 3 regimes into one program.
      6. Add Preprocessing

      Alternative 2: 88.8% accurate, 1.0× speedup?

      \[\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} \]
      (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}
      
      Derivation
      1. Split input into 3 regimes
      2. if v < -6.0000000000000003e-12

        1. Initial program 54.4%

          \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
        2. Add Preprocessing
        3. Taylor expanded in v around -inf

          \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{-1 \cdot \left(v \cdot \left(1 + \frac{-49}{5} \cdot \frac{H}{{v}^{2}}\right)\right)}}\right) \]
        4. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\mathsf{neg}\left(v \cdot \left(1 + \frac{-49}{5} \cdot \frac{H}{{v}^{2}}\right)\right)}}\right) \]
          2. lower-neg.f64N/A

            \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{-v \cdot \left(1 + \frac{-49}{5} \cdot \frac{H}{{v}^{2}}\right)}}\right) \]
          3. +-commutativeN/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-v \cdot \color{blue}{\left(\frac{-49}{5} \cdot \frac{H}{{v}^{2}} + 1\right)}}\right) \]
          4. distribute-rgt-inN/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-\color{blue}{\left(\left(\frac{-49}{5} \cdot \frac{H}{{v}^{2}}\right) \cdot v + 1 \cdot v\right)}}\right) \]
          5. associate-*r/N/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\color{blue}{\frac{\frac{-49}{5} \cdot H}{{v}^{2}}} \cdot v + 1 \cdot v\right)}\right) \]
          6. associate-*l/N/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\color{blue}{\frac{\left(\frac{-49}{5} \cdot H\right) \cdot v}{{v}^{2}}} + 1 \cdot v\right)}\right) \]
          7. unpow2N/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\frac{\left(\frac{-49}{5} \cdot H\right) \cdot v}{\color{blue}{v \cdot v}} + 1 \cdot v\right)}\right) \]
          8. times-fracN/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\color{blue}{\frac{\frac{-49}{5} \cdot H}{v} \cdot \frac{v}{v}} + 1 \cdot v\right)}\right) \]
          9. *-commutativeN/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\frac{\color{blue}{H \cdot \frac{-49}{5}}}{v} \cdot \frac{v}{v} + 1 \cdot v\right)}\right) \]
          10. associate-*r/N/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\color{blue}{\left(H \cdot \frac{\frac{-49}{5}}{v}\right)} \cdot \frac{v}{v} + 1 \cdot v\right)}\right) \]
          11. metadata-evalN/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\left(H \cdot \frac{\color{blue}{\mathsf{neg}\left(\frac{49}{5}\right)}}{v}\right) \cdot \frac{v}{v} + 1 \cdot v\right)}\right) \]
          12. distribute-neg-fracN/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\left(H \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{\frac{49}{5}}{v}\right)\right)}\right) \cdot \frac{v}{v} + 1 \cdot v\right)}\right) \]
          13. metadata-evalN/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\left(H \cdot \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{49}{5} \cdot 1}}{v}\right)\right)\right) \cdot \frac{v}{v} + 1 \cdot v\right)}\right) \]
          14. associate-*r/N/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\left(H \cdot \left(\mathsf{neg}\left(\color{blue}{\frac{49}{5} \cdot \frac{1}{v}}\right)\right)\right) \cdot \frac{v}{v} + 1 \cdot v\right)}\right) \]
          15. *-inversesN/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\left(H \cdot \left(\mathsf{neg}\left(\frac{49}{5} \cdot \frac{1}{v}\right)\right)\right) \cdot \color{blue}{1} + 1 \cdot v\right)}\right) \]
          16. *-lft-identityN/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-\left(\left(H \cdot \left(\mathsf{neg}\left(\frac{49}{5} \cdot \frac{1}{v}\right)\right)\right) \cdot 1 + \color{blue}{v}\right)}\right) \]
          17. lower-fma.f64N/A

            \[\leadsto \tan^{-1} \left(\frac{v}{-\color{blue}{\mathsf{fma}\left(H \cdot \left(\mathsf{neg}\left(\frac{49}{5} \cdot \frac{1}{v}\right)\right), 1, v\right)}}\right) \]
        5. Applied rewrites92.7%

          \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{-\mathsf{fma}\left(\frac{-9.8}{v} \cdot H, 1, v\right)}}\right) \]
        6. Step-by-step derivation
          1. Applied rewrites92.7%

            \[\leadsto \tan^{-1} \left(\frac{v}{-\mathsf{fma}\left(\frac{H}{v}, -9.8, v\right)}\right) \]

          if -6.0000000000000003e-12 < v < 6.2000000000000002e-16

          1. Initial program 99.7%

            \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. /-rgt-identityN/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}{1}}}\right) \]
            2. clear-numN/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{1}{\frac{1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}}}\right) \]
            3. frac-2negN/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{\mathsf{neg}\left(1\right)}{\mathsf{neg}\left(\frac{1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}\right)}}}\right) \]
            4. metadata-evalN/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\frac{\color{blue}{-1}}{\mathsf{neg}\left(\frac{1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}\right)}}\right) \]
            5. distribute-frac-neg2N/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\color{blue}{\frac{1}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}}}}\right) \]
            6. lower-/.f64N/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{-1}{\frac{1}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}}}}\right) \]
            7. metadata-evalN/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{\color{blue}{\mathsf{neg}\left(-1\right)}}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}}}\right) \]
            8. frac-2negN/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\color{blue}{\frac{-1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}}}\right) \]
            9. lower-/.f6499.6

              \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\color{blue}{\frac{-1}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}}}}\right) \]
            10. lift--.f64N/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}}}\right) \]
            11. sub-negN/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{v \cdot v + \left(\mathsf{neg}\left(\left(2 \cdot \frac{49}{5}\right) \cdot H\right)\right)}}}}}\right) \]
            12. +-commutativeN/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(2 \cdot \frac{49}{5}\right) \cdot H\right)\right) + v \cdot v}}}}}\right) \]
            13. lift-*.f64N/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\left(\mathsf{neg}\left(\color{blue}{\left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) + v \cdot v}}}}\right) \]
            14. distribute-lft-neg-inN/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{\left(\mathsf{neg}\left(2 \cdot \frac{49}{5}\right)\right) \cdot H} + v \cdot v}}}}\right) \]
            15. lower-fma.f64N/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(2 \cdot \frac{49}{5}\right), H, v \cdot v\right)}}}}}\right) \]
            16. lift-*.f64N/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{2 \cdot \frac{49}{5}}\right), H, v \cdot v\right)}}}}\right) \]
            17. metadata-evalN/A

              \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\frac{98}{5}}\right), H, v \cdot v\right)}}}}\right) \]
            18. metadata-eval99.6

              \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(\color{blue}{-19.6}, H, v \cdot v\right)}}}}\right) \]
          4. Applied rewrites99.6%

            \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(-19.6, H, v \cdot v\right)}}}}}\right) \]
          5. Taylor expanded in v around 0

            \[\leadsto \color{blue}{\tan^{-1} \left(v \cdot \sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}\right)} \]
          6. Step-by-step derivation
            1. lower-atan.f64N/A

              \[\leadsto \color{blue}{\tan^{-1} \left(v \cdot \sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}\right)} \]
            2. *-commutativeN/A

              \[\leadsto \tan^{-1} \color{blue}{\left(\sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}} \cdot v\right)} \]
            3. lower-*.f64N/A

              \[\leadsto \tan^{-1} \color{blue}{\left(\sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}} \cdot v\right)} \]
            4. lower-sqrt.f64N/A

              \[\leadsto \tan^{-1} \left(\color{blue}{\sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}} \cdot v\right) \]
            5. lower-/.f64N/A

              \[\leadsto \tan^{-1} \left(\sqrt{\color{blue}{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}} \cdot v\right) \]
            6. *-commutativeN/A

              \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\color{blue}{H \cdot \frac{-98}{5}} + {v}^{2}}} \cdot v\right) \]
            7. lower-fma.f64N/A

              \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(H, \frac{-98}{5}, {v}^{2}\right)}}} \cdot v\right) \]
            8. unpow2N/A

              \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(H, \frac{-98}{5}, \color{blue}{v \cdot v}\right)}} \cdot v\right) \]
            9. lower-*.f6499.6

              \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(H, -19.6, \color{blue}{v \cdot v}\right)}} \cdot v\right) \]
          7. Applied rewrites99.6%

            \[\leadsto \color{blue}{\tan^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(H, -19.6, v \cdot v\right)}} \cdot v\right)} \]
          8. Taylor expanded in v around 0

            \[\leadsto \tan^{-1} \left(\sqrt{\frac{\frac{-5}{98}}{H}} \cdot v\right) \]
          9. Step-by-step derivation
            1. Applied rewrites87.2%

              \[\leadsto \tan^{-1} \left(\sqrt{\frac{-0.05102040816326531}{H}} \cdot v\right) \]

            if 6.2000000000000002e-16 < v

            1. Initial program 54.0%

              \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
            2. Add Preprocessing
            3. Taylor expanded in H around 0

              \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{v + \frac{-49}{5} \cdot \frac{H}{v}}}\right) \]
            4. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{-49}{5} \cdot \frac{H}{v} + v}}\right) \]
              2. associate-*r/N/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{\frac{-49}{5} \cdot H}{v}} + v}\right) \]
              3. associate-*l/N/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{\frac{-49}{5}}{v} \cdot H} + v}\right) \]
              4. metadata-evalN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{\color{blue}{\mathsf{neg}\left(\frac{49}{5}\right)}}{v} \cdot H + v}\right) \]
              5. distribute-neg-fracN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\left(\mathsf{neg}\left(\frac{\frac{49}{5}}{v}\right)\right)} \cdot H + v}\right) \]
              6. metadata-evalN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\left(\mathsf{neg}\left(\frac{\color{blue}{\frac{49}{5} \cdot 1}}{v}\right)\right) \cdot H + v}\right) \]
              7. associate-*r/N/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\left(\mathsf{neg}\left(\color{blue}{\frac{49}{5} \cdot \frac{1}{v}}\right)\right) \cdot H + v}\right) \]
              8. lower-fma.f64N/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{49}{5} \cdot \frac{1}{v}\right), H, v\right)}}\right) \]
              9. associate-*r/N/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\frac{\frac{49}{5} \cdot 1}{v}}\right), H, v\right)}\right) \]
              10. metadata-evalN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{\color{blue}{\frac{49}{5}}}{v}\right), H, v\right)}\right) \]
              11. distribute-neg-fracN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\mathsf{fma}\left(\color{blue}{\frac{\mathsf{neg}\left(\frac{49}{5}\right)}{v}}, H, v\right)}\right) \]
              12. metadata-evalN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\mathsf{fma}\left(\frac{\color{blue}{\frac{-49}{5}}}{v}, H, v\right)}\right) \]
              13. lower-/.f6489.4

                \[\leadsto \tan^{-1} \left(\frac{v}{\mathsf{fma}\left(\color{blue}{\frac{-9.8}{v}}, H, v\right)}\right) \]
            5. Applied rewrites89.4%

              \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\mathsf{fma}\left(\frac{-9.8}{v}, H, v\right)}}\right) \]
          10. Recombined 3 regimes into one program.
          11. Add Preprocessing

          Alternative 3: 88.6% accurate, 1.0× speedup?

          \[\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} \]
          (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}
          
          Derivation
          1. Split input into 3 regimes
          2. if v < -6.0000000000000003e-12

            1. Initial program 54.4%

              \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \tan^{-1} \color{blue}{\left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}\right)} \]
              2. frac-2negN/A

                \[\leadsto \tan^{-1} \color{blue}{\left(\frac{\mathsf{neg}\left(v\right)}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}\right)} \]
              3. neg-sub0N/A

                \[\leadsto \tan^{-1} \left(\frac{\color{blue}{0 - v}}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}\right) \]
              4. div-subN/A

                \[\leadsto \tan^{-1} \color{blue}{\left(\frac{0}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)} - \frac{v}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}\right)} \]
              5. frac-subN/A

                \[\leadsto \tan^{-1} \color{blue}{\left(\frac{0 \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) - \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot v}{\left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right)}\right)} \]
              6. sqr-negN/A

                \[\leadsto \tan^{-1} \left(\frac{0 \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) - \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot v}{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right)\right)\right)}}\right) \]
              7. remove-double-negN/A

                \[\leadsto \tan^{-1} \left(\frac{0 \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) - \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot v}{\color{blue}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}} \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right)\right)\right)}\right) \]
              8. remove-double-negN/A

                \[\leadsto \tan^{-1} \left(\frac{0 \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) - \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot v}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H} \cdot \color{blue}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}\right) \]
              9. lift-sqrt.f64N/A

                \[\leadsto \tan^{-1} \left(\frac{0 \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) - \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot v}{\color{blue}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}} \cdot \sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}\right) \]
              10. lift-sqrt.f64N/A

                \[\leadsto \tan^{-1} \left(\frac{0 \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) - \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot v}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H} \cdot \color{blue}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}\right) \]
              11. rem-square-sqrtN/A

                \[\leadsto \tan^{-1} \left(\frac{0 \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) - \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot v}{\color{blue}{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}\right) \]
            4. Applied rewrites52.9%

              \[\leadsto \tan^{-1} \color{blue}{\left(\frac{0 \cdot \left(-\sqrt{\mathsf{fma}\left(-19.6, H, v \cdot v\right)}\right) - \left(-\sqrt{\mathsf{fma}\left(-19.6, H, v \cdot v\right)}\right) \cdot v}{\mathsf{fma}\left(-19.6, H, v \cdot v\right)}\right)} \]
            5. Taylor expanded in v around -inf

              \[\leadsto \tan^{-1} \color{blue}{\left(\frac{-49}{5} \cdot \frac{H}{{v}^{2}} - 1\right)} \]
            6. Step-by-step derivation
              1. sub-negN/A

                \[\leadsto \tan^{-1} \color{blue}{\left(\frac{-49}{5} \cdot \frac{H}{{v}^{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)} \]
              2. associate-*r/N/A

                \[\leadsto \tan^{-1} \left(\color{blue}{\frac{\frac{-49}{5} \cdot H}{{v}^{2}}} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
              3. unpow2N/A

                \[\leadsto \tan^{-1} \left(\frac{\frac{-49}{5} \cdot H}{\color{blue}{v \cdot v}} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
              4. times-fracN/A

                \[\leadsto \tan^{-1} \left(\color{blue}{\frac{\frac{-49}{5}}{v} \cdot \frac{H}{v}} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
              5. metadata-evalN/A

                \[\leadsto \tan^{-1} \left(\frac{\color{blue}{\mathsf{neg}\left(\frac{49}{5}\right)}}{v} \cdot \frac{H}{v} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
              6. distribute-neg-fracN/A

                \[\leadsto \tan^{-1} \left(\color{blue}{\left(\mathsf{neg}\left(\frac{\frac{49}{5}}{v}\right)\right)} \cdot \frac{H}{v} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
              7. metadata-evalN/A

                \[\leadsto \tan^{-1} \left(\left(\mathsf{neg}\left(\frac{\color{blue}{\frac{49}{5} \cdot 1}}{v}\right)\right) \cdot \frac{H}{v} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
              8. associate-*r/N/A

                \[\leadsto \tan^{-1} \left(\left(\mathsf{neg}\left(\color{blue}{\frac{49}{5} \cdot \frac{1}{v}}\right)\right) \cdot \frac{H}{v} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
              9. metadata-evalN/A

                \[\leadsto \tan^{-1} \left(\left(\mathsf{neg}\left(\frac{49}{5} \cdot \frac{1}{v}\right)\right) \cdot \frac{H}{v} + \color{blue}{-1}\right) \]
              10. lower-fma.f64N/A

                \[\leadsto \tan^{-1} \color{blue}{\left(\mathsf{fma}\left(\mathsf{neg}\left(\frac{49}{5} \cdot \frac{1}{v}\right), \frac{H}{v}, -1\right)\right)} \]
              11. associate-*r/N/A

                \[\leadsto \tan^{-1} \left(\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\frac{\frac{49}{5} \cdot 1}{v}}\right), \frac{H}{v}, -1\right)\right) \]
              12. metadata-evalN/A

                \[\leadsto \tan^{-1} \left(\mathsf{fma}\left(\mathsf{neg}\left(\frac{\color{blue}{\frac{49}{5}}}{v}\right), \frac{H}{v}, -1\right)\right) \]
              13. distribute-neg-fracN/A

                \[\leadsto \tan^{-1} \left(\mathsf{fma}\left(\color{blue}{\frac{\mathsf{neg}\left(\frac{49}{5}\right)}{v}}, \frac{H}{v}, -1\right)\right) \]
              14. metadata-evalN/A

                \[\leadsto \tan^{-1} \left(\mathsf{fma}\left(\frac{\color{blue}{\frac{-49}{5}}}{v}, \frac{H}{v}, -1\right)\right) \]
              15. lower-/.f64N/A

                \[\leadsto \tan^{-1} \left(\mathsf{fma}\left(\color{blue}{\frac{\frac{-49}{5}}{v}}, \frac{H}{v}, -1\right)\right) \]
              16. lower-/.f6492.3

                \[\leadsto \tan^{-1} \left(\mathsf{fma}\left(\frac{-9.8}{v}, \color{blue}{\frac{H}{v}}, -1\right)\right) \]
            7. Applied rewrites92.3%

              \[\leadsto \tan^{-1} \color{blue}{\left(\mathsf{fma}\left(\frac{-9.8}{v}, \frac{H}{v}, -1\right)\right)} \]

            if -6.0000000000000003e-12 < v < 6.2000000000000002e-16

            1. Initial program 99.7%

              \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. /-rgt-identityN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}{1}}}\right) \]
              2. clear-numN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{1}{\frac{1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}}}\right) \]
              3. frac-2negN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{\mathsf{neg}\left(1\right)}{\mathsf{neg}\left(\frac{1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}\right)}}}\right) \]
              4. metadata-evalN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{\color{blue}{-1}}{\mathsf{neg}\left(\frac{1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}\right)}}\right) \]
              5. distribute-frac-neg2N/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\color{blue}{\frac{1}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}}}}\right) \]
              6. lower-/.f64N/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{-1}{\frac{1}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}}}}\right) \]
              7. metadata-evalN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{\color{blue}{\mathsf{neg}\left(-1\right)}}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}}}\right) \]
              8. frac-2negN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\color{blue}{\frac{-1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}}}\right) \]
              9. lower-/.f6499.6

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\color{blue}{\frac{-1}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}}}}\right) \]
              10. lift--.f64N/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}}}\right) \]
              11. sub-negN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{v \cdot v + \left(\mathsf{neg}\left(\left(2 \cdot \frac{49}{5}\right) \cdot H\right)\right)}}}}}\right) \]
              12. +-commutativeN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(2 \cdot \frac{49}{5}\right) \cdot H\right)\right) + v \cdot v}}}}}\right) \]
              13. lift-*.f64N/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\left(\mathsf{neg}\left(\color{blue}{\left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) + v \cdot v}}}}\right) \]
              14. distribute-lft-neg-inN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{\left(\mathsf{neg}\left(2 \cdot \frac{49}{5}\right)\right) \cdot H} + v \cdot v}}}}\right) \]
              15. lower-fma.f64N/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(2 \cdot \frac{49}{5}\right), H, v \cdot v\right)}}}}}\right) \]
              16. lift-*.f64N/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{2 \cdot \frac{49}{5}}\right), H, v \cdot v\right)}}}}\right) \]
              17. metadata-evalN/A

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\frac{98}{5}}\right), H, v \cdot v\right)}}}}\right) \]
              18. metadata-eval99.6

                \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(\color{blue}{-19.6}, H, v \cdot v\right)}}}}\right) \]
            4. Applied rewrites99.6%

              \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(-19.6, H, v \cdot v\right)}}}}}\right) \]
            5. Taylor expanded in v around 0

              \[\leadsto \color{blue}{\tan^{-1} \left(v \cdot \sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}\right)} \]
            6. Step-by-step derivation
              1. lower-atan.f64N/A

                \[\leadsto \color{blue}{\tan^{-1} \left(v \cdot \sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}\right)} \]
              2. *-commutativeN/A

                \[\leadsto \tan^{-1} \color{blue}{\left(\sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}} \cdot v\right)} \]
              3. lower-*.f64N/A

                \[\leadsto \tan^{-1} \color{blue}{\left(\sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}} \cdot v\right)} \]
              4. lower-sqrt.f64N/A

                \[\leadsto \tan^{-1} \left(\color{blue}{\sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}} \cdot v\right) \]
              5. lower-/.f64N/A

                \[\leadsto \tan^{-1} \left(\sqrt{\color{blue}{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}} \cdot v\right) \]
              6. *-commutativeN/A

                \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\color{blue}{H \cdot \frac{-98}{5}} + {v}^{2}}} \cdot v\right) \]
              7. lower-fma.f64N/A

                \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(H, \frac{-98}{5}, {v}^{2}\right)}}} \cdot v\right) \]
              8. unpow2N/A

                \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(H, \frac{-98}{5}, \color{blue}{v \cdot v}\right)}} \cdot v\right) \]
              9. lower-*.f6499.6

                \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(H, -19.6, \color{blue}{v \cdot v}\right)}} \cdot v\right) \]
            7. Applied rewrites99.6%

              \[\leadsto \color{blue}{\tan^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(H, -19.6, v \cdot v\right)}} \cdot v\right)} \]
            8. Taylor expanded in v around 0

              \[\leadsto \tan^{-1} \left(\sqrt{\frac{\frac{-5}{98}}{H}} \cdot v\right) \]
            9. Step-by-step derivation
              1. Applied rewrites87.2%

                \[\leadsto \tan^{-1} \left(\sqrt{\frac{-0.05102040816326531}{H}} \cdot v\right) \]

              if 6.2000000000000002e-16 < v

              1. Initial program 54.0%

                \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
              2. Add Preprocessing
              3. Taylor expanded in H around 0

                \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{v + \frac{-49}{5} \cdot \frac{H}{v}}}\right) \]
              4. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{-49}{5} \cdot \frac{H}{v} + v}}\right) \]
                2. associate-*r/N/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{\frac{-49}{5} \cdot H}{v}} + v}\right) \]
                3. associate-*l/N/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{\frac{-49}{5}}{v} \cdot H} + v}\right) \]
                4. metadata-evalN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{\color{blue}{\mathsf{neg}\left(\frac{49}{5}\right)}}{v} \cdot H + v}\right) \]
                5. distribute-neg-fracN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\left(\mathsf{neg}\left(\frac{\frac{49}{5}}{v}\right)\right)} \cdot H + v}\right) \]
                6. metadata-evalN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\left(\mathsf{neg}\left(\frac{\color{blue}{\frac{49}{5} \cdot 1}}{v}\right)\right) \cdot H + v}\right) \]
                7. associate-*r/N/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\left(\mathsf{neg}\left(\color{blue}{\frac{49}{5} \cdot \frac{1}{v}}\right)\right) \cdot H + v}\right) \]
                8. lower-fma.f64N/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{49}{5} \cdot \frac{1}{v}\right), H, v\right)}}\right) \]
                9. associate-*r/N/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\frac{\frac{49}{5} \cdot 1}{v}}\right), H, v\right)}\right) \]
                10. metadata-evalN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{\color{blue}{\frac{49}{5}}}{v}\right), H, v\right)}\right) \]
                11. distribute-neg-fracN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\mathsf{fma}\left(\color{blue}{\frac{\mathsf{neg}\left(\frac{49}{5}\right)}{v}}, H, v\right)}\right) \]
                12. metadata-evalN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\mathsf{fma}\left(\frac{\color{blue}{\frac{-49}{5}}}{v}, H, v\right)}\right) \]
                13. lower-/.f6489.4

                  \[\leadsto \tan^{-1} \left(\frac{v}{\mathsf{fma}\left(\color{blue}{\frac{-9.8}{v}}, H, v\right)}\right) \]
              5. Applied rewrites89.4%

                \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\mathsf{fma}\left(\frac{-9.8}{v}, H, v\right)}}\right) \]
            10. Recombined 3 regimes into one program.
            11. Add Preprocessing

            Alternative 4: 88.5% accurate, 1.0× speedup?

            \[\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} \]
            (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}
            
            Derivation
            1. Split input into 3 regimes
            2. if v < -6.0000000000000003e-12

              1. Initial program 54.4%

                \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-/.f64N/A

                  \[\leadsto \tan^{-1} \color{blue}{\left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}\right)} \]
                2. frac-2negN/A

                  \[\leadsto \tan^{-1} \color{blue}{\left(\frac{\mathsf{neg}\left(v\right)}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}\right)} \]
                3. neg-sub0N/A

                  \[\leadsto \tan^{-1} \left(\frac{\color{blue}{0 - v}}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}\right) \]
                4. div-subN/A

                  \[\leadsto \tan^{-1} \color{blue}{\left(\frac{0}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)} - \frac{v}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}\right)} \]
                5. frac-subN/A

                  \[\leadsto \tan^{-1} \color{blue}{\left(\frac{0 \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) - \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot v}{\left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right)}\right)} \]
                6. sqr-negN/A

                  \[\leadsto \tan^{-1} \left(\frac{0 \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) - \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot v}{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right)\right)\right)}}\right) \]
                7. remove-double-negN/A

                  \[\leadsto \tan^{-1} \left(\frac{0 \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) - \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot v}{\color{blue}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}} \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right)\right)\right)}\right) \]
                8. remove-double-negN/A

                  \[\leadsto \tan^{-1} \left(\frac{0 \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) - \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot v}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H} \cdot \color{blue}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}\right) \]
                9. lift-sqrt.f64N/A

                  \[\leadsto \tan^{-1} \left(\frac{0 \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) - \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot v}{\color{blue}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}} \cdot \sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}\right) \]
                10. lift-sqrt.f64N/A

                  \[\leadsto \tan^{-1} \left(\frac{0 \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) - \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot v}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H} \cdot \color{blue}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}\right) \]
                11. rem-square-sqrtN/A

                  \[\leadsto \tan^{-1} \left(\frac{0 \cdot \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) - \left(\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) \cdot v}{\color{blue}{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}\right) \]
              4. Applied rewrites52.9%

                \[\leadsto \tan^{-1} \color{blue}{\left(\frac{0 \cdot \left(-\sqrt{\mathsf{fma}\left(-19.6, H, v \cdot v\right)}\right) - \left(-\sqrt{\mathsf{fma}\left(-19.6, H, v \cdot v\right)}\right) \cdot v}{\mathsf{fma}\left(-19.6, H, v \cdot v\right)}\right)} \]
              5. Taylor expanded in v around -inf

                \[\leadsto \tan^{-1} \color{blue}{\left(\frac{-49}{5} \cdot \frac{H}{{v}^{2}} - 1\right)} \]
              6. Step-by-step derivation
                1. sub-negN/A

                  \[\leadsto \tan^{-1} \color{blue}{\left(\frac{-49}{5} \cdot \frac{H}{{v}^{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)} \]
                2. associate-*r/N/A

                  \[\leadsto \tan^{-1} \left(\color{blue}{\frac{\frac{-49}{5} \cdot H}{{v}^{2}}} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
                3. unpow2N/A

                  \[\leadsto \tan^{-1} \left(\frac{\frac{-49}{5} \cdot H}{\color{blue}{v \cdot v}} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
                4. times-fracN/A

                  \[\leadsto \tan^{-1} \left(\color{blue}{\frac{\frac{-49}{5}}{v} \cdot \frac{H}{v}} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
                5. metadata-evalN/A

                  \[\leadsto \tan^{-1} \left(\frac{\color{blue}{\mathsf{neg}\left(\frac{49}{5}\right)}}{v} \cdot \frac{H}{v} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
                6. distribute-neg-fracN/A

                  \[\leadsto \tan^{-1} \left(\color{blue}{\left(\mathsf{neg}\left(\frac{\frac{49}{5}}{v}\right)\right)} \cdot \frac{H}{v} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
                7. metadata-evalN/A

                  \[\leadsto \tan^{-1} \left(\left(\mathsf{neg}\left(\frac{\color{blue}{\frac{49}{5} \cdot 1}}{v}\right)\right) \cdot \frac{H}{v} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
                8. associate-*r/N/A

                  \[\leadsto \tan^{-1} \left(\left(\mathsf{neg}\left(\color{blue}{\frac{49}{5} \cdot \frac{1}{v}}\right)\right) \cdot \frac{H}{v} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
                9. metadata-evalN/A

                  \[\leadsto \tan^{-1} \left(\left(\mathsf{neg}\left(\frac{49}{5} \cdot \frac{1}{v}\right)\right) \cdot \frac{H}{v} + \color{blue}{-1}\right) \]
                10. lower-fma.f64N/A

                  \[\leadsto \tan^{-1} \color{blue}{\left(\mathsf{fma}\left(\mathsf{neg}\left(\frac{49}{5} \cdot \frac{1}{v}\right), \frac{H}{v}, -1\right)\right)} \]
                11. associate-*r/N/A

                  \[\leadsto \tan^{-1} \left(\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\frac{\frac{49}{5} \cdot 1}{v}}\right), \frac{H}{v}, -1\right)\right) \]
                12. metadata-evalN/A

                  \[\leadsto \tan^{-1} \left(\mathsf{fma}\left(\mathsf{neg}\left(\frac{\color{blue}{\frac{49}{5}}}{v}\right), \frac{H}{v}, -1\right)\right) \]
                13. distribute-neg-fracN/A

                  \[\leadsto \tan^{-1} \left(\mathsf{fma}\left(\color{blue}{\frac{\mathsf{neg}\left(\frac{49}{5}\right)}{v}}, \frac{H}{v}, -1\right)\right) \]
                14. metadata-evalN/A

                  \[\leadsto \tan^{-1} \left(\mathsf{fma}\left(\frac{\color{blue}{\frac{-49}{5}}}{v}, \frac{H}{v}, -1\right)\right) \]
                15. lower-/.f64N/A

                  \[\leadsto \tan^{-1} \left(\mathsf{fma}\left(\color{blue}{\frac{\frac{-49}{5}}{v}}, \frac{H}{v}, -1\right)\right) \]
                16. lower-/.f6492.3

                  \[\leadsto \tan^{-1} \left(\mathsf{fma}\left(\frac{-9.8}{v}, \color{blue}{\frac{H}{v}}, -1\right)\right) \]
              7. Applied rewrites92.3%

                \[\leadsto \tan^{-1} \color{blue}{\left(\mathsf{fma}\left(\frac{-9.8}{v}, \frac{H}{v}, -1\right)\right)} \]

              if -6.0000000000000003e-12 < v < 6.2000000000000002e-16

              1. Initial program 99.7%

                \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. /-rgt-identityN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}{1}}}\right) \]
                2. clear-numN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{1}{\frac{1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}}}\right) \]
                3. frac-2negN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{\mathsf{neg}\left(1\right)}{\mathsf{neg}\left(\frac{1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}\right)}}}\right) \]
                4. metadata-evalN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{\color{blue}{-1}}{\mathsf{neg}\left(\frac{1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}\right)}}\right) \]
                5. distribute-frac-neg2N/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\color{blue}{\frac{1}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}}}}\right) \]
                6. lower-/.f64N/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{-1}{\frac{1}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}}}}\right) \]
                7. metadata-evalN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{\color{blue}{\mathsf{neg}\left(-1\right)}}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}}}\right) \]
                8. frac-2negN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\color{blue}{\frac{-1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}}}\right) \]
                9. lower-/.f6499.6

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\color{blue}{\frac{-1}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}}}}\right) \]
                10. lift--.f64N/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}}}\right) \]
                11. sub-negN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{v \cdot v + \left(\mathsf{neg}\left(\left(2 \cdot \frac{49}{5}\right) \cdot H\right)\right)}}}}}\right) \]
                12. +-commutativeN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(2 \cdot \frac{49}{5}\right) \cdot H\right)\right) + v \cdot v}}}}}\right) \]
                13. lift-*.f64N/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\left(\mathsf{neg}\left(\color{blue}{\left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) + v \cdot v}}}}\right) \]
                14. distribute-lft-neg-inN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{\left(\mathsf{neg}\left(2 \cdot \frac{49}{5}\right)\right) \cdot H} + v \cdot v}}}}\right) \]
                15. lower-fma.f64N/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(2 \cdot \frac{49}{5}\right), H, v \cdot v\right)}}}}}\right) \]
                16. lift-*.f64N/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{2 \cdot \frac{49}{5}}\right), H, v \cdot v\right)}}}}\right) \]
                17. metadata-evalN/A

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\frac{98}{5}}\right), H, v \cdot v\right)}}}}\right) \]
                18. metadata-eval99.6

                  \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(\color{blue}{-19.6}, H, v \cdot v\right)}}}}\right) \]
              4. Applied rewrites99.6%

                \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(-19.6, H, v \cdot v\right)}}}}}\right) \]
              5. Taylor expanded in v around 0

                \[\leadsto \color{blue}{\tan^{-1} \left(v \cdot \sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}\right)} \]
              6. Step-by-step derivation
                1. lower-atan.f64N/A

                  \[\leadsto \color{blue}{\tan^{-1} \left(v \cdot \sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}\right)} \]
                2. *-commutativeN/A

                  \[\leadsto \tan^{-1} \color{blue}{\left(\sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}} \cdot v\right)} \]
                3. lower-*.f64N/A

                  \[\leadsto \tan^{-1} \color{blue}{\left(\sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}} \cdot v\right)} \]
                4. lower-sqrt.f64N/A

                  \[\leadsto \tan^{-1} \left(\color{blue}{\sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}} \cdot v\right) \]
                5. lower-/.f64N/A

                  \[\leadsto \tan^{-1} \left(\sqrt{\color{blue}{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}} \cdot v\right) \]
                6. *-commutativeN/A

                  \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\color{blue}{H \cdot \frac{-98}{5}} + {v}^{2}}} \cdot v\right) \]
                7. lower-fma.f64N/A

                  \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(H, \frac{-98}{5}, {v}^{2}\right)}}} \cdot v\right) \]
                8. unpow2N/A

                  \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(H, \frac{-98}{5}, \color{blue}{v \cdot v}\right)}} \cdot v\right) \]
                9. lower-*.f6499.6

                  \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(H, -19.6, \color{blue}{v \cdot v}\right)}} \cdot v\right) \]
              7. Applied rewrites99.6%

                \[\leadsto \color{blue}{\tan^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(H, -19.6, v \cdot v\right)}} \cdot v\right)} \]
              8. Taylor expanded in v around 0

                \[\leadsto \tan^{-1} \left(\sqrt{\frac{\frac{-5}{98}}{H}} \cdot v\right) \]
              9. Step-by-step derivation
                1. Applied rewrites87.2%

                  \[\leadsto \tan^{-1} \left(\sqrt{\frac{-0.05102040816326531}{H}} \cdot v\right) \]

                if 6.2000000000000002e-16 < v

                1. Initial program 54.0%

                  \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
                2. Add Preprocessing
                3. Taylor expanded in v around inf

                  \[\leadsto \tan^{-1} \color{blue}{1} \]
                4. Step-by-step derivation
                  1. Applied rewrites89.2%

                    \[\leadsto \tan^{-1} \color{blue}{1} \]
                5. Recombined 3 regimes into one program.
                6. Add Preprocessing

                Alternative 5: 88.6% accurate, 1.0× speedup?

                \[\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} \]
                (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}
                
                Derivation
                1. Split input into 3 regimes
                2. if v < -6.0000000000000003e-12

                  1. Initial program 54.4%

                    \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in v around -inf

                    \[\leadsto \tan^{-1} \color{blue}{-1} \]
                  4. Step-by-step derivation
                    1. Applied rewrites92.1%

                      \[\leadsto \tan^{-1} \color{blue}{-1} \]

                    if -6.0000000000000003e-12 < v < 6.2000000000000002e-16

                    1. Initial program 99.7%

                      \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. /-rgt-identityN/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}{1}}}\right) \]
                      2. clear-numN/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{1}{\frac{1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}}}\right) \]
                      3. frac-2negN/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{\mathsf{neg}\left(1\right)}{\mathsf{neg}\left(\frac{1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}\right)}}}\right) \]
                      4. metadata-evalN/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\frac{\color{blue}{-1}}{\mathsf{neg}\left(\frac{1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}\right)}}\right) \]
                      5. distribute-frac-neg2N/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\color{blue}{\frac{1}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}}}}\right) \]
                      6. lower-/.f64N/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{-1}{\frac{1}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}}}}\right) \]
                      7. metadata-evalN/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{\color{blue}{\mathsf{neg}\left(-1\right)}}{\mathsf{neg}\left(\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}\right)}}}\right) \]
                      8. frac-2negN/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\color{blue}{\frac{-1}{\sqrt{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}}}\right) \]
                      9. lower-/.f6499.6

                        \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\color{blue}{\frac{-1}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}}}}\right) \]
                      10. lift--.f64N/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{v \cdot v - \left(2 \cdot \frac{49}{5}\right) \cdot H}}}}}\right) \]
                      11. sub-negN/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{v \cdot v + \left(\mathsf{neg}\left(\left(2 \cdot \frac{49}{5}\right) \cdot H\right)\right)}}}}}\right) \]
                      12. +-commutativeN/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{\left(\mathsf{neg}\left(\left(2 \cdot \frac{49}{5}\right) \cdot H\right)\right) + v \cdot v}}}}}\right) \]
                      13. lift-*.f64N/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\left(\mathsf{neg}\left(\color{blue}{\left(2 \cdot \frac{49}{5}\right) \cdot H}\right)\right) + v \cdot v}}}}\right) \]
                      14. distribute-lft-neg-inN/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{\left(\mathsf{neg}\left(2 \cdot \frac{49}{5}\right)\right) \cdot H} + v \cdot v}}}}\right) \]
                      15. lower-fma.f64N/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(2 \cdot \frac{49}{5}\right), H, v \cdot v\right)}}}}}\right) \]
                      16. lift-*.f64N/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{2 \cdot \frac{49}{5}}\right), H, v \cdot v\right)}}}}\right) \]
                      17. metadata-evalN/A

                        \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\frac{98}{5}}\right), H, v \cdot v\right)}}}}\right) \]
                      18. metadata-eval99.6

                        \[\leadsto \tan^{-1} \left(\frac{v}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(\color{blue}{-19.6}, H, v \cdot v\right)}}}}\right) \]
                    4. Applied rewrites99.6%

                      \[\leadsto \tan^{-1} \left(\frac{v}{\color{blue}{\frac{-1}{\frac{-1}{\sqrt{\mathsf{fma}\left(-19.6, H, v \cdot v\right)}}}}}\right) \]
                    5. Taylor expanded in v around 0

                      \[\leadsto \color{blue}{\tan^{-1} \left(v \cdot \sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}\right)} \]
                    6. Step-by-step derivation
                      1. lower-atan.f64N/A

                        \[\leadsto \color{blue}{\tan^{-1} \left(v \cdot \sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}\right)} \]
                      2. *-commutativeN/A

                        \[\leadsto \tan^{-1} \color{blue}{\left(\sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}} \cdot v\right)} \]
                      3. lower-*.f64N/A

                        \[\leadsto \tan^{-1} \color{blue}{\left(\sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}} \cdot v\right)} \]
                      4. lower-sqrt.f64N/A

                        \[\leadsto \tan^{-1} \left(\color{blue}{\sqrt{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}} \cdot v\right) \]
                      5. lower-/.f64N/A

                        \[\leadsto \tan^{-1} \left(\sqrt{\color{blue}{\frac{1}{\frac{-98}{5} \cdot H + {v}^{2}}}} \cdot v\right) \]
                      6. *-commutativeN/A

                        \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\color{blue}{H \cdot \frac{-98}{5}} + {v}^{2}}} \cdot v\right) \]
                      7. lower-fma.f64N/A

                        \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(H, \frac{-98}{5}, {v}^{2}\right)}}} \cdot v\right) \]
                      8. unpow2N/A

                        \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(H, \frac{-98}{5}, \color{blue}{v \cdot v}\right)}} \cdot v\right) \]
                      9. lower-*.f6499.6

                        \[\leadsto \tan^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(H, -19.6, \color{blue}{v \cdot v}\right)}} \cdot v\right) \]
                    7. Applied rewrites99.6%

                      \[\leadsto \color{blue}{\tan^{-1} \left(\sqrt{\frac{1}{\mathsf{fma}\left(H, -19.6, v \cdot v\right)}} \cdot v\right)} \]
                    8. Taylor expanded in v around 0

                      \[\leadsto \tan^{-1} \left(\sqrt{\frac{\frac{-5}{98}}{H}} \cdot v\right) \]
                    9. Step-by-step derivation
                      1. Applied rewrites87.2%

                        \[\leadsto \tan^{-1} \left(\sqrt{\frac{-0.05102040816326531}{H}} \cdot v\right) \]

                      if 6.2000000000000002e-16 < v

                      1. Initial program 54.0%

                        \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
                      2. Add Preprocessing
                      3. Taylor expanded in v around inf

                        \[\leadsto \tan^{-1} \color{blue}{1} \]
                      4. Step-by-step derivation
                        1. Applied rewrites89.2%

                          \[\leadsto \tan^{-1} \color{blue}{1} \]
                      5. Recombined 3 regimes into one program.
                      6. Add Preprocessing

                      Alternative 6: 67.9% accurate, 1.3× speedup?

                      \[\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} \]
                      (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}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if v < -3.79999999999999975e-308

                        1. Initial program 69.1%

                          \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in v around -inf

                          \[\leadsto \tan^{-1} \color{blue}{-1} \]
                        4. Step-by-step derivation
                          1. Applied rewrites66.8%

                            \[\leadsto \tan^{-1} \color{blue}{-1} \]

                          if -3.79999999999999975e-308 < v

                          1. Initial program 72.3%

                            \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
                          2. Add Preprocessing
                          3. Taylor expanded in v around inf

                            \[\leadsto \tan^{-1} \color{blue}{1} \]
                          4. Step-by-step derivation
                            1. Applied rewrites60.9%

                              \[\leadsto \tan^{-1} \color{blue}{1} \]
                          5. Recombined 2 regimes into one program.
                          6. Add Preprocessing

                          Alternative 7: 35.0% accurate, 1.4× speedup?

                          \[\begin{array}{l} \\ \tan^{-1} -1 \end{array} \]
                          (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}
                          
                          Derivation
                          1. Initial program 70.7%

                            \[\tan^{-1} \left(\frac{v}{\sqrt{v \cdot v - \left(2 \cdot 9.8\right) \cdot H}}\right) \]
                          2. Add Preprocessing
                          3. Taylor expanded in v around -inf

                            \[\leadsto \tan^{-1} \color{blue}{-1} \]
                          4. Step-by-step derivation
                            1. Applied rewrites33.8%

                              \[\leadsto \tan^{-1} \color{blue}{-1} \]
                            2. Add Preprocessing

                            Reproduce

                            ?
                            herbie shell --seed 2024284 
                            (FPCore (v H)
                              :name "Optimal throwing angle"
                              :precision binary64
                              (atan (/ v (sqrt (- (* v v) (* (* 2.0 9.8) H))))))