ABCF->ab-angle angle

Percentage Accurate: 52.9% → 81.0%
Time: 9.1s
Alternatives: 14
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 14 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.9% 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: 81.0% accurate, 1.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if A < -1.19999999999999991e31

    1. Initial program 20.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. 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-/.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)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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 rewrites50.7%

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

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

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

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

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

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

    if -1.19999999999999991e31 < A

    1. Initial program 66.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. 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-/.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)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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 rewrites85.7%

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

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

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

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

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

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

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

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

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

Alternative 2: 72.6% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left({B}^{-1} \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 -40:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left({B}^{-1} \cdot \left(\left(t\_1 - 1\right) \cdot B\right)\right)}{\mathsf{PI}\left(\right)}\\

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

\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 + 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))) < -40

    1. Initial program 60.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} \left(\frac{1}{B} \cdot \color{blue}{\left(B \cdot \left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)\right)}\right)}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

    if -40 < (*.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 25.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-/.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)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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 rewrites25.3%

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

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

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

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

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

      \[\leadsto \frac{\tan^{-1} \color{blue}{\left(\frac{B}{A} \cdot 0.5\right)} \cdot 180}{\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 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(\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} \color{blue}{\left(1 + \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 + \color{blue}{\frac{C - A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. +-commutativeN/A

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

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

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

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

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

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

Alternative 3: 72.6% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left({B}^{-1} \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 -40:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)}\\

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

\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 + 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))) < -40

    1. Initial program 60.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}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

    if -40 < (*.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 25.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-/.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)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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 rewrites25.3%

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

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

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

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

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

      \[\leadsto \frac{\tan^{-1} \color{blue}{\left(\frac{B}{A} \cdot 0.5\right)} \cdot 180}{\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 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(\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} \color{blue}{\left(1 + \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 + \color{blue}{\frac{C - A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. +-commutativeN/A

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

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

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

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

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

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

Alternative 4: 76.4% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 20.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. 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-/.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)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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 rewrites50.7%

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

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

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

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

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

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

    if -1.19999999999999991e31 < A < 6.8000000000000004e-204

    1. Initial program 56.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. 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-/.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)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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 rewrites82.5%

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

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

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

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

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

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

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

    if 6.8000000000000004e-204 < A

    1. Initial program 73.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. 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-/.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)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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 rewrites88.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 75.6% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 20.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. 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-/.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)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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 rewrites50.7%

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

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

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

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

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

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

    if -1.19999999999999991e31 < A < 1.16000000000000007e73

    1. Initial program 58.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. 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-/.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)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \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 rewrites80.8%

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

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

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

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

        \[\leadsto \frac{\tan^{-1} \left(\frac{C - \sqrt{B \cdot B + \color{blue}{C \cdot C}}}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)} \]
      4. lower-hypot.f6476.3

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

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

    if 1.16000000000000007e73 < A

    1. Initial program 85.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}{\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} \color{blue}{\left(1 + \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 + \color{blue}{\frac{C - A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
      3. +-commutativeN/A

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

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

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

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

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

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

Alternative 6: 45.6% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;B \leq -1.15 \cdot 10^{-132}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;B \leq 9.5 \cdot 10^{-97}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;B \leq 8.5 \cdot 10^{+45}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{-0.5}{C}\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 -1.15e-132)
   (* 180.0 (/ (atan 1.0) (PI)))
   (if (<= B 9.5e-97)
     (* 180.0 (/ (atan 0.0) (PI)))
     (if (<= B 8.5e+45)
       (* 180.0 (/ (atan (* B (/ -0.5 C))) (PI)))
       (* 180.0 (/ (atan -1.0) (PI)))))))
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;B \leq -1.15 \cdot 10^{-132}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\

\mathbf{elif}\;B \leq 9.5 \cdot 10^{-97}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)}\\

