ABCF->ab-angle angle

Percentage Accurate: 52.8% → 80.6%
Time: 6.6s
Alternatives: 17
Speedup: 2.5×

Specification

?
\[\begin{array}{l} \\ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (*
  180.0
  (/
   (atan (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
   (PI))))
\begin{array}{l}

\\
180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\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 17 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: 52.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (*
  180.0
  (/
   (atan (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
   (PI))))
\begin{array}{l}

\\
180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}
\end{array}

Alternative 1: 80.6% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;C \leq 1.05 \cdot 10^{+160}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (if (<= C 1.05e+160)
   (* 180.0 (/ (atan (/ (- (- C A) (hypot (- A C) B)) B)) (PI)))
   (/ (* 180.0 (atan (fma (/ B C) -0.5 (/ (* 0.0 A) B)))) (PI))))
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;C \leq 1.05 \cdot 10^{+160}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if C < 1.04999999999999998e160

    1. Initial program 62.2%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in A around 0

      \[\leadsto 180 \cdot \frac{\color{blue}{\tan^{-1} \left(\frac{C - \left(A + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. lower-atan.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \left(A + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
      2. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. +-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      6. lift--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      7. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{\left(A - C\right) \cdot \left(A - C\right) + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      8. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{\left(A - C\right) \cdot \left(A - C\right) + B \cdot B}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      9. lower-hypot.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
      10. lift--.f6486.8

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites86.8%

      \[\leadsto 180 \cdot \frac{\color{blue}{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right)}}{\mathsf{PI}\left(\right)} \]

    if 1.04999999999999998e160 < C

    1. Initial program 9.3%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}} \]
      2. lift-PI.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\color{blue}{\mathsf{PI}\left(\right)}} \]
      3. lift-/.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}} \]
    4. Applied rewrites40.8%

      \[\leadsto \color{blue}{\frac{180 \cdot \tan^{-1} \left(\left(\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot {B}^{-1}\right)}{\mathsf{PI}\left(\right)}} \]
    5. Taylor expanded in C around inf

      \[\leadsto \frac{180 \cdot \tan^{-1} \color{blue}{\left(-1 \cdot \frac{A + -1 \cdot A}{B} + \frac{-1}{2} \cdot \frac{B}{C}\right)}}{\mathsf{PI}\left(\right)} \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C} + \color{blue}{-1 \cdot \frac{A + -1 \cdot A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      2. *-commutativeN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{B}{C} \cdot \frac{-1}{2} + \color{blue}{-1} \cdot \frac{A + -1 \cdot A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \color{blue}{\frac{-1}{2}}, -1 \cdot \frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -1 \cdot \frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      5. mul-1-negN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, \mathsf{neg}\left(\frac{A + -1 \cdot A}{B}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
      6. lower-neg.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      7. lower-/.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      8. distribute-rgt1-inN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{\left(-1 + 1\right) \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      9. metadata-evalN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      10. lower-*.f6483.8

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, -\frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
    7. Applied rewrites83.8%

      \[\leadsto \frac{180 \cdot \tan^{-1} \color{blue}{\left(\mathsf{fma}\left(\frac{B}{C}, -0.5, -\frac{0 \cdot A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;C \leq 1.05 \cdot 10^{+160}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 72.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{if}\;t\_0 \leq -0.005:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (let* ((t_0
         (*
          180.0
          (/
           (atan
            (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
           (PI)))))
   (if (<= t_0 -0.005)
     (* 180.0 (/ (atan (/ (- (fma -1.0 B C) A) B)) (PI)))
     (if (<= t_0 0.0)
       (/ (* 180.0 (atan (fma (/ B C) -0.5 (/ (* 0.0 A) B)))) (PI))
       (* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI)))))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -0.005:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0050000000000000001

    1. Initial program 56.0%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. lower-/.f6477.7

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites77.7%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    6. Taylor expanded in B around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C + -1 \cdot B\right) - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C + -1 \cdot B\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C + -1 \cdot B\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C + \left(\mathsf{neg}\left(B\right)\right)\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. +-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(\left(\mathsf{neg}\left(B\right)\right) + C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(-1 \cdot B + C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      6. lower-fma.f6478.5

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
    8. Applied rewrites78.5%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]

    if -0.0050000000000000001 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0

    1. Initial program 20.5%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}} \]
      2. lift-PI.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\color{blue}{\mathsf{PI}\left(\right)}} \]
      3. lift-/.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}} \]
    4. Applied rewrites24.5%

      \[\leadsto \color{blue}{\frac{180 \cdot \tan^{-1} \left(\left(\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot {B}^{-1}\right)}{\mathsf{PI}\left(\right)}} \]
    5. Taylor expanded in C around inf

      \[\leadsto \frac{180 \cdot \tan^{-1} \color{blue}{\left(-1 \cdot \frac{A + -1 \cdot A}{B} + \frac{-1}{2} \cdot \frac{B}{C}\right)}}{\mathsf{PI}\left(\right)} \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C} + \color{blue}{-1 \cdot \frac{A + -1 \cdot A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      2. *-commutativeN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{B}{C} \cdot \frac{-1}{2} + \color{blue}{-1} \cdot \frac{A + -1 \cdot A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \color{blue}{\frac{-1}{2}}, -1 \cdot \frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -1 \cdot \frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      5. mul-1-negN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, \mathsf{neg}\left(\frac{A + -1 \cdot A}{B}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
      6. lower-neg.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      7. lower-/.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      8. distribute-rgt1-inN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{\left(-1 + 1\right) \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      9. metadata-evalN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      10. lower-*.f6461.9

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, -\frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
    7. Applied rewrites61.9%

      \[\leadsto \frac{180 \cdot \tan^{-1} \color{blue}{\left(\mathsf{fma}\left(\frac{B}{C}, -0.5, -\frac{0 \cdot A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]

    if -0.0 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64)))

    1. Initial program 65.8%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around -inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(1 + \frac{C}{B}\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \color{blue}{\left(\frac{C}{B} - \frac{A}{B}\right)}\right)}{\mathsf{PI}\left(\right)} \]
      2. div-subN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-+.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \color{blue}{\frac{C - A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      5. lift--.f6484.9

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites84.9%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(1 + \frac{C - A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification79.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \leq -0.005:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \leq 0:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 72.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{if}\;t\_0 \leq -0.005:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (let* ((t_0
         (*
          180.0
          (/
           (atan
            (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
           (PI)))))
   (if (<= t_0 -0.005)
     (* 180.0 (/ (atan (/ (- (fma -1.0 B C) A) B)) (PI)))
     (if (<= t_0 0.0)
       (* 180.0 (/ (atan (fma (/ B C) -0.5 (/ (* 0.0 A) B))) (PI)))
       (* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI)))))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -0.005:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0050000000000000001

    1. Initial program 56.0%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. lower-/.f6477.7

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites77.7%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    6. Taylor expanded in B around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C + -1 \cdot B\right) - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C + -1 \cdot B\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C + -1 \cdot B\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C + \left(\mathsf{neg}\left(B\right)\right)\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. +-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(\left(\mathsf{neg}\left(B\right)\right) + C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(-1 \cdot B + C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      6. lower-fma.f6478.5

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
    8. Applied rewrites78.5%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]

    if -0.0050000000000000001 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0

    1. Initial program 20.5%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in C around inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-1 \cdot \frac{A + -1 \cdot A}{B} + \frac{-1}{2} \cdot \frac{B}{C}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C} + \color{blue}{-1 \cdot \frac{A + -1 \cdot A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      2. *-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{C} \cdot \frac{-1}{2} + \color{blue}{-1} \cdot \frac{A + -1 \cdot A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-fma.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \color{blue}{\frac{-1}{2}}, -1 \cdot \frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -1 \cdot \frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      5. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, \mathsf{neg}\left(\frac{A + -1 \cdot A}{B}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
      6. lower-neg.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      7. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      8. distribute-rgt1-inN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{\left(-1 + 1\right) \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      9. metadata-evalN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      10. lower-*.f6461.7

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, -\frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites61.7%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\mathsf{fma}\left(\frac{B}{C}, -0.5, -\frac{0 \cdot A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]

    if -0.0 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64)))

    1. Initial program 65.8%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around -inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(1 + \frac{C}{B}\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \color{blue}{\left(\frac{C}{B} - \frac{A}{B}\right)}\right)}{\mathsf{PI}\left(\right)} \]
      2. div-subN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-+.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \color{blue}{\frac{C - A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      5. lift--.f6484.9

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites84.9%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(1 + \frac{C - A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification79.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \leq -0.005:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \leq 0:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 72.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{if}\;t\_0 \leq -0.005:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (let* ((t_0
         (*
          180.0
          (/
           (atan
            (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
           (PI)))))
   (if (<= t_0 -0.005)
     (* 180.0 (/ (atan (/ (- (fma -1.0 B C) A) B)) (PI)))
     (if (<= t_0 0.0)
       (* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
       (* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI)))))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -0.005:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0050000000000000001

    1. Initial program 56.0%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. lower-/.f6477.7

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites77.7%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    6. Taylor expanded in B around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C + -1 \cdot B\right) - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C + -1 \cdot B\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C + -1 \cdot B\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C + \left(\mathsf{neg}\left(B\right)\right)\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. +-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(\left(\mathsf{neg}\left(B\right)\right) + C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(-1 \cdot B + C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      6. lower-fma.f6478.5

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
    8. Applied rewrites78.5%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]

    if -0.0050000000000000001 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0

    1. Initial program 20.5%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in A around -inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{B}{A}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot \color{blue}{\frac{1}{2}}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower-*.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot \color{blue}{\frac{1}{2}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-/.f6443.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites43.1%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{B}{A} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]

    if -0.0 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64)))

    1. Initial program 65.8%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around -inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(1 + \frac{C}{B}\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \color{blue}{\left(\frac{C}{B} - \frac{A}{B}\right)}\right)}{\mathsf{PI}\left(\right)} \]
      2. div-subN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-+.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \color{blue}{\frac{C - A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      5. lift--.f6484.9

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites84.9%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(1 + \frac{C - A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification77.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \leq -0.005:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \leq 0:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 72.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\ t_1 := \frac{C - A}{B}\\ \mathbf{if}\;t\_0 \leq -0.005:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(-1 + t\_1\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + t\_1\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (let* ((t_0
         (*
          180.0
          (/
           (atan
            (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
           (PI))))
        (t_1 (/ (- C A) B)))
   (if (<= t_0 -0.005)
     (/ (* 180.0 (atan (+ -1.0 t_1))) (PI))
     (if (<= t_0 0.0)
       (* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
       (* 180.0 (/ (atan (+ 1.0 t_1)) (PI)))))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.005:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(-1 + t\_1\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + t\_1\right)}{\mathsf{PI}\left(\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0050000000000000001

    1. Initial program 56.0%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. lower-/.f6477.7

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites77.7%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}} \]
    7. Applied rewrites77.7%

      \[\leadsto \color{blue}{\frac{180 \cdot \tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}} \]
    8. Taylor expanded in B around 0

      \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{\left(C + -1 \cdot B\right) - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{\left(C + -1 \cdot B\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower--.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{\left(C + -1 \cdot B\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. mul-1-negN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{\left(C + \left(\mathsf{neg}\left(B\right)\right)\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. +-commutativeN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{\left(\left(\mathsf{neg}\left(B\right)\right) + C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. mul-1-negN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{\left(-1 \cdot B + C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      6. lower-fma.f6478.5

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
    10. Applied rewrites78.5%

      \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
    11. Taylor expanded in C around 0

      \[\leadsto \frac{180 \cdot \tan^{-1} \left(\left(-1 + \frac{C}{B}\right) - \frac{A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
    12. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(-1 + \left(\frac{C}{B} - \frac{A}{\color{blue}{B}}\right)\right)}{\mathsf{PI}\left(\right)} \]
      2. div-subN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(-1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-+.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(-1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(-1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. lift--.f6478.5

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(-1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
    13. Applied rewrites78.5%

      \[\leadsto \frac{180 \cdot \tan^{-1} \left(-1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]

    if -0.0050000000000000001 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0

    1. Initial program 20.5%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in A around -inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{B}{A}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot \color{blue}{\frac{1}{2}}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower-*.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot \color{blue}{\frac{1}{2}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-/.f6443.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites43.1%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{B}{A} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]

    if -0.0 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64)))

    1. Initial program 65.8%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around -inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(1 + \frac{C}{B}\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \color{blue}{\left(\frac{C}{B} - \frac{A}{B}\right)}\right)}{\mathsf{PI}\left(\right)} \]
      2. div-subN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-+.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \color{blue}{\frac{C - A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      5. lift--.f6484.9

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites84.9%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(1 + \frac{C - A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification77.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \leq -0.005:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(-1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \leq 0:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 66.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{if}\;t\_0 \leq -0.005:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (let* ((t_0
         (*
          180.0
          (/
           (atan
            (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
           (PI)))))
   (if (<= t_0 -0.005)
     (* 180.0 (/ (atan (- (/ C B) 1.0)) (PI)))
     (if (<= t_0 0.0)
       (* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
       (* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI)))))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -0.005:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0050000000000000001

    1. Initial program 56.0%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. lower-/.f6477.7

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites77.7%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    6. Taylor expanded in A around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - \color{blue}{1}\right)}{\mathsf{PI}\left(\right)} \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)} \]
      2. lift--.f6467.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)} \]
    8. Applied rewrites67.1%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - \color{blue}{1}\right)}{\mathsf{PI}\left(\right)} \]

    if -0.0050000000000000001 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0

    1. Initial program 20.5%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in A around -inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{B}{A}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot \color{blue}{\frac{1}{2}}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower-*.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot \color{blue}{\frac{1}{2}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-/.f6443.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites43.1%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{B}{A} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]

    if -0.0 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64)))

    1. Initial program 65.8%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around -inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(1 + \frac{C}{B}\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \color{blue}{\left(\frac{C}{B} - \frac{A}{B}\right)}\right)}{\mathsf{PI}\left(\right)} \]
      2. div-subN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-+.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \color{blue}{\frac{C - A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      5. lift--.f6484.9

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites84.9%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(1 + \frac{C - A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification72.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \leq -0.005:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \leq 0:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 77.0% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;C \leq -900000:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;C \leq 5.8 \cdot 10^{+159}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{hypot}\left(A, B\right) + A}{-B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (if (<= C -900000.0)
   (* 180.0 (/ (atan (/ (- C (hypot C B)) B)) (PI)))
   (if (<= C 5.8e+159)
     (* 180.0 (/ (atan (/ (+ (hypot A B) A) (- B))) (PI)))
     (/ (* 180.0 (atan (fma (/ B C) -0.5 (/ (* 0.0 A) B)))) (PI)))))
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;C \leq -900000:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{elif}\;C \leq 5.8 \cdot 10^{+159}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{hypot}\left(A, B\right) + A}{-B}\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if C < -9e5

    1. Initial program 78.2%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in A around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C - \sqrt{{B}^{2} + {C}^{2}}}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{{B}^{2} + {C}^{2}}}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{{B}^{2} + {C}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. +-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{{C}^{2} + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{C \cdot C + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{C \cdot C + B \cdot B}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      6. lower-hypot.f6491.5

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites91.5%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}}{\mathsf{PI}\left(\right)} \]

    if -9e5 < C < 5.80000000000000029e159

    1. Initial program 55.7%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in C around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-1 \cdot \frac{A + \sqrt{{A}^{2} + {B}^{2}}}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{neg}\left(\frac{A + \sqrt{{A}^{2} + {B}^{2}}}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      2. lower-neg.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-\frac{A + \sqrt{{A}^{2} + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-\frac{A + \sqrt{{A}^{2} + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. +-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-\frac{\sqrt{{A}^{2} + {B}^{2}} + A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. lower-+.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-\frac{\sqrt{{A}^{2} + {B}^{2}} + A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      6. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-\frac{\sqrt{A \cdot A + {B}^{2}} + A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      7. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-\frac{\sqrt{A \cdot A + B \cdot B} + A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      8. lower-hypot.f6480.4

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-\frac{\mathsf{hypot}\left(A, B\right) + A}{B}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites80.4%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-\frac{\mathsf{hypot}\left(A, B\right) + A}{B}\right)}}{\mathsf{PI}\left(\right)} \]

    if 5.80000000000000029e159 < C

    1. Initial program 9.3%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}} \]
      2. lift-PI.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\color{blue}{\mathsf{PI}\left(\right)}} \]
      3. lift-/.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}} \]
    4. Applied rewrites40.8%

      \[\leadsto \color{blue}{\frac{180 \cdot \tan^{-1} \left(\left(\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot {B}^{-1}\right)}{\mathsf{PI}\left(\right)}} \]
    5. Taylor expanded in C around inf

      \[\leadsto \frac{180 \cdot \tan^{-1} \color{blue}{\left(-1 \cdot \frac{A + -1 \cdot A}{B} + \frac{-1}{2} \cdot \frac{B}{C}\right)}}{\mathsf{PI}\left(\right)} \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C} + \color{blue}{-1 \cdot \frac{A + -1 \cdot A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      2. *-commutativeN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{B}{C} \cdot \frac{-1}{2} + \color{blue}{-1} \cdot \frac{A + -1 \cdot A}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \color{blue}{\frac{-1}{2}}, -1 \cdot \frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -1 \cdot \frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      5. mul-1-negN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, \mathsf{neg}\left(\frac{A + -1 \cdot A}{B}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
      6. lower-neg.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      7. lower-/.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      8. distribute-rgt1-inN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{\left(-1 + 1\right) \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      9. metadata-evalN/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      10. lower-*.f6483.8

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, -\frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
    7. Applied rewrites83.8%

      \[\leadsto \frac{180 \cdot \tan^{-1} \color{blue}{\left(\mathsf{fma}\left(\frac{B}{C}, -0.5, -\frac{0 \cdot A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification83.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;C \leq -900000:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;C \leq 5.8 \cdot 10^{+159}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{hypot}\left(A, B\right) + A}{-B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 75.2% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;A \leq -2.7 \cdot 10^{+145}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;A \leq 10^{+87}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (if (<= A -2.7e+145)
   (* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
   (if (<= A 1e+87)
     (/ (* 180.0 (atan (/ (- C (hypot B C)) B))) (PI))
     (* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI))))))
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;A \leq -2.7 \cdot 10^{+145}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{elif}\;A \leq 10^{+87}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if A < -2.70000000000000022e145

    1. Initial program 13.7%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in A around -inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{B}{A}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot \color{blue}{\frac{1}{2}}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower-*.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot \color{blue}{\frac{1}{2}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-/.f6476.2

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites76.2%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{B}{A} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]

    if -2.70000000000000022e145 < A < 9.9999999999999996e86

    1. Initial program 56.6%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}} \]
      2. lift-PI.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\color{blue}{\mathsf{PI}\left(\right)}} \]
      3. lift-/.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}} \]
    4. Applied rewrites84.4%

      \[\leadsto \color{blue}{\frac{180 \cdot \tan^{-1} \left(\left(\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot {B}^{-1}\right)}{\mathsf{PI}\left(\right)}} \]
    5. Taylor expanded in A around 0

      \[\leadsto \frac{180 \cdot \tan^{-1} \color{blue}{\left(\frac{C - \sqrt{{B}^{2} + {C}^{2}}}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{C - \sqrt{{B}^{2} + {C}^{2}}}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower--.f64N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{C - \sqrt{{B}^{2} + {C}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. pow2N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{C - \sqrt{B \cdot B + {C}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. pow2N/A

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{C - \sqrt{B \cdot B + C \cdot C}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. lower-hypot.f6479.2

        \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
    7. Applied rewrites79.2%

      \[\leadsto \frac{180 \cdot \tan^{-1} \color{blue}{\left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right)}}{\mathsf{PI}\left(\right)} \]

    if 9.9999999999999996e86 < A

    1. Initial program 78.4%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around -inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(1 + \frac{C}{B}\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \color{blue}{\left(\frac{C}{B} - \frac{A}{B}\right)}\right)}{\mathsf{PI}\left(\right)} \]
      2. div-subN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-+.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \color{blue}{\frac{C - A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      5. lift--.f6486.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites86.1%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(1 + \frac{C - A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -2.7 \cdot 10^{+145}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;A \leq 10^{+87}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 75.2% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;A \leq -2.7 \cdot 10^{+145}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;A \leq 10^{+87}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (if (<= A -2.7e+145)
   (* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
   (if (<= A 1e+87)
     (* 180.0 (/ (atan (/ (- C (hypot C B)) B)) (PI)))
     (* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI))))))
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;A \leq -2.7 \cdot 10^{+145}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{elif}\;A \leq 10^{+87}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if A < -2.70000000000000022e145

    1. Initial program 13.7%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in A around -inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{B}{A}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot \color{blue}{\frac{1}{2}}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower-*.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot \color{blue}{\frac{1}{2}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-/.f6476.2

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites76.2%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{B}{A} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]

    if -2.70000000000000022e145 < A < 9.9999999999999996e86

    1. Initial program 56.6%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in A around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C - \sqrt{{B}^{2} + {C}^{2}}}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{{B}^{2} + {C}^{2}}}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{{B}^{2} + {C}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. +-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{{C}^{2} + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{C \cdot C + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{C \cdot C + B \cdot B}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      6. lower-hypot.f6479.2

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites79.2%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}}{\mathsf{PI}\left(\right)} \]

    if 9.9999999999999996e86 < A

    1. Initial program 78.4%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around -inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(1 + \frac{C}{B}\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \color{blue}{\left(\frac{C}{B} - \frac{A}{B}\right)}\right)}{\mathsf{PI}\left(\right)} \]
      2. div-subN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. lower-+.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \color{blue}{\frac{C - A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      5. lift--.f6486.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites86.1%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(1 + \frac{C - A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -2.7 \cdot 10^{+145}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;A \leq 10^{+87}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 79.1% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;C \leq 5.8 \cdot 10^{+159}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (if (<= C 5.8e+159)
   (* 180.0 (/ (atan (/ (- (- C A) (hypot A B)) B)) (PI)))
   (/ (* 180.0 (atan (fma (/ B C) -0.5 (/ (* 0.0 A) B)))) (PI))))
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;C \leq 5.8 \cdot 10^{+159}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if C < 5.80000000000000029e159

    1. Initial program 62.2%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in A around 0

      \[\leadsto 180 \cdot \frac{\color{blue}{\tan^{-1} \left(\frac{C - \left(A + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. lower-atan.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \left(A + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
      2. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      3. +-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      5. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      6. lift--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      7. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{\left(A - C\right) \cdot \left(A - C\right) + {B}^{2}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      8. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{\left(A - C\right) \cdot \left(A - C\right) + B \cdot B}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      9. lower-hypot.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
      10. lift--.f6486.8

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
    5. Applied rewrites86.8%

      \[\leadsto 180 \cdot \frac{\color{blue}{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right)}}{\mathsf{PI}\left(\right)} \]
    6. Taylor expanded in A around inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A, B\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
    7. Step-by-step derivation
      1. Applied rewrites84.8%

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A, B\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]

      if 5.80000000000000029e159 < C

      1. Initial program 9.3%

        \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}} \]
        2. lift-PI.f64N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\color{blue}{\mathsf{PI}\left(\right)}} \]
        3. lift-/.f64N/A

          \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}} \]
      4. Applied rewrites40.8%

        \[\leadsto \color{blue}{\frac{180 \cdot \tan^{-1} \left(\left(\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot {B}^{-1}\right)}{\mathsf{PI}\left(\right)}} \]
      5. Taylor expanded in C around inf

        \[\leadsto \frac{180 \cdot \tan^{-1} \color{blue}{\left(-1 \cdot \frac{A + -1 \cdot A}{B} + \frac{-1}{2} \cdot \frac{B}{C}\right)}}{\mathsf{PI}\left(\right)} \]
      6. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C} + \color{blue}{-1 \cdot \frac{A + -1 \cdot A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
        2. *-commutativeN/A

          \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{B}{C} \cdot \frac{-1}{2} + \color{blue}{-1} \cdot \frac{A + -1 \cdot A}{B}\right)}{\mathsf{PI}\left(\right)} \]
        3. lower-fma.f64N/A

          \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \color{blue}{\frac{-1}{2}}, -1 \cdot \frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
        4. lower-/.f64N/A

          \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -1 \cdot \frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
        5. mul-1-negN/A

          \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, \mathsf{neg}\left(\frac{A + -1 \cdot A}{B}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
        6. lower-neg.f64N/A

          \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
        7. lower-/.f64N/A

          \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{A + -1 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
        8. distribute-rgt1-inN/A

          \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{\left(-1 + 1\right) \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
        9. metadata-evalN/A

          \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, -\frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
        10. lower-*.f6483.8

          \[\leadsto \frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, -\frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
      7. Applied rewrites83.8%

        \[\leadsto \frac{180 \cdot \tan^{-1} \color{blue}{\left(\mathsf{fma}\left(\frac{B}{C}, -0.5, -\frac{0 \cdot A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
    8. Recombined 2 regimes into one program.
    9. Final simplification84.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;C \leq 5.8 \cdot 10^{+159}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
    10. Add Preprocessing

    Alternative 11: 58.6% accurate, 2.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;A \leq -1.05 \cdot 10^{+60}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;A \leq 2.9 \cdot 10^{-50}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-1 - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
    (FPCore (A B C)
     :precision binary64
     (if (<= A -1.05e+60)
       (* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
       (if (<= A 2.9e-50)
         (* 180.0 (/ (atan (- (/ C B) 1.0)) (PI)))
         (* 180.0 (/ (atan (- -1.0 (/ A B))) (PI))))))
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;A \leq -1.05 \cdot 10^{+60}:\\
    \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
    
    \mathbf{elif}\;A \leq 2.9 \cdot 10^{-50}:\\
    \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-1 - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if A < -1.0500000000000001e60

      1. Initial program 19.3%

        \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in A around -inf

        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{B}{A}\right)}}{\mathsf{PI}\left(\right)} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot \color{blue}{\frac{1}{2}}\right)}{\mathsf{PI}\left(\right)} \]
        2. lower-*.f64N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot \color{blue}{\frac{1}{2}}\right)}{\mathsf{PI}\left(\right)} \]
        3. lower-/.f6466.8

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]
      5. Applied rewrites66.8%

        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{B}{A} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]

      if -1.0500000000000001e60 < A < 2.90000000000000008e-50

      1. Initial program 58.2%

        \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in B around inf

        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
      4. Step-by-step derivation
        1. associate--r+N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
        2. lower--.f64N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
        3. lower--.f64N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
        4. lower-/.f64N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \]
        5. lower-/.f6458.1

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      5. Applied rewrites58.1%

        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
      6. Taylor expanded in A around 0

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - \color{blue}{1}\right)}{\mathsf{PI}\left(\right)} \]
      7. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)} \]
        2. lift--.f6456.5

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)} \]
      8. Applied rewrites56.5%

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - \color{blue}{1}\right)}{\mathsf{PI}\left(\right)} \]

      if 2.90000000000000008e-50 < A

      1. Initial program 72.9%

        \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in B around inf

        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
      4. Step-by-step derivation
        1. associate--r+N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
        2. lower--.f64N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
        3. lower--.f64N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
        4. lower-/.f64N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \]
        5. lower-/.f6467.8

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      5. Applied rewrites67.8%

        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
      6. Taylor expanded in B around inf

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      7. Step-by-step derivation
        1. Applied rewrites68.5%

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
      8. Recombined 3 regimes into one program.
      9. Final simplification61.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -1.05 \cdot 10^{+60}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;A \leq 2.9 \cdot 10^{-50}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-1 - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
      10. Add Preprocessing

      Alternative 12: 50.8% accurate, 2.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;B \leq -9.2 \cdot 10^{+16}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;B \leq -1 \cdot 10^{-261}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
      (FPCore (A B C)
       :precision binary64
       (if (<= B -9.2e+16)
         (* 180.0 (/ (atan 1.0) (PI)))
         (if (<= B -1e-261)
           (* 180.0 (/ (atan (/ (- A) B)) (PI)))
           (* 180.0 (/ (atan (- (/ C B) 1.0)) (PI))))))
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;B \leq -9.2 \cdot 10^{+16}:\\
      \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
      
      \mathbf{elif}\;B \leq -1 \cdot 10^{-261}:\\
      \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\mathsf{PI}\left(\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if B < -9.2e16

        1. Initial program 52.5%

          \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in B around -inf

          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{1}}{\mathsf{PI}\left(\right)} \]
        4. Step-by-step derivation
          1. Applied rewrites69.2%

            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{1}}{\mathsf{PI}\left(\right)} \]

          if -9.2e16 < B < -9.99999999999999984e-262

          1. Initial program 63.4%

            \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in B around inf

            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
          4. Step-by-step derivation
            1. associate--r+N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
            2. lower--.f64N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
            3. lower--.f64N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
            4. lower-/.f64N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \]
            5. lower-/.f6453.0

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
          5. Applied rewrites53.0%

            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
          6. Taylor expanded in A around inf

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
          7. Step-by-step derivation
            1. associate-*r/N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1 \cdot A}{B}\right)}{\mathsf{PI}\left(\right)} \]
            2. mul-1-negN/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
            3. lower-/.f64N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
            4. lower-neg.f6441.3

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\mathsf{PI}\left(\right)} \]
          8. Applied rewrites41.3%

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]

          if -9.99999999999999984e-262 < B

          1. Initial program 56.0%

            \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in B around inf

            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
          4. Step-by-step derivation
            1. associate--r+N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
            2. lower--.f64N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
            3. lower--.f64N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
            4. lower-/.f64N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \]
            5. lower-/.f6471.8

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
          5. Applied rewrites71.8%

            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
          6. Taylor expanded in A around 0

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - \color{blue}{1}\right)}{\mathsf{PI}\left(\right)} \]
          7. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)} \]
            2. lift--.f6462.0

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)} \]
          8. Applied rewrites62.0%

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - \color{blue}{1}\right)}{\mathsf{PI}\left(\right)} \]
        5. Recombined 3 regimes into one program.
        6. Final simplification59.7%

          \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq -9.2 \cdot 10^{+16}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;B \leq -1 \cdot 10^{-261}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
        7. Add Preprocessing

        Alternative 13: 46.2% accurate, 2.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;B \leq -9.2 \cdot 10^{+16}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;B \leq 3.5 \cdot 10^{-19}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
        (FPCore (A B C)
         :precision binary64
         (if (<= B -9.2e+16)
           (* 180.0 (/ (atan 1.0) (PI)))
           (if (<= B 3.5e-19)
             (* 180.0 (/ (atan (/ (- A) B)) (PI)))
             (* 180.0 (/ (atan -1.0) (PI))))))
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;B \leq -9.2 \cdot 10^{+16}:\\
        \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
        
        \mathbf{elif}\;B \leq 3.5 \cdot 10^{-19}:\\
        \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\mathsf{PI}\left(\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if B < -9.2e16

          1. Initial program 52.5%

            \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in B around -inf

            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{1}}{\mathsf{PI}\left(\right)} \]
          4. Step-by-step derivation
            1. Applied rewrites69.2%

              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{1}}{\mathsf{PI}\left(\right)} \]

            if -9.2e16 < B < 3.50000000000000015e-19

            1. Initial program 65.2%

              \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in B around inf

              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
            4. Step-by-step derivation
              1. associate--r+N/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
              2. lower--.f64N/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
              3. lower--.f64N/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
              4. lower-/.f64N/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \]
              5. lower-/.f6455.4

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
            5. Applied rewrites55.4%

              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
            6. Taylor expanded in A around inf

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
            7. Step-by-step derivation
              1. associate-*r/N/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1 \cdot A}{B}\right)}{\mathsf{PI}\left(\right)} \]
              2. mul-1-negN/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
              3. lower-/.f64N/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
              4. lower-neg.f6438.3

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\mathsf{PI}\left(\right)} \]
            8. Applied rewrites38.3%

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]

            if 3.50000000000000015e-19 < B

            1. Initial program 49.5%

              \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in B around inf

              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\mathsf{PI}\left(\right)} \]
            4. Step-by-step derivation
              1. Applied rewrites62.5%

                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\mathsf{PI}\left(\right)} \]
            5. Recombined 3 regimes into one program.
            6. Final simplification54.3%

              \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq -9.2 \cdot 10^{+16}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;B \leq 3.5 \cdot 10^{-19}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\ \end{array} \]
            7. Add Preprocessing

            Alternative 14: 46.6% accurate, 2.5× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;B \leq -5.4 \cdot 10^{-115}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;B \leq 0.00065:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
            (FPCore (A B C)
             :precision binary64
             (if (<= B -5.4e-115)
               (* 180.0 (/ (atan 1.0) (PI)))
               (if (<= B 0.00065)
                 (* 180.0 (/ (atan (/ C B)) (PI)))
                 (* 180.0 (/ (atan -1.0) (PI))))))
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;B \leq -5.4 \cdot 10^{-115}:\\
            \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
            
            \mathbf{elif}\;B \leq 0.00065:\\
            \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B}\right)}{\mathsf{PI}\left(\right)}\\
            
            \mathbf{else}:\\
            \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if B < -5.4e-115

              1. Initial program 53.4%

                \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
              2. Add Preprocessing
              3. Taylor expanded in B around -inf

                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{1}}{\mathsf{PI}\left(\right)} \]
              4. Step-by-step derivation
                1. Applied rewrites53.3%

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{1}}{\mathsf{PI}\left(\right)} \]

                if -5.4e-115 < B < 6.4999999999999997e-4

                1. Initial program 70.0%

                  \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
                2. Add Preprocessing
                3. Taylor expanded in B around inf

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
                4. Step-by-step derivation
                  1. associate--r+N/A

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
                  2. lower--.f64N/A

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
                  3. lower--.f64N/A

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
                  4. lower-/.f64N/A

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \]
                  5. lower-/.f6461.0

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
                5. Applied rewrites61.0%

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
                6. Taylor expanded in C around inf

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
                7. Step-by-step derivation
                  1. lift-/.f6438.5

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B}\right)}{\mathsf{PI}\left(\right)} \]
                8. Applied rewrites38.5%

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]

                if 6.4999999999999997e-4 < B

                1. Initial program 47.7%

                  \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
                2. Add Preprocessing
                3. Taylor expanded in B around inf

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\mathsf{PI}\left(\right)} \]
                4. Step-by-step derivation
                  1. Applied rewrites64.3%

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\mathsf{PI}\left(\right)} \]
                5. Recombined 3 regimes into one program.
                6. Final simplification52.4%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq -5.4 \cdot 10^{-115}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;B \leq 0.00065:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\ \end{array} \]
                7. Add Preprocessing

                Alternative 15: 50.4% accurate, 2.6× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;B \leq -9.2 \cdot 10^{+16}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-1 - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
                (FPCore (A B C)
                 :precision binary64
                 (if (<= B -9.2e+16)
                   (* 180.0 (/ (atan 1.0) (PI)))
                   (* 180.0 (/ (atan (- -1.0 (/ A B))) (PI)))))
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;B \leq -9.2 \cdot 10^{+16}:\\
                \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
                
                \mathbf{else}:\\
                \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-1 - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if B < -9.2e16

                  1. Initial program 52.5%

                    \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
                  2. Add Preprocessing
                  3. Taylor expanded in B around -inf

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{1}}{\mathsf{PI}\left(\right)} \]
                  4. Step-by-step derivation
                    1. Applied rewrites69.2%

                      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{1}}{\mathsf{PI}\left(\right)} \]

                    if -9.2e16 < B

                    1. Initial program 57.9%

                      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
                    2. Add Preprocessing
                    3. Taylor expanded in B around inf

                      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
                    4. Step-by-step derivation
                      1. associate--r+N/A

                        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
                      2. lower--.f64N/A

                        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
                      3. lower--.f64N/A

                        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
                      4. lower-/.f64N/A

                        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \]
                      5. lower-/.f6466.9

                        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\mathsf{PI}\left(\right)} \]
                    5. Applied rewrites66.9%

                      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
                    6. Taylor expanded in B around inf

                      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
                    7. Step-by-step derivation
                      1. Applied rewrites55.1%

                        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 - \frac{\color{blue}{A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
                    8. Recombined 2 regimes into one program.
                    9. Final simplification58.5%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq -9.2 \cdot 10^{+16}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-1 - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
                    10. Add Preprocessing

                    Alternative 16: 40.5% accurate, 2.9× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;B \leq -2 \cdot 10^{-310}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
                    (FPCore (A B C)
                     :precision binary64
                     (if (<= B -2e-310)
                       (* 180.0 (/ (atan 1.0) (PI)))
                       (* 180.0 (/ (atan -1.0) (PI)))))
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;B \leq -2 \cdot 10^{-310}:\\
                    \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if B < -1.999999999999994e-310

                      1. Initial program 59.1%

                        \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
                      2. Add Preprocessing
                      3. Taylor expanded in B around -inf

                        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{1}}{\mathsf{PI}\left(\right)} \]
                      4. Step-by-step derivation
                        1. Applied rewrites45.2%

                          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{1}}{\mathsf{PI}\left(\right)} \]

                        if -1.999999999999994e-310 < B

                        1. Initial program 54.5%

                          \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
                        2. Add Preprocessing
                        3. Taylor expanded in B around inf

                          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\mathsf{PI}\left(\right)} \]
                        4. Step-by-step derivation
                          1. Applied rewrites46.5%

                            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\mathsf{PI}\left(\right)} \]
                        5. Recombined 2 regimes into one program.
                        6. Final simplification45.9%

                          \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq -2 \cdot 10^{-310}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\ \end{array} \]
                        7. Add Preprocessing

                        Alternative 17: 21.2% accurate, 3.1× speedup?

                        \[\begin{array}{l} \\ 180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \end{array} \]
                        (FPCore (A B C) :precision binary64 (* 180.0 (/ (atan -1.0) (PI))))
                        \begin{array}{l}
                        
                        \\
                        180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}
                        \end{array}
                        
                        Derivation
                        1. Initial program 56.6%

                          \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)} \]
                        2. Add Preprocessing
                        3. Taylor expanded in B around inf

                          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\mathsf{PI}\left(\right)} \]
                        4. Step-by-step derivation
                          1. Applied rewrites25.7%

                            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\mathsf{PI}\left(\right)} \]
                          2. Final simplification25.7%

                            \[\leadsto 180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \]
                          3. Add Preprocessing

                          Reproduce

                          ?
                          herbie shell --seed 2025051 
                          (FPCore (A B C)
                            :name "ABCF->ab-angle angle"
                            :precision binary64
                            (* 180.0 (/ (atan (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))) (PI))))