
(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 17 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 (<= C 3.6e+16) (* (atan (/ (- (- C A) (hypot B (- A C))) B)) (/ 180.0 (PI))) (* 180.0 (/ (atan (* (/ B C) -0.5)) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq 3.6 \cdot 10^{+16}:\\
\;\;\;\;\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, A - C\right)}{B}\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{C} \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < 3.6e16Initial program 61.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites85.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-hypot.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f64N/A
lower-/.f6485.6
Applied rewrites85.6%
if 3.6e16 < C Initial program 17.3%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft70.7
Applied rewrites70.7%
Taylor expanded in B around 0
Applied rewrites70.7%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -2e-13)
(* 180.0 (/ (atan (- t_1 1.0)) (PI)))
(if (<= t_0 0.0)
(/ (* 180.0 (atan (fma -0.5 (/ B C) 0.0))) (PI))
(* (atan (+ 1.0 t_1)) (/ 180.0 (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-13}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(-0.5, \frac{B}{C}, 0\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(1 + t\_1\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
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))) < -2.0000000000000001e-13Initial program 53.2%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6471.2
Applied rewrites71.2%
if -2.0000000000000001e-13 < (*.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.0Initial program 22.0%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft62.8
Applied rewrites62.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites62.9%
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))) Initial program 57.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites83.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-hypot.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f64N/A
lower-/.f6483.0
Applied rewrites83.0%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6474.9
Applied rewrites74.9%
Final simplification71.6%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -2e-13)
(* 180.0 (/ (atan (- t_1 1.0)) (PI)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* (/ B C) -0.5)) (PI)))
(* (atan (+ 1.0 t_1)) (/ 180.0 (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-13}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{C} \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(1 + t\_1\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
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))) < -2.0000000000000001e-13Initial program 53.2%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6471.2
Applied rewrites71.2%
if -2.0000000000000001e-13 < (*.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.0Initial program 22.0%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft62.8
Applied rewrites62.8%
Taylor expanded in B around 0
Applied rewrites62.8%
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))) Initial program 57.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites83.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-hypot.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f64N/A
lower-/.f6483.0
Applied rewrites83.0%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6474.9
Applied rewrites74.9%
Final simplification71.6%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -2e-13)
(* 180.0 (/ (atan (- t_1 1.0)) (PI)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* (/ B C) -0.5)) (PI)))
(* 180.0 (/ (atan (+ 1.0 t_1)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-13}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{C} \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + t\_1\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
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))) < -2.0000000000000001e-13Initial program 53.2%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6471.2
Applied rewrites71.2%
if -2.0000000000000001e-13 < (*.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.0Initial program 22.0%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft62.8
Applied rewrites62.8%
Taylor expanded in B around 0
Applied rewrites62.8%
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))) Initial program 57.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6474.9
Applied rewrites74.9%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
(if (<= t_0 -4e-15)
(/ (* (atan (- (/ (- A) B) 1.0)) 180.0) (PI))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* (/ B C) -0.5)) (PI)))
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-15}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-A}{B} - 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{C} \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
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)))))) < -4.0000000000000003e-15Initial program 53.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites85.2%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6471.2
Applied rewrites71.2%
Taylor expanded in A around inf
Applied rewrites59.3%
if -4.0000000000000003e-15 < (*.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 22.0%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft62.8
Applied rewrites62.8%
Taylor expanded in B around 0
Applied rewrites62.8%
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 57.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6474.9
Applied rewrites74.9%
Final simplification65.9%
(FPCore (A B C)
:precision binary64
(if (<= C -2.25e-7)
(/ (* (atan (/ (- C (hypot B C)) B)) 180.0) (PI))
(if (<= C 3.6e+16)
(* 180.0 (/ (atan (/ (+ (hypot A B) A) (- B))) (PI)))
(* 180.0 (/ (atan (* (/ B C) -0.5)) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -2.25 \cdot 10^{-7}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;C \leq 3.6 \cdot 10^{+16}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{hypot}\left(A, B\right) + A}{-B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{C} \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < -2.2499999999999999e-7Initial program 71.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites95.2%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6492.2
Applied rewrites92.2%
if -2.2499999999999999e-7 < C < 3.6e16Initial program 56.6%
Taylor expanded in C around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6479.7
Applied rewrites79.7%
if 3.6e16 < C Initial program 17.3%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft70.7
Applied rewrites70.7%
Taylor expanded in B around 0
Applied rewrites70.7%
(FPCore (A B C)
:precision binary64
(if (<= A -1.25e+187)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(if (<= A 3.5e-8)
(/ (* (atan (/ (- C (hypot B C)) B)) 180.0) (PI))
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -1.25 \cdot 10^{+187}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 3.5 \cdot 10^{-8}:\\
\;\;\;\;\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(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -1.25e187Initial program 4.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
if -1.25e187 < A < 3.50000000000000024e-8Initial program 47.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites72.9%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6469.2
Applied rewrites69.2%
if 3.50000000000000024e-8 < A Initial program 77.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6480.5
Applied rewrites80.5%
(FPCore (A B C)
:precision binary64
(if (<= A -1.25e+187)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(if (<= A 3.5e-8)
(* 180.0 (/ (atan (/ (- C (hypot C B)) B)) (PI)))
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -1.25 \cdot 10^{+187}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 3.5 \cdot 10^{-8}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -1.25e187Initial program 4.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
if -1.25e187 < A < 3.50000000000000024e-8Initial program 47.6%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6469.2
Applied rewrites69.2%
if 3.50000000000000024e-8 < A Initial program 77.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6480.5
Applied rewrites80.5%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (/ 180.0 (PI))))
(if (<= C -9.5e+171)
(* (atan (+ 1.0 (/ C B))) t_0)
(if (<= C -2.09e-74)
(/ (* (atan (- (/ (- A) B) 1.0)) 180.0) (PI))
(if (<= C 1e-69)
(* (atan (- 1.0 (/ A B))) t_0)
(* 180.0 (/ (atan (* (/ B C) -0.5)) (PI))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;C \leq -9.5 \cdot 10^{+171}:\\
\;\;\;\;\tan^{-1} \left(1 + \frac{C}{B}\right) \cdot t\_0\\
\mathbf{elif}\;C \leq -2.09 \cdot 10^{-74}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-A}{B} - 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;C \leq 10^{-69}:\\
\;\;\;\;\tan^{-1} \left(1 - \frac{A}{B}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{C} \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < -9.49999999999999924e171Initial program 83.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites95.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-hypot.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f64N/A
lower-/.f6495.4
Applied rewrites95.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6484.6
Applied rewrites84.6%
Taylor expanded in A around 0
Applied rewrites84.7%
if -9.49999999999999924e171 < C < -2.09000000000000004e-74Initial program 61.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites96.2%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6482.3
Applied rewrites82.3%
Taylor expanded in A around inf
Applied rewrites66.0%
if -2.09000000000000004e-74 < C < 9.9999999999999996e-70Initial program 57.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites80.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-hypot.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f64N/A
lower-/.f6480.2
Applied rewrites80.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6456.8
Applied rewrites56.8%
Taylor expanded in C around 0
Applied rewrites56.8%
if 9.9999999999999996e-70 < C Initial program 23.1%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft67.2
Applied rewrites67.2%
Taylor expanded in B around 0
Applied rewrites67.2%
Final simplification65.3%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (/ 180.0 (PI))))
(if (<= C -1.12e-20)
(* (atan (+ 1.0 (/ C B))) t_0)
(if (<= C -2.09e-74)
(* 180.0 (/ (atan -1.0) (PI)))
(if (<= C 1e-69)
(* (atan (- 1.0 (/ A B))) t_0)
(* 180.0 (/ (atan (* (/ B C) -0.5)) (PI))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;C \leq -1.12 \cdot 10^{-20}:\\
\;\;\;\;\tan^{-1} \left(1 + \frac{C}{B}\right) \cdot t\_0\\
\mathbf{elif}\;C \leq -2.09 \cdot 10^{-74}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;C \leq 10^{-69}:\\
\;\;\;\;\tan^{-1} \left(1 - \frac{A}{B}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{C} \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < -1.12000000000000002e-20Initial program 71.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites95.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-hypot.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f64N/A
lower-/.f6495.3
Applied rewrites95.3%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6474.0
Applied rewrites74.0%
Taylor expanded in A around 0
Applied rewrites70.2%
if -1.12000000000000002e-20 < C < -2.09000000000000004e-74Initial program 57.8%
Taylor expanded in B around inf
Applied rewrites74.1%
if -2.09000000000000004e-74 < C < 9.9999999999999996e-70Initial program 57.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites80.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-hypot.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f64N/A
lower-/.f6480.2
Applied rewrites80.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6456.8
Applied rewrites56.8%
Taylor expanded in C around 0
Applied rewrites56.8%
if 9.9999999999999996e-70 < C Initial program 23.1%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft67.2
Applied rewrites67.2%
Taylor expanded in B around 0
Applied rewrites67.2%
Final simplification64.5%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (/ 180.0 (PI))))
(if (<= C -1.12e-20)
(* (atan (+ 1.0 (/ C B))) t_0)
(if (<= C -2.09e-74)
(* 180.0 (/ (atan -1.0) (PI)))
(if (<= C 8e+117)
(* (atan (- 1.0 (/ A B))) t_0)
(* 180.0 (/ (atan (/ 0.0 B)) (PI))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;C \leq -1.12 \cdot 10^{-20}:\\
\;\;\;\;\tan^{-1} \left(1 + \frac{C}{B}\right) \cdot t\_0\\
\mathbf{elif}\;C \leq -2.09 \cdot 10^{-74}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;C \leq 8 \cdot 10^{+117}:\\
\;\;\;\;\tan^{-1} \left(1 - \frac{A}{B}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{0}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < -1.12000000000000002e-20Initial program 71.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites95.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-hypot.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f64N/A
lower-/.f6495.3
Applied rewrites95.3%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6474.0
Applied rewrites74.0%
Taylor expanded in A around 0
Applied rewrites70.2%
if -1.12000000000000002e-20 < C < -2.09000000000000004e-74Initial program 57.8%
Taylor expanded in B around inf
Applied rewrites74.1%
if -2.09000000000000004e-74 < C < 8.0000000000000004e117Initial program 51.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites72.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-hypot.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f64N/A
lower-/.f6472.4
Applied rewrites72.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6450.7
Applied rewrites50.7%
Taylor expanded in C around 0
Applied rewrites50.9%
if 8.0000000000000004e117 < C Initial program 11.2%
Taylor expanded in C around inf
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft35.6
Applied rewrites35.6%
Final simplification54.8%
(FPCore (A B C)
:precision binary64
(if (<= B -2e+17)
(* (atan (+ 1.0 (/ C B))) (/ 180.0 (PI)))
(if (<= B 5.6e+98)
(/ (* (atan (/ (- C A) B)) 180.0) (PI))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -2 \cdot 10^{+17}:\\
\;\;\;\;\tan^{-1} \left(1 + \frac{C}{B}\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 5.6 \cdot 10^{+98}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -2e17Initial program 43.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites77.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-hypot.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f64N/A
lower-/.f6477.5
Applied rewrites77.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6473.1
Applied rewrites73.1%
Taylor expanded in A around 0
Applied rewrites68.5%
if -2e17 < B < 5.6000000000000001e98Initial program 58.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites72.3%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.3
Applied rewrites51.3%
Taylor expanded in B around 0
Applied rewrites47.6%
if 5.6000000000000001e98 < B Initial program 37.1%
Taylor expanded in B around inf
Applied rewrites74.0%
Final simplification57.2%
(FPCore (A B C)
:precision binary64
(if (<= B -7e+15)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 1.4e+94)
(/ (* (atan (/ (- A) B)) 180.0) (PI))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -7 \cdot 10^{+15}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 1.4 \cdot 10^{+94}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-A}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -7e15Initial program 42.5%
Taylor expanded in B around -inf
Applied rewrites62.0%
if -7e15 < B < 1.39999999999999999e94Initial program 58.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites72.7%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.7
Applied rewrites51.7%
Taylor expanded in A around inf
Applied rewrites34.7%
if 1.39999999999999999e94 < B Initial program 37.1%
Taylor expanded in B around inf
Applied rewrites74.0%
Final simplification48.2%
(FPCore (A B C)
:precision binary64
(if (<= B -1.65e-161)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 2.35e-79)
(* 180.0 (/ (atan (/ 0.0 B)) (PI)))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -1.65 \cdot 10^{-161}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 2.35 \cdot 10^{-79}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{0}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -1.6499999999999999e-161Initial program 49.4%
Taylor expanded in B around -inf
Applied rewrites49.0%
if -1.6499999999999999e-161 < B < 2.3500000000000001e-79Initial program 55.4%
Taylor expanded in C around inf
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft30.7
Applied rewrites30.7%
if 2.3500000000000001e-79 < B Initial program 47.4%
Taylor expanded in B around inf
Applied rewrites54.9%
(FPCore (A B C) :precision binary64 (if (<= B 1.85e-81) (* (atan (- 1.0 (/ A B))) (/ 180.0 (PI))) (* 180.0 (/ (atan -1.0) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.85 \cdot 10^{-81}:\\
\;\;\;\;\tan^{-1} \left(1 - \frac{A}{B}\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < 1.84999999999999993e-81Initial program 52.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-hypot.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f64N/A
lower-/.f6475.1
Applied rewrites75.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6459.4
Applied rewrites59.4%
Taylor expanded in C around 0
Applied rewrites48.8%
if 1.84999999999999993e-81 < B Initial program 46.9%
Taylor expanded in B around inf
Applied rewrites54.3%
Final simplification50.5%
(FPCore (A B C) :precision binary64 (if (<= B -5e-310) (* 180.0 (/ (atan 1.0) (PI))) (* 180.0 (/ (atan -1.0) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -5 \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}
if B < -4.999999999999985e-310Initial program 52.2%
Taylor expanded in B around -inf
Applied rewrites38.7%
if -4.999999999999985e-310 < B Initial program 49.7%
Taylor expanded in B around inf
Applied rewrites37.0%
(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}
Initial program 50.9%
Taylor expanded in B around inf
Applied rewrites20.4%
herbie shell --seed 2025017
(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))))