
(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 14 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 -3.8e+83)
(/ (* 180.0 (atan (* 0.5 (/ B A)))) (PI))
(if (<= A 3.2e-126)
(* 180.0 (/ (atan (/ (- C (hypot B C)) B)) (PI)))
(* 180.0 (/ (atan (/ (+ (hypot B A) A) (- B))) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -3.8 \cdot 10^{+83}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(0.5 \cdot \frac{B}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 3.2 \cdot 10^{-126}:\\
\;\;\;\;180 \cdot \frac{\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(\frac{\mathsf{hypot}\left(B, A\right) + A}{-B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -3.8000000000000002e83Initial program 25.5%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.2
Applied rewrites80.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6480.3
Applied rewrites80.3%
if -3.8000000000000002e83 < A < 3.2000000000000001e-126Initial program 58.4%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6480.8
Applied rewrites80.8%
if 3.2000000000000001e-126 < A Initial program 75.5%
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
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6490.2
Applied rewrites90.2%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (* 180.0 (/ (atan (+ (/ (- C A) B) 1.0)) (PI))))
(t_1
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_2 (* 180.0 (/ (atan (- (/ (- A) B) 1.0)) (PI)))))
(if (<= t_1 (- INFINITY))
t_2
(if (<= t_1 -2e+40)
t_0
(if (<= t_1 -0.5)
t_2
(if (<= t_1 0.0) (* 180.0 (/ (atan (* (/ B A) 0.5)) (PI))) t_0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\mathsf{PI}\left(\right)}\\
t_1 := \frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
t_2 := 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+40}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq -0.5:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\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)))))) < -inf.0 or -2.00000000000000006e40 < (*.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 57.0%
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
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6481.1
Applied rewrites81.1%
Taylor expanded in A around 0
Applied rewrites72.5%
if -inf.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)))))) < -2.00000000000000006e40 or 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 65.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.2
Applied rewrites78.2%
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 29.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6453.4
Applied rewrites53.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))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -40.0)
(* 180.0 (/ (atan (* (/ 1.0 B) (* (- t_1 1.0) B))) (PI)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (/ (* 0.5 (fma C (/ B A) B)) A)) (PI)))
(* 180.0 (/ (atan (+ t_1 1.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 -40:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(t\_1 - 1\right) \cdot B\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{0.5 \cdot \mathsf{fma}\left(C, \frac{B}{A}, B\right)}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 + 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))) < -40Initial program 62.0%
Taylor expanded in B around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6480.4
Applied rewrites80.4%
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 29.9%
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
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6423.0
Applied rewrites23.0%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6420.5
Applied rewrites20.5%
Taylor expanded in A around -inf
associate-*r/N/A
lower-/.f64N/A
distribute-lft-outN/A
associate-*r*N/A
metadata-evalN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6453.5
Applied rewrites53.5%
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 61.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6475.9
Applied rewrites75.9%
(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 -40.0)
(* 180.0 (/ (atan (- t_1 1.0)) (PI)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (/ (* 0.5 (fma C (/ B A) B)) A)) (PI)))
(* 180.0 (/ (atan (+ t_1 1.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 -40:\\
\;\;\;\;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{0.5 \cdot \mathsf{fma}\left(C, \frac{B}{A}, B\right)}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 + 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))) < -40Initial program 62.0%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6480.4
Applied rewrites80.4%
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 29.9%
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
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6423.0
Applied rewrites23.0%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6420.5
Applied rewrites20.5%
Taylor expanded in A around -inf
associate-*r/N/A
lower-/.f64N/A
distribute-lft-outN/A
associate-*r*N/A
metadata-evalN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6453.5
Applied rewrites53.5%
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 61.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6475.9
Applied rewrites75.9%
(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 -40.0)
(* 180.0 (/ (atan (- t_1 1.0)) (PI)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (/ (* 0.5 (fma B (/ C A) B)) A)) (PI)))
(* 180.0 (/ (atan (+ t_1 1.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 -40:\\
\;\;\;\;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{0.5 \cdot \mathsf{fma}\left(B, \frac{C}{A}, B\right)}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 + 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))) < -40Initial program 62.0%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6480.4
Applied rewrites80.4%
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 29.9%
Taylor expanded in A around -inf
associate-*r/N/A
lower-/.f64N/A
distribute-lft-outN/A
associate-*r*N/A
metadata-evalN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6453.5
Applied rewrites53.5%
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 61.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6475.9
Applied rewrites75.9%
(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 -40.0)
(* 180.0 (/ (atan (- t_1 1.0)) (PI)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(* 180.0 (/ (atan (+ t_1 1.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 -40:\\
\;\;\;\;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}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 + 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))) < -40Initial program 62.0%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6480.4
Applied rewrites80.4%
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 29.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6453.4
Applied rewrites53.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 61.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6475.9
Applied rewrites75.9%
(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 (- (/ (- A) B) 1.0)) (PI)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* (/ B C) -0.5)) (PI)))
(* 180.0 (/ (atan (- 1.0 (/ 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:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B} - 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 - \frac{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 62.0%
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
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6476.2
Applied rewrites76.2%
Taylor expanded in A around 0
Applied rewrites68.6%
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 29.9%
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-lft47.3
Applied rewrites47.3%
Taylor expanded in B around 0
Applied rewrites47.3%
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 61.2%
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
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6473.5
Applied rewrites73.5%
Taylor expanded in B around -inf
Applied rewrites64.7%
(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 (- (/ (- A) B) 1.0)) (PI)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(* 180.0 (/ (atan (- 1.0 (/ 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 -0.5:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{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{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)))))) < -0.5Initial program 62.0%
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
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6476.2
Applied rewrites76.2%
Taylor expanded in A around 0
Applied rewrites68.6%
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 29.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6453.4
Applied rewrites53.4%
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 61.2%
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
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6473.5
Applied rewrites73.5%
Taylor expanded in B around -inf
Applied rewrites64.7%
(FPCore (A B C)
:precision binary64
(if (<= A -3.8e+83)
(/ (* 180.0 (atan (* 0.5 (/ B A)))) (PI))
(if (<= A 1.15e+121)
(* 180.0 (/ (atan (/ (- C (hypot B C)) B)) (PI)))
(* 180.0 (/ (atan (- 1.0 (/ A B))) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -3.8 \cdot 10^{+83}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(0.5 \cdot \frac{B}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 1.15 \cdot 10^{+121}:\\
\;\;\;\;180 \cdot \frac{\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{A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -3.8000000000000002e83Initial program 25.5%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.2
Applied rewrites80.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6480.3
Applied rewrites80.3%
if -3.8000000000000002e83 < A < 1.1499999999999999e121Initial program 60.3%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6479.7
Applied rewrites79.7%
if 1.1499999999999999e121 < A Initial program 85.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
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6494.7
Applied rewrites94.7%
Taylor expanded in B around -inf
Applied rewrites91.9%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (* 180.0 (/ (atan (- 1.0 (/ A B))) (PI)))))
(if (<= B -4.4e-238)
t_0
(if (<= B 1.2e-237)
(/ (* (atan 0.0) 180.0) (PI))
(if (<= B 6e-23) t_0 (* 180.0 (/ (atan -1.0) (PI))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(1 - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;B \leq -4.4 \cdot 10^{-238}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B \leq 1.2 \cdot 10^{-237}:\\
\;\;\;\;\frac{\tan^{-1} 0 \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 6 \cdot 10^{-23}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -4.39999999999999982e-238 or 1.2e-237 < B < 6.00000000000000006e-23Initial program 59.1%
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
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6464.4
Applied rewrites64.4%
Taylor expanded in B around -inf
Applied rewrites55.4%
if -4.39999999999999982e-238 < B < 1.2e-237Initial program 52.5%
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-lft49.7
Applied rewrites49.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6449.7
Applied rewrites49.7%
if 6.00000000000000006e-23 < B Initial program 57.6%
Taylor expanded in B around inf
Applied rewrites76.8%
(FPCore (A B C)
:precision binary64
(if (<= C -4.8e-174)
(* 180.0 (/ (atan (+ (/ C B) 1.0)) (PI)))
(if (<= C 7.6e-73)
(* 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 -4.8 \cdot 10^{-174}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;C \leq 7.6 \cdot 10^{-73}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 - \frac{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 < -4.8e-174Initial program 73.0%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6469.5
Applied rewrites69.5%
Taylor expanded in A around 0
Applied rewrites66.4%
if -4.8e-174 < C < 7.6000000000000005e-73Initial program 63.7%
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
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6486.0
Applied rewrites86.0%
Taylor expanded in B around -inf
Applied rewrites53.7%
if 7.6000000000000005e-73 < C Initial program 32.9%
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-lft56.5
Applied rewrites56.5%
Taylor expanded in B around 0
Applied rewrites56.5%
(FPCore (A B C)
:precision binary64
(if (<= B -3e-94)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 5.4e-98)
(/ (* (atan 0.0) 180.0) (PI))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -3 \cdot 10^{-94}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 5.4 \cdot 10^{-98}:\\
\;\;\;\;\frac{\tan^{-1} 0 \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -3.0000000000000001e-94Initial program 58.7%
Taylor expanded in B around -inf
Applied rewrites56.2%
if -3.0000000000000001e-94 < B < 5.3999999999999997e-98Initial program 57.7%
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-lft33.1
Applied rewrites33.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6433.1
Applied rewrites33.1%
if 5.3999999999999997e-98 < B Initial program 57.3%
Taylor expanded in B around inf
Applied rewrites68.3%
(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 56.6%
Taylor expanded in B around -inf
Applied rewrites40.7%
if -4.999999999999985e-310 < B Initial program 59.2%
Taylor expanded in B around inf
Applied rewrites46.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 57.9%
Taylor expanded in B around inf
Applied rewrites24.6%
herbie shell --seed 2025015
(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))))