
(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 1.05e+160) (* 180.0 (/ (atan (/ (- (- C A) (hypot (- A C) B)) B)) (PI))) (/ (* 180.0 (atan (fma (/ B C) -0.5 (/ (* 0.0 A) B)))) (PI))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq 1.05 \cdot 10^{+160}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < 1.04999999999999998e160Initial program 62.2%
Taylor expanded in A around 0
lower-atan.f64N/A
associate--r+N/A
+-commutativeN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift--.f6486.8
Applied rewrites86.8%
if 1.04999999999999998e160 < C Initial program 9.3%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites40.8%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f6483.8
Applied rewrites83.8%
Final simplification86.4%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI)))))
(if (<= t_0 -0.005)
(* 180.0 (/ (atan (/ (- (fma -1.0 B C) A) B)) (PI)))
(if (<= t_0 0.0)
(/ (* 180.0 (atan (fma (/ B C) -0.5 (/ (* 0.0 A) B)))) (PI))
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -0.005:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0050000000000000001Initial program 56.0%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6477.7
Applied rewrites77.7%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
lower-fma.f6478.5
Applied rewrites78.5%
if -0.0050000000000000001 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0Initial program 20.5%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites24.5%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f6461.9
Applied rewrites61.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 65.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6484.9
Applied rewrites84.9%
Final simplification79.5%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI)))))
(if (<= t_0 -0.005)
(* 180.0 (/ (atan (/ (- (fma -1.0 B C) A) B)) (PI)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (fma (/ B C) -0.5 (/ (* 0.0 A) B))) (PI)))
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -0.005:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0050000000000000001Initial program 56.0%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6477.7
Applied rewrites77.7%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
lower-fma.f6478.5
Applied rewrites78.5%
if -0.0050000000000000001 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0Initial program 20.5%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f6461.7
Applied rewrites61.7%
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 65.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6484.9
Applied rewrites84.9%
Final simplification79.5%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI)))))
(if (<= t_0 -0.005)
(* 180.0 (/ (atan (/ (- (fma -1.0 B C) A) B)) (PI)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -0.005:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, B, C\right) - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0050000000000000001Initial program 56.0%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6477.7
Applied rewrites77.7%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
lower-fma.f6478.5
Applied rewrites78.5%
if -0.0050000000000000001 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0Initial program 20.5%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6443.1
Applied rewrites43.1%
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 65.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6484.9
Applied rewrites84.9%
Final simplification77.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 -0.005)
(/ (* 180.0 (atan (+ -1.0 t_1))) (PI))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(* 180.0 (/ (atan (+ 1.0 t_1)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.005:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(-1 + t\_1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + t\_1\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0050000000000000001Initial program 56.0%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6477.7
Applied rewrites77.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites77.7%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
lower-fma.f6478.5
Applied rewrites78.5%
Taylor expanded in C around 0
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6478.5
Applied rewrites78.5%
if -0.0050000000000000001 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0Initial program 20.5%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6443.1
Applied rewrites43.1%
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 65.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6484.9
Applied rewrites84.9%
Final simplification77.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 -0.005)
(* 180.0 (/ (atan (- (/ C B) 1.0)) (PI)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -0.005:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0050000000000000001Initial program 56.0%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6477.7
Applied rewrites77.7%
Taylor expanded in A around 0
lift-/.f64N/A
lift--.f6467.1
Applied rewrites67.1%
if -0.0050000000000000001 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0Initial program 20.5%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6443.1
Applied rewrites43.1%
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 65.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6484.9
Applied rewrites84.9%
Final simplification72.1%
(FPCore (A B C)
:precision binary64
(if (<= C -900000.0)
(* 180.0 (/ (atan (/ (- C (hypot C B)) B)) (PI)))
(if (<= C 5.8e+159)
(* 180.0 (/ (atan (/ (+ (hypot A B) A) (- B))) (PI)))
(/ (* 180.0 (atan (fma (/ B C) -0.5 (/ (* 0.0 A) B)))) (PI)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -900000:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;C \leq 5.8 \cdot 10^{+159}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{hypot}\left(A, B\right) + A}{-B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < -9e5Initial program 78.2%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6491.5
Applied rewrites91.5%
if -9e5 < C < 5.80000000000000029e159Initial program 55.7%
Taylor expanded in C around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6480.4
Applied rewrites80.4%
if 5.80000000000000029e159 < C Initial program 9.3%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites40.8%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f6483.8
Applied rewrites83.8%
Final simplification83.6%
(FPCore (A B C)
:precision binary64
(if (<= A -2.7e+145)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(if (<= A 1e+87)
(/ (* 180.0 (atan (/ (- C (hypot B C)) B))) (PI))
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -2.7 \cdot 10^{+145}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 10^{+87}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -2.70000000000000022e145Initial program 13.7%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.2
Applied rewrites76.2%
if -2.70000000000000022e145 < A < 9.9999999999999996e86Initial program 56.6%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites84.4%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6479.2
Applied rewrites79.2%
if 9.9999999999999996e86 < A Initial program 78.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6486.1
Applied rewrites86.1%
Final simplification80.3%
(FPCore (A B C)
:precision binary64
(if (<= A -2.7e+145)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(if (<= A 1e+87)
(* 180.0 (/ (atan (/ (- C (hypot C B)) B)) (PI)))
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -2.7 \cdot 10^{+145}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 10^{+87}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -2.70000000000000022e145Initial program 13.7%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.2
Applied rewrites76.2%
if -2.70000000000000022e145 < A < 9.9999999999999996e86Initial program 56.6%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6479.2
Applied rewrites79.2%
if 9.9999999999999996e86 < A Initial program 78.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6486.1
Applied rewrites86.1%
Final simplification80.3%
(FPCore (A B C) :precision binary64 (if (<= C 5.8e+159) (* 180.0 (/ (atan (/ (- (- C A) (hypot A B)) B)) (PI))) (/ (* 180.0 (atan (fma (/ B C) -0.5 (/ (* 0.0 A) B)))) (PI))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq 5.8 \cdot 10^{+159}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < 5.80000000000000029e159Initial program 62.2%
Taylor expanded in A around 0
lower-atan.f64N/A
associate--r+N/A
+-commutativeN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift--.f6486.8
Applied rewrites86.8%
Taylor expanded in A around inf
Applied rewrites84.8%
if 5.80000000000000029e159 < C Initial program 9.3%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites40.8%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f6483.8
Applied rewrites83.8%
Final simplification84.7%
(FPCore (A B C)
:precision binary64
(if (<= A -1.05e+60)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(if (<= A 2.9e-50)
(* 180.0 (/ (atan (- (/ C B) 1.0)) (PI)))
(* 180.0 (/ (atan (- -1.0 (/ A B))) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -1.05 \cdot 10^{+60}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 2.9 \cdot 10^{-50}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-1 - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -1.0500000000000001e60Initial program 19.3%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6466.8
Applied rewrites66.8%
if -1.0500000000000001e60 < A < 2.90000000000000008e-50Initial program 58.2%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6458.1
Applied rewrites58.1%
Taylor expanded in A around 0
lift-/.f64N/A
lift--.f6456.5
Applied rewrites56.5%
if 2.90000000000000008e-50 < A Initial program 72.9%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6467.8
Applied rewrites67.8%
Taylor expanded in B around inf
Applied rewrites68.5%
Final simplification61.8%
(FPCore (A B C)
:precision binary64
(if (<= B -9.2e+16)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B -1e-261)
(* 180.0 (/ (atan (/ (- A) B)) (PI)))
(* 180.0 (/ (atan (- (/ C B) 1.0)) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -9.2 \cdot 10^{+16}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq -1 \cdot 10^{-261}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -9.2e16Initial program 52.5%
Taylor expanded in B around -inf
Applied rewrites69.2%
if -9.2e16 < B < -9.99999999999999984e-262Initial program 63.4%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6453.0
Applied rewrites53.0%
Taylor expanded in A around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6441.3
Applied rewrites41.3%
if -9.99999999999999984e-262 < B Initial program 56.0%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6471.8
Applied rewrites71.8%
Taylor expanded in A around 0
lift-/.f64N/A
lift--.f6462.0
Applied rewrites62.0%
Final simplification59.7%
(FPCore (A B C)
:precision binary64
(if (<= B -9.2e+16)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 3.5e-19)
(* 180.0 (/ (atan (/ (- A) B)) (PI)))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -9.2 \cdot 10^{+16}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 3.5 \cdot 10^{-19}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -9.2e16Initial program 52.5%
Taylor expanded in B around -inf
Applied rewrites69.2%
if -9.2e16 < B < 3.50000000000000015e-19Initial program 65.2%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6455.4
Applied rewrites55.4%
Taylor expanded in A around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6438.3
Applied rewrites38.3%
if 3.50000000000000015e-19 < B Initial program 49.5%
Taylor expanded in B around inf
Applied rewrites62.5%
Final simplification54.3%
(FPCore (A B C)
:precision binary64
(if (<= B -5.4e-115)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 0.00065)
(* 180.0 (/ (atan (/ C B)) (PI)))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -5.4 \cdot 10^{-115}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 0.00065:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -5.4e-115Initial program 53.4%
Taylor expanded in B around -inf
Applied rewrites53.3%
if -5.4e-115 < B < 6.4999999999999997e-4Initial program 70.0%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6461.0
Applied rewrites61.0%
Taylor expanded in C around inf
lift-/.f6438.5
Applied rewrites38.5%
if 6.4999999999999997e-4 < B Initial program 47.7%
Taylor expanded in B around inf
Applied rewrites64.3%
Final simplification52.4%
(FPCore (A B C) :precision binary64 (if (<= B -9.2e+16) (* 180.0 (/ (atan 1.0) (PI))) (* 180.0 (/ (atan (- -1.0 (/ A B))) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -9.2 \cdot 10^{+16}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-1 - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -9.2e16Initial program 52.5%
Taylor expanded in B around -inf
Applied rewrites69.2%
if -9.2e16 < B Initial program 57.9%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6466.9
Applied rewrites66.9%
Taylor expanded in B around inf
Applied rewrites55.1%
Final simplification58.5%
(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}
if B < -1.999999999999994e-310Initial program 59.1%
Taylor expanded in B around -inf
Applied rewrites45.2%
if -1.999999999999994e-310 < B Initial program 54.5%
Taylor expanded in B around inf
Applied rewrites46.5%
Final simplification45.9%
(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 56.6%
Taylor expanded in B around inf
Applied rewrites25.7%
Final simplification25.7%
herbie shell --seed 2025051
(FPCore (A B C)
:name "ABCF->ab-angle angle"
:precision binary64
(* 180.0 (/ (atan (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))) (PI))))