
(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:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (A B C) :precision binary64 (if (<= A -17.0) (/ (* 180.0 (atan (* (/ (fma (/ C A) B B) A) 0.5))) (PI)) (/ (* (atan (/ (- (- C A) (hypot (- A C) B)) B)) 180.0) (PI))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -17:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -17Initial program 19.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites52.1%
Taylor expanded in A around -inf
mul-1-negN/A
distribute-lft-outN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.5
Applied rewrites79.5%
if -17 < A Initial program 65.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites85.2%
Final simplification83.8%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B)))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(* (/ (atan (- t_1 1.0)) (PI)) 180.0)
(if (<= t_0 1e-20)
(* (/ (atan (fma (fma (/ (/ B C) C) A (/ B C)) -0.5 0.0)) (PI)) 180.0)
(/ (* (atan (+ t_1 1.0)) 180.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 10^{-20}:\\
\;\;\;\;\frac{\tan^{-1} \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{\frac{B}{C}}{C}, A, \frac{B}{C}\right), -0.5, 0\right)\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (*.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)))))) < -0.5Initial program 60.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.0
Applied rewrites79.0%
if -0.5 < (*.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)))))) < 9.99999999999999945e-21Initial program 10.8%
Taylor expanded in C around inf
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f6458.0
Applied rewrites58.0%
if 9.99999999999999945e-21 < (*.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)))))) Initial program 64.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6481.7
Applied rewrites81.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6481.7
Applied rewrites81.7%
Final simplification76.9%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B)))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(* (/ (atan (- t_1 1.0)) (PI)) 180.0)
(if (<= t_0 1e-20)
(/ (* (atan (fma (/ B C) -0.5 0.0)) 180.0) (PI))
(/ (* (atan (+ t_1 1.0)) 180.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 10^{-20}:\\
\;\;\;\;\frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, 0\right)\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (*.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)))))) < -0.5Initial program 60.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.0
Applied rewrites79.0%
if -0.5 < (*.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)))))) < 9.99999999999999945e-21Initial program 10.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites15.7%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6458.0
Applied rewrites58.0%
if 9.99999999999999945e-21 < (*.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)))))) Initial program 64.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6481.7
Applied rewrites81.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6481.7
Applied rewrites81.7%
Final simplification76.9%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B)))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(* (/ (atan (- t_1 1.0)) (PI)) 180.0)
(if (<= t_0 1e-20)
(* (/ (atan (fma (/ B C) -0.5 0.0)) (PI)) 180.0)
(/ (* (atan (+ t_1 1.0)) 180.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 10^{-20}:\\
\;\;\;\;\frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, 0\right)\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (*.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)))))) < -0.5Initial program 60.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.0
Applied rewrites79.0%
if -0.5 < (*.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)))))) < 9.99999999999999945e-21Initial program 10.8%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6457.9
Applied rewrites57.9%
if 9.99999999999999945e-21 < (*.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)))))) Initial program 64.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6481.7
Applied rewrites81.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6481.7
Applied rewrites81.7%
Final simplification76.9%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B)))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(* (/ (atan (- t_1 1.0)) (PI)) 180.0)
(if (<= t_0 1e-20)
(* (/ (atan (fma (/ B C) -0.5 0.0)) (PI)) 180.0)
(* (/ (atan (+ t_1 1.0)) (PI)) 180.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 10^{-20}:\\
\;\;\;\;\frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, 0\right)\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if (*.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)))))) < -0.5Initial program 60.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.0
Applied rewrites79.0%
if -0.5 < (*.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)))))) < 9.99999999999999945e-21Initial program 10.8%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6457.9
Applied rewrites57.9%
if 9.99999999999999945e-21 < (*.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)))))) Initial program 64.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6481.7
Applied rewrites81.7%
Final simplification76.9%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B)))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(* (/ (atan (- t_1 1.0)) (PI)) 180.0)
(if (<= t_0 0.0)
(* (/ (atan (* (/ B A) 0.5)) (PI)) 180.0)
(* (/ (atan (+ t_1 1.0)) (PI)) 180.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if (*.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)))))) < -0.5Initial program 60.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.0
Applied rewrites79.0%
if -0.5 < (*.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)))))) < -0.0Initial program 11.0%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.2
Applied rewrites39.2%
if -0.0 < (*.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)))))) Initial program 63.9%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6481.0
Applied rewrites81.0%
Final simplification73.8%
(FPCore (A B C)
:precision binary64
(if (<= A -17.0)
(/ (* 180.0 (atan (* (/ (fma (/ C A) B B) A) 0.5))) (PI))
(if (<= A 8.5e+63)
(/ (* (atan (/ (- C (hypot B C)) B)) 180.0) (PI))
(* (/ (atan (+ (/ (- C A) B) 1.0)) (PI)) 180.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -17:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 8.5 \cdot 10^{+63}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if A < -17Initial program 19.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites52.1%
Taylor expanded in A around -inf
mul-1-negN/A
distribute-lft-outN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.5
Applied rewrites79.5%
if -17 < A < 8.5000000000000004e63Initial program 59.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites81.0%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6476.9
Applied rewrites76.9%
if 8.5000000000000004e63 < A Initial program 86.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6491.8
Applied rewrites91.8%
Final simplification80.3%
(FPCore (A B C)
:precision binary64
(if (<= A -17.0)
(/ (* 180.0 (atan (* (/ (fma (/ C A) B B) A) 0.5))) (PI))
(if (<= A 8.5e+63)
(* (/ (atan (/ (- C (hypot C B)) B)) (PI)) 180.0)
(* (/ (atan (+ (/ (- C A) B) 1.0)) (PI)) 180.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -17:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 8.5 \cdot 10^{+63}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if A < -17Initial program 19.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites52.1%
Taylor expanded in A around -inf
mul-1-negN/A
distribute-lft-outN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.5
Applied rewrites79.5%
if -17 < A < 8.5000000000000004e63Initial program 59.1%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6476.9
Applied rewrites76.9%
if 8.5000000000000004e63 < A Initial program 86.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6491.8
Applied rewrites91.8%
Final simplification80.3%
(FPCore (A B C)
:precision binary64
(if (<= A -17.0)
(* (atan (* (/ B A) 0.5)) (/ 180.0 (PI)))
(if (<= A 9e+39)
(/ (* (atan (+ (/ C B) 1.0)) 180.0) (PI))
(* (/ (atan (* -2.0 (/ A B))) (PI)) 180.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -17:\\
\;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 9 \cdot 10^{+39}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(-2 \cdot \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if A < -17Initial program 19.0%
Taylor expanded in A around -inf
Applied rewrites54.1%
Applied rewrites50.6%
Taylor expanded in A around inf
Applied rewrites74.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
Applied rewrites75.1%
if -17 < A < 8.99999999999999991e39Initial program 58.6%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6456.4
Applied rewrites56.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6456.4
Applied rewrites56.4%
Taylor expanded in A around 0
Applied rewrites53.9%
if 8.99999999999999991e39 < A Initial program 85.6%
Taylor expanded in A around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6478.2
Applied rewrites78.2%
Final simplification63.9%
(FPCore (A B C)
:precision binary64
(if (<= A -17.0)
(* (/ (atan (* (/ B A) 0.5)) (PI)) 180.0)
(if (<= A 9e+39)
(/ (* (atan (+ (/ C B) 1.0)) 180.0) (PI))
(* (/ (atan (* -2.0 (/ A B))) (PI)) 180.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -17:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 9 \cdot 10^{+39}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(-2 \cdot \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if A < -17Initial program 19.0%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0
Applied rewrites75.0%
if -17 < A < 8.99999999999999991e39Initial program 58.6%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6456.4
Applied rewrites56.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6456.4
Applied rewrites56.4%
Taylor expanded in A around 0
Applied rewrites53.9%
if 8.99999999999999991e39 < A Initial program 85.6%
Taylor expanded in A around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6478.2
Applied rewrites78.2%
Final simplification63.9%
(FPCore (A B C) :precision binary64 (if (<= A -17.0) (* (atan (* (/ B A) 0.5)) (/ 180.0 (PI))) (* (/ (atan (+ (/ (- C A) B) 1.0)) (PI)) 180.0)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -17:\\
\;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if A < -17Initial program 19.0%
Taylor expanded in A around -inf
Applied rewrites54.1%
Applied rewrites50.6%
Taylor expanded in A around inf
Applied rewrites74.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
Applied rewrites75.1%
if -17 < A Initial program 65.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6465.0
Applied rewrites65.0%
Final simplification67.4%
(FPCore (A B C) :precision binary64 (if (<= B 25000000.0) (/ (* (atan (+ (/ C B) 1.0)) 180.0) (PI)) (* (/ (atan -1.0) (PI)) 180.0)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 25000000:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if B < 2.5e7Initial program 56.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6464.9
Applied rewrites64.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.0
Applied rewrites65.0%
Taylor expanded in A around 0
Applied rewrites52.9%
if 2.5e7 < B Initial program 48.2%
Taylor expanded in B around inf
Applied rewrites62.2%
Final simplification55.3%
(FPCore (A B C) :precision binary64 (if (<= B 25000000.0) (* (/ (atan (+ (/ C B) 1.0)) (PI)) 180.0) (* (/ (atan -1.0) (PI)) 180.0)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 25000000:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if B < 2.5e7Initial program 56.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6464.9
Applied rewrites64.9%
Taylor expanded in A around 0
Applied rewrites52.9%
if 2.5e7 < B Initial program 48.2%
Taylor expanded in B around inf
Applied rewrites62.2%
Final simplification55.2%
(FPCore (A B C)
:precision binary64
(if (<= B -4.7e-181)
(* (/ (atan 1.0) (PI)) 180.0)
(if (<= B 3e-106)
(* (/ (atan 0.0) (PI)) 180.0)
(* (/ (atan -1.0) (PI)) 180.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -4.7 \cdot 10^{-181}:\\
\;\;\;\;\frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;B \leq 3 \cdot 10^{-106}:\\
\;\;\;\;\frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if B < -4.6999999999999998e-181Initial program 55.3%
Taylor expanded in B around -inf
Applied rewrites47.5%
if -4.6999999999999998e-181 < B < 3.00000000000000019e-106Initial program 55.5%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval30.5
Applied rewrites30.5%
if 3.00000000000000019e-106 < B Initial program 53.1%
Taylor expanded in B around inf
Applied rewrites53.4%
Final simplification45.5%
(FPCore (A B C) :precision binary64 (if (<= B 3e-106) (* (/ (atan 0.0) (PI)) 180.0) (* (/ (atan -1.0) (PI)) 180.0)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 3 \cdot 10^{-106}:\\
\;\;\;\;\frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if B < 3.00000000000000019e-106Initial program 55.4%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval13.6
Applied rewrites13.6%
if 3.00000000000000019e-106 < B Initial program 53.1%
Taylor expanded in B around inf
Applied rewrites53.4%
Final simplification26.4%
(FPCore (A B C) :precision binary64 (* (/ (atan -1.0) (PI)) 180.0))
\begin{array}{l}
\\
\frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \cdot 180
\end{array}
Initial program 54.6%
Taylor expanded in B around inf
Applied rewrites20.0%
Final simplification20.0%
herbie shell --seed 2024331
(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))))