
(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 (<= C 4.2e-16)
(/ (* 180.0 (atan (* (- (- C A) (hypot (- A C) B)) (pow B -1.0)))) (PI))
(*
180.0
(/ (atan (fma -0.5 (+ (/ B C) (* A (/ B (* C C)))) (/ 0.0 B))) (PI)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq 4.2 \cdot 10^{-16}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\left(\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot {B}^{-1}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(-0.5, \frac{B}{C} + A \cdot \frac{B}{C \cdot C}, \frac{0}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < 4.2000000000000002e-16Initial program 69.6%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites88.5%
if 4.2000000000000002e-16 < C Initial program 22.0%
Taylor expanded in A around 0
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6420.6
Applied rewrites20.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites20.6%
Taylor expanded in C around inf
*-lft-identityN/A
associate-*l/N/A
*-lft-identityN/A
Applied rewrites70.3%
Final simplification83.0%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI)))))
(if (<= t_0 -40.0)
(/ (* 180.0 (atan (/ (- (- C A) B) B))) (PI))
(if (<= t_0 0.0)
(*
180.0
(/ (atan (fma -0.5 (+ (/ B C) (* A (/ B (* C C)))) (/ 0.0 B))) (PI)))
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -40:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{\left(C - A\right) - B}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(-0.5, \frac{B}{C} + A \cdot \frac{B}{C \cdot C}, \frac{0}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
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))) < -40Initial program 64.8%
Taylor expanded in B around inf
Applied rewrites79.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6479.0
pow279.0
pow279.0
Applied rewrites79.0%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites79.0%
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.0Initial program 19.9%
Taylor expanded in A around 0
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6410.8
Applied rewrites10.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites10.8%
Taylor expanded in C around inf
*-lft-identityN/A
associate-*l/N/A
*-lft-identityN/A
Applied rewrites60.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 59.0%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6475.9
Applied rewrites75.9%
Final simplification74.8%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI)))))
(if (<= t_0 -40.0)
(/ (* 180.0 (atan (/ (- (- C A) B) B))) (PI))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (fma (/ B C) -0.5 (/ 0.0 B))) (PI)))
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -40:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{\left(C - A\right) - B}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
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))) < -40Initial program 64.8%
Taylor expanded in B around inf
Applied rewrites79.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6479.0
pow279.0
pow279.0
Applied rewrites79.0%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites79.0%
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.0Initial program 19.9%
Taylor expanded in A around 0
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6410.8
Applied rewrites10.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites10.8%
Taylor expanded in C around inf
*-lft-identityN/A
associate-*l/N/A
*-commutativeN/A
*-lft-identityN/A
pow2N/A
pow2N/A
inv-powN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
associate-*r/N/A
Applied rewrites60.6%
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 59.0%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6475.9
Applied rewrites75.9%
Final simplification74.8%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI)))))
(if (<= t_0 -40.0)
(/ (* 180.0 (atan (/ (- (- C A) B) B))) (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 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -40:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{\left(C - A\right) - B}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{180 \cdot \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 #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))) < -40Initial program 64.8%
Taylor expanded in B around inf
Applied rewrites79.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6479.0
pow279.0
pow279.0
Applied rewrites79.0%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites79.0%
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.0Initial program 19.9%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites19.9%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
pow2N/A
unpow2N/A
lower-hypot.f6416.9
Applied rewrites16.9%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6460.4
Applied rewrites60.4%
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 59.0%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6475.9
Applied rewrites75.9%
Final simplification74.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)))))
(if (<= t_0 -40.0)
(/ (* 180.0 (atan (/ (- C B) B))) (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 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -40:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C - B}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{180 \cdot \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 #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))) < -40Initial program 64.8%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites87.6%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
pow2N/A
unpow2N/A
lower-hypot.f6470.0
Applied rewrites70.0%
Taylor expanded in B around inf
Applied rewrites63.1%
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.0Initial program 19.9%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites19.9%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
pow2N/A
unpow2N/A
lower-hypot.f6416.9
Applied rewrites16.9%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6460.4
Applied rewrites60.4%
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 59.0%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6475.9
Applied rewrites75.9%
Final simplification68.2%
(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 -0.5)
(/ (* 180.0 (atan (/ (- C B) B))) (PI))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(* 180.0 (/ (atan (+ 1.0 (/ C 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 -0.5:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C - B}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C}{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)))))) < -0.5Initial program 64.8%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites87.6%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
pow2N/A
unpow2N/A
lower-hypot.f6470.0
Applied rewrites70.0%
Taylor expanded in B around inf
Applied rewrites63.1%
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 19.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6441.9
Applied rewrites41.9%
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 59.0%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6475.9
Applied rewrites75.9%
Taylor expanded in A around 0
Applied rewrites64.6%
Final simplification60.4%
(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 -0.5)
(/ (* 180.0 (atan (/ (- C B) B))) (PI))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (/ 0.0 B)) (PI)))
(* 180.0 (/ (atan (+ 1.0 (/ C 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 -0.5:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C - B}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{0}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C}{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)))))) < -0.5Initial program 64.8%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites87.6%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
pow2N/A
unpow2N/A
lower-hypot.f6470.0
Applied rewrites70.0%
Taylor expanded in B around inf
Applied rewrites63.1%
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 19.9%
Taylor expanded in A around 0
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6410.8
Applied rewrites10.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites10.8%
Taylor expanded in C around inf
*-lft-identityN/A
pow2N/A
pow2N/A
*-lft-identityN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-eval19.9
Applied rewrites19.9%
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 59.0%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6475.9
Applied rewrites75.9%
Taylor expanded in A around 0
Applied rewrites64.6%
Final simplification57.0%
(FPCore (A B C)
:precision binary64
(if (<= A -1.58e+50)
(/ (* 180.0 (atan (* (/ B A) 0.5))) (PI))
(if (<= A 1e+34)
(/ (* 180.0 (atan (/ (- C (hypot B C)) B))) (PI))
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -1.58 \cdot 10^{+50}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 10^{+34}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -1.5800000000000001e50Initial program 19.1%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites44.1%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6472.6
Applied rewrites72.6%
if -1.5800000000000001e50 < A < 9.99999999999999946e33Initial program 53.4%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites79.0%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
pow2N/A
unpow2N/A
lower-hypot.f6477.1
Applied rewrites77.1%
if 9.99999999999999946e33 < A Initial program 84.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6486.4
Applied rewrites86.4%
Final simplification78.6%
(FPCore (A B C)
:precision binary64
(if (<= A -1.58e+50)
(/ (* 180.0 (atan (* (/ B A) 0.5))) (PI))
(if (<= A 1e+34)
(* 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.58 \cdot 10^{+50}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 10^{+34}:\\
\;\;\;\;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.5800000000000001e50Initial program 19.1%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites44.1%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6472.6
Applied rewrites72.6%
if -1.5800000000000001e50 < A < 9.99999999999999946e33Initial program 53.4%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6477.1
Applied rewrites77.1%
if 9.99999999999999946e33 < A Initial program 84.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6486.4
Applied rewrites86.4%
Final simplification78.6%
(FPCore (A B C)
:precision binary64
(if (<= B -6e-114)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 2.5e-261)
(* 180.0 (/ (atan (/ C B)) (PI)))
(if (<= B 8.5e-132)
(* 180.0 (/ (atan (/ 0.0 B)) (PI)))
(* 180.0 (/ (atan -1.0) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -6 \cdot 10^{-114}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{-261}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 8.5 \cdot 10^{-132}:\\
\;\;\;\;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 < -6.0000000000000003e-114Initial program 52.7%
Taylor expanded in B around -inf
Applied rewrites52.3%
if -6.0000000000000003e-114 < B < 2.4999999999999999e-261Initial program 59.9%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6458.2
Applied rewrites58.2%
Taylor expanded in C around inf
lower-/.f6440.9
Applied rewrites40.9%
if 2.4999999999999999e-261 < B < 8.49999999999999988e-132Initial program 45.1%
Taylor expanded in A around 0
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6433.6
Applied rewrites33.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites33.6%
Taylor expanded in C around inf
*-lft-identityN/A
pow2N/A
pow2N/A
*-lft-identityN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-eval41.8
Applied rewrites41.8%
if 8.49999999999999988e-132 < B Initial program 58.5%
Taylor expanded in B around inf
Applied rewrites49.6%
(FPCore (A B C)
:precision binary64
(if (<= C -1.8e-25)
(/ (* 180.0 (atan (/ (- C B) B))) (PI))
(if (<= C 1.3e-24)
(* 180.0 (/ (atan (- 1.0 (/ A B))) (PI)))
(/ (* 180.0 (atan (* (/ B C) -0.5))) (PI)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -1.8 \cdot 10^{-25}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C - B}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;C \leq 1.3 \cdot 10^{-24}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{B}{C} \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < -1.8e-25Initial program 82.5%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites96.2%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
pow2N/A
unpow2N/A
lower-hypot.f6495.8
Applied rewrites95.8%
Taylor expanded in B around inf
Applied rewrites83.0%
if -1.8e-25 < C < 1.3e-24Initial program 61.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6453.8
Applied rewrites53.8%
Taylor expanded in C around 0
lower--.f64N/A
lower-/.f6453.5
Applied rewrites53.5%
if 1.3e-24 < C Initial program 23.8%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites53.2%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
pow2N/A
unpow2N/A
lower-hypot.f6445.0
Applied rewrites45.0%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6468.8
Applied rewrites68.8%
Final simplification66.1%
(FPCore (A B C)
:precision binary64
(if (<= C -2.7e-46)
(* 180.0 (/ (atan (+ 1.0 (/ C B))) (PI)))
(if (<= C 5.5e+169)
(* 180.0 (/ (atan (- 1.0 (/ A B))) (PI)))
(* 180.0 (/ (atan (/ 0.0 B)) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -2.7 \cdot 10^{-46}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;C \leq 5.5 \cdot 10^{+169}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{0}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < -2.7e-46Initial program 82.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6480.5
Applied rewrites80.5%
Taylor expanded in A around 0
Applied rewrites80.6%
if -2.7e-46 < C < 5.49999999999999972e169Initial program 51.6%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6445.1
Applied rewrites45.1%
Taylor expanded in C around 0
lower--.f64N/A
lower-/.f6445.1
Applied rewrites45.1%
if 5.49999999999999972e169 < C Initial program 11.0%
Taylor expanded in A around 0
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6411.0
Applied rewrites11.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites11.0%
Taylor expanded in C around inf
*-lft-identityN/A
pow2N/A
pow2N/A
*-lft-identityN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-eval47.8
Applied rewrites47.8%
(FPCore (A B C)
:precision binary64
(if (<= C -6.4e-18)
(* 180.0 (/ (atan (/ C B)) (PI)))
(if (<= C 5.5e+169)
(* 180.0 (/ (atan (- 1.0 (/ A B))) (PI)))
(* 180.0 (/ (atan (/ 0.0 B)) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -6.4 \cdot 10^{-18}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;C \leq 5.5 \cdot 10^{+169}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{0}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < -6.3999999999999998e-18Initial program 85.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6485.7
Applied rewrites85.7%
Taylor expanded in C around inf
lower-/.f6477.6
Applied rewrites77.6%
if -6.3999999999999998e-18 < C < 5.49999999999999972e169Initial program 51.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6444.7
Applied rewrites44.7%
Taylor expanded in C around 0
lower--.f64N/A
lower-/.f6444.8
Applied rewrites44.8%
if 5.49999999999999972e169 < C Initial program 11.0%
Taylor expanded in A around 0
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6411.0
Applied rewrites11.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites11.0%
Taylor expanded in C around inf
*-lft-identityN/A
pow2N/A
pow2N/A
*-lft-identityN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-eval47.8
Applied rewrites47.8%
(FPCore (A B C)
:precision binary64
(if (<= B -6e-114)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 7.4e-122)
(* 180.0 (/ (atan (/ C B)) (PI)))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -6 \cdot 10^{-114}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 7.4 \cdot 10^{-122}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -6.0000000000000003e-114Initial program 52.7%
Taylor expanded in B around -inf
Applied rewrites52.3%
if -6.0000000000000003e-114 < B < 7.3999999999999995e-122Initial program 55.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6448.4
Applied rewrites48.4%
Taylor expanded in C around inf
lower-/.f6433.9
Applied rewrites33.9%
if 7.3999999999999995e-122 < B Initial program 58.0%
Taylor expanded in B around inf
Applied rewrites50.0%
(FPCore (A B C) :precision binary64 (if (<= B -1e-309) (* 180.0 (/ (atan 1.0) (PI))) (* 180.0 (/ (atan -1.0) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -1 \cdot 10^{-309}:\\
\;\;\;\;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 < -1.000000000000002e-309Initial program 52.5%
Taylor expanded in B around -inf
Applied rewrites40.6%
if -1.000000000000002e-309 < B Initial program 58.0%
Taylor expanded in B around inf
Applied rewrites38.2%
(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 55.3%
Taylor expanded in B around inf
Applied rewrites20.1%
herbie shell --seed 2025073
(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))))