\mathbf{elif}\;B \leq 8.5 \cdot 10^{+45}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{-0.5}{C}\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 4 regimes
  2. if B < -1.15000000000000002e-132

    1. Initial program 52.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}{1}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. Applied rewrites57.4%

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

      if -1.15000000000000002e-132 < B < 9.5000000000000001e-97

      1. Initial program 60.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 C around inf

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

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\mathsf{neg}\left(\left(A + -1 \cdot A\right)\right)}{B}\right)}}{\mathsf{PI}\left(\right)} \]
        3. distribute-rgt1-inN/A

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(\color{blue}{0} \cdot A\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
        5. distribute-lft-neg-inN/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\color{blue}{\left(\mathsf{neg}\left(0\right)\right) \cdot A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
        6. metadata-evalN/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\color{blue}{0} \cdot A}{B}\right)}{\mathsf{PI}\left(\right)} \]
        7. metadata-evalN/A

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

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{A + -1 \cdot A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
        10. distribute-rgt1-inN/A

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\color{blue}{0} \cdot A}{B}\right)}{\mathsf{PI}\left(\right)} \]
        12. mul0-lft31.8

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

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

      if 9.5000000000000001e-97 < B < 8.4999999999999996e45

      1. Initial program 46.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 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} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C} + -1 \cdot \frac{A + -1 \cdot A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
        2. *-commutativeN/A

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\mathsf{fma}\left(\frac{B}{C}, \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(\color{blue}{\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}, \color{blue}{\mathsf{neg}\left(\frac{A + -1 \cdot A}{B}\right)}\right)\right)}{\mathsf{PI}\left(\right)} \]
        6. distribute-frac-negN/A

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

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, \frac{\mathsf{neg}\left(\color{blue}{0} \cdot A\right)}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
        9. distribute-lft-neg-inN/A

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

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

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

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

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

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, \frac{\color{blue}{0} \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)} \]
        16. mul0-lft41.3

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0}{B}\right)\right)}}{\mathsf{PI}\left(\right)} \]
      6. Step-by-step derivation
        1. Applied rewrites41.3%

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

        if 8.4999999999999996e45 < B

        1. Initial program 52.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 rewrites56.7%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq -1.15 \cdot 10^{-132}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;B \leq 9.5 \cdot 10^{-97}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;B \leq 8.5 \cdot 10^{+45}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\ \end{array} \]
        7. Add Preprocessing

        Alternative 7: 52.2% accurate, 2.5× speedup?

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

          1. Initial program 39.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-/.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)}} \]
            3. associate-*r/N/A

              \[\leadsto \color{blue}{\frac{180 \cdot \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. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{180 \cdot \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 rewrites66.4%

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

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

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

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

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

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

          if -1.9000000000000001e-308 < A < 2.5999999999999999e-71

          1. Initial program 53.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 rewrites43.9%

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

            if 2.5999999999999999e-71 < A

            1. Initial program 78.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. 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-/.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)}} \]
              3. associate-*r/N/A

                \[\leadsto \color{blue}{\frac{180 \cdot \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. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{180 \cdot \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 rewrites91.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\frac{-\left(B + A\right)}{B}\right) \]
            12. Recombined 3 regimes into one program.
            13. Final simplification60.0%

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

            Alternative 8: 52.2% accurate, 2.5× speedup?

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

              1. Initial program 39.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 -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} \color{blue}{\left(\frac{B}{A} \cdot \frac{1}{2}\right)}}{\mathsf{PI}\left(\right)} \]
                2. lower-*.f64N/A

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

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

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

              if -1.9000000000000001e-308 < A < 2.5999999999999999e-71

              1. Initial program 53.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 rewrites43.9%

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

                if 2.5999999999999999e-71 < A

                1. Initial program 78.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. 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-/.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)}} \]
                  3. associate-*r/N/A

                    \[\leadsto \color{blue}{\frac{180 \cdot \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. lower-/.f64N/A

                    \[\leadsto \color{blue}{\frac{180 \cdot \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 rewrites91.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\frac{-\left(B + A\right)}{B}\right) \]
                12. Recombined 3 regimes into one program.
                13. Final simplification60.0%

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

                Alternative 9: 48.8% accurate, 2.5× speedup?

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

                  1. Initial program 39.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 -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} \color{blue}{\left(\frac{B}{A} \cdot \frac{1}{2}\right)}}{\mathsf{PI}\left(\right)} \]
                    2. lower-*.f64N/A

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

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

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

                  if -1.9000000000000001e-308 < A < 3.79999999999999992e-71

                  1. Initial program 53.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 rewrites43.9%

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

                    if 3.79999999999999992e-71 < A

                    1. Initial program 78.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 A around inf

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

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

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

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

                      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{A}{B} \cdot -2\right)}}{\mathsf{PI}\left(\right)} \]
                  5. Recombined 3 regimes into one program.
                  6. Add Preprocessing

                  Alternative 10: 46.5% accurate, 2.5× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;B \leq -2.15 \cdot 10^{-35}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;B \leq 1.85 \cdot 10^{+64}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{A}{B} \cdot -2\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 -2.15e-35)
                     (* 180.0 (/ (atan 1.0) (PI)))
                     (if (<= B 1.85e+64)
                       (* 180.0 (/ (atan (* (/ A B) -2.0)) (PI)))
                       (* 180.0 (/ (atan -1.0) (PI))))))
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;B \leq -2.15 \cdot 10^{-35}:\\
                  \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
                  
                  \mathbf{elif}\;B \leq 1.85 \cdot 10^{+64}:\\
                  \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{A}{B} \cdot -2\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 < -2.1500000000000001e-35

                    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.8%

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

                      if -2.1500000000000001e-35 < B < 1.84999999999999992e64

                      1. Initial program 57.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 inf

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

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

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

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

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

                      if 1.84999999999999992e64 < B

                      1. Initial program 48.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 B around inf

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

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

                      Alternative 11: 60.7% accurate, 2.5× speedup?

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

                        1. Initial program 20.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. 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-/.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)}} \]
                          3. associate-*r/N/A

                            \[\leadsto \color{blue}{\frac{180 \cdot \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. lower-/.f64N/A

                            \[\leadsto \color{blue}{\frac{180 \cdot \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 rewrites50.7%

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

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

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

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

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

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

                        if -1.29999999999999994e30 < A

                        1. Initial program 66.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(\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} \color{blue}{\left(1 + \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 + \color{blue}{\frac{C - A}{B}}\right)}{\mathsf{PI}\left(\right)} \]
                          3. +-commutativeN/A

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

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

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

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

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

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

                      Alternative 12: 45.5% accurate, 2.8× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;B \leq -1.15 \cdot 10^{-132}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;B \leq 2.2 \cdot 10^{-52}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\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 -1.15e-132)
                         (* 180.0 (/ (atan 1.0) (PI)))
                         (if (<= B 2.2e-52)
                           (* 180.0 (/ (atan 0.0) (PI)))
                           (* 180.0 (/ (atan -1.0) (PI))))))
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;B \leq -1.15 \cdot 10^{-132}:\\
                      \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
                      
                      \mathbf{elif}\;B \leq 2.2 \cdot 10^{-52}:\\
                      \;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\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 < -1.15000000000000002e-132

                        1. Initial program 52.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}{1}}{\mathsf{PI}\left(\right)} \]
                        4. Step-by-step derivation
                          1. Applied rewrites57.4%

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

                          if -1.15000000000000002e-132 < B < 2.20000000000000009e-52

                          1. Initial program 57.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 C around inf

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

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

                              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\mathsf{neg}\left(\left(A + -1 \cdot A\right)\right)}{B}\right)}}{\mathsf{PI}\left(\right)} \]
                            3. distribute-rgt1-inN/A

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

                              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(\color{blue}{0} \cdot A\right)}{B}\right)}{\mathsf{PI}\left(\right)} \]
                            5. distribute-lft-neg-inN/A

                              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\color{blue}{\left(\mathsf{neg}\left(0\right)\right) \cdot A}}{B}\right)}{\mathsf{PI}\left(\right)} \]
                            6. metadata-evalN/A

                              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\color{blue}{0} \cdot A}{B}\right)}{\mathsf{PI}\left(\right)} \]
                            7. metadata-evalN/A

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

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

                              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{A + -1 \cdot A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
                            10. distribute-rgt1-inN/A

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

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

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

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

                          if 2.20000000000000009e-52 < B

                          1. Initial program 53.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 rewrites42.1%

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

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

                          Alternative 13: 40.4% 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 53.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 rewrites44.7%

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

                              if -1.999999999999994e-310 < B

                              1. Initial program 55.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}{-1}}{\mathsf{PI}\left(\right)} \]
                              4. Step-by-step derivation
                                1. Applied rewrites28.8%

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

                              Alternative 14: 21.5% 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 54.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 rewrites15.9%

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

                                Reproduce

                                ?
                                herbie shell --seed 2024356 
                                (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))))