
(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
(let* ((t_0 (/ 180.0 (PI))))
(if (<= C 9.6e+70)
(* (atan (/ (- (- C A) (hypot (- A C) B)) B)) t_0)
(* (atan (fma (/ B C) -0.5 0.0)) t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;C \leq 9.6 \cdot 10^{+70}:\\
\;\;\;\;\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, 0\right)\right) \cdot t\_0\\
\end{array}
\end{array}
if C < 9.59999999999999947e70Initial program 66.7%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
/-rgt-identityN/A
lower-*.f64N/A
lower-/.f6466.7
lift-*.f64N/A
*-commutativeN/A
Applied rewrites89.0%
if 9.59999999999999947e70 < C Initial program 12.3%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
/-rgt-identityN/A
lower-*.f64N/A
lower-/.f6412.3
lift-*.f64N/A
*-commutativeN/A
Applied rewrites47.4%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6473.4
Applied rewrites73.4%
Final simplification85.9%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(atan
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(* (/ (atan (- t_1 1.0)) (PI)) 180.0)
(if (<= t_0 0.02)
(/ 180.0 (/ (PI) (atan (* (/ B A) 0.5))))
(/ 1.0 (/ (PI) (* (atan (+ t_1 1.0)) 180.0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1} \left(\left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\right)\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 0.02:\\
\;\;\;\;\frac{180}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(t\_1 + 1\right) \cdot 180}}\\
\end{array}
\end{array}
if (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))))))) < -0.5Initial program 58.3%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.8
Applied rewrites74.8%
if -0.5 < (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))))))) < 0.0200000000000000004Initial program 29.4%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.2
Applied rewrites55.2%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6455.2
Applied rewrites55.2%
if 0.0200000000000000004 < (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))))))) Initial program 60.1%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f64N/A
lift-/.f64N/A
inv-powN/A
lower-pow.f64N/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6480.0
Applied rewrites80.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6480.0
Applied rewrites88.1%
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%
Final simplification74.2%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(atan
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(* (/ (atan (- t_1 1.0)) (PI)) 180.0)
(if (<= t_0 0.02)
(/ 180.0 (/ (PI) (atan (* (/ B A) 0.5))))
(* (atan (+ t_1 1.0)) (/ 180.0 (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1} \left(\left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\right)\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 0.02:\\
\;\;\;\;\frac{180}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(t\_1 + 1\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (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))))))) < -0.5Initial program 58.3%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.8
Applied rewrites74.8%
if -0.5 < (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))))))) < 0.0200000000000000004Initial program 29.4%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.2
Applied rewrites55.2%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6455.2
Applied rewrites55.2%
if 0.0200000000000000004 < (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))))))) Initial program 60.1%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
/-rgt-identityN/A
lower-*.f64N/A
lower-/.f6460.1
lift-*.f64N/A
*-commutativeN/A
Applied rewrites88.1%
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%
Final simplification74.2%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B)))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(* (/ (atan (- t_1 1.0)) (PI)) 180.0)
(if (<= t_0 0.02)
(* (/ (atan (* (/ B A) 0.5)) (PI)) 180.0)
(* (atan (+ t_1 1.0)) (/ 180.0 (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 0.02:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(t\_1 + 1\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -0.5Initial program 58.3%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.8
Applied rewrites74.8%
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.0200000000000000004Initial program 29.4%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.2
Applied rewrites55.2%
if 0.0200000000000000004 < (*.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 60.1%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
/-rgt-identityN/A
lower-*.f64N/A
lower-/.f6460.1
lift-*.f64N/A
*-commutativeN/A
Applied rewrites88.1%
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%
Final simplification74.2%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B)))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(* (/ (atan (- t_1 1.0)) (PI)) 180.0)
(if (<= t_0 0.02)
(* (/ (atan (* (/ B A) 0.5)) (PI)) 180.0)
(* (/ (atan (+ t_1 1.0)) (PI)) 180.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 0.02:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -0.5Initial program 58.3%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.8
Applied rewrites74.8%
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.0200000000000000004Initial program 29.4%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.2
Applied rewrites55.2%
if 0.0200000000000000004 < (*.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 60.1%
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%
Final simplification74.2%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B))))
(if (<= t_0 -0.5)
(* (atan (- (/ (- A) B) 1.0)) (/ 180.0 (PI)))
(if (<= t_0 0.02)
(* (/ (atan (* (/ B A) 0.5)) (PI)) 180.0)
(* (/ (atan (+ (/ (- C A) B) 1.0)) (PI)) 180.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\tan^{-1} \left(\frac{-A}{B} - 1\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0.02:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if (*.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 58.3%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
/-rgt-identityN/A
lower-*.f64N/A
lower-/.f6458.3
lift-*.f64N/A
*-commutativeN/A
Applied rewrites86.3%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.8
Applied rewrites74.8%
Taylor expanded in C around 0
Applied rewrites65.4%
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.0200000000000000004Initial program 29.4%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.2
Applied rewrites55.2%
if 0.0200000000000000004 < (*.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 60.1%
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%
Final simplification70.3%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B))))
(if (<= t_0 -0.5)
(* (atan (- (/ (- A) B) 1.0)) (/ 180.0 (PI)))
(if (<= t_0 0.02)
(* (/ (atan (* (/ B A) 0.5)) (PI)) 180.0)
(* (/ (atan (+ (/ C B) 1.0)) (PI)) 180.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\tan^{-1} \left(\frac{-A}{B} - 1\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0.02:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -0.5Initial program 58.3%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
/-rgt-identityN/A
lower-*.f64N/A
lower-/.f6458.3
lift-*.f64N/A
*-commutativeN/A
Applied rewrites86.3%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.8
Applied rewrites74.8%
Taylor expanded in C around 0
Applied rewrites65.4%
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.0200000000000000004Initial program 29.4%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.2
Applied rewrites55.2%
if 0.0200000000000000004 < (*.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 60.1%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6467.7
Applied rewrites67.7%
Taylor expanded in B around -inf
Applied rewrites62.7%
Final simplification63.0%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B))))
(if (<= t_0 -0.5)
(* (/ (atan (/ (- C B) B)) (PI)) 180.0)
(if (<= t_0 0.02)
(* (/ (atan (* (/ B A) 0.5)) (PI)) 180.0)
(* (/ (atan (+ (/ C B) 1.0)) (PI)) 180.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - B}{B}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 0.02:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -0.5Initial program 58.3%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6469.1
Applied rewrites69.1%
Taylor expanded in C around 0
Applied rewrites63.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.0200000000000000004Initial program 29.4%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.2
Applied rewrites55.2%
if 0.0200000000000000004 < (*.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 60.1%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6467.7
Applied rewrites67.7%
Taylor expanded in B around -inf
Applied rewrites62.7%
Final simplification62.1%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B))))
(if (<= t_0 -0.5)
(* (/ (atan (/ (- C B) B)) (PI)) 180.0)
(if (<= t_0 1e-5)
(* (/ (atan (* -0.5 (/ B C))) (PI)) 180.0)
(* (/ (atan (+ (/ C B) 1.0)) (PI)) 180.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - B}{B}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 10^{-5}:\\
\;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -0.5Initial program 58.3%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6469.1
Applied rewrites69.1%
Taylor expanded in C around 0
Applied rewrites63.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)))))) < 1.00000000000000008e-5Initial program 27.4%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6421.1
Applied rewrites21.1%
Taylor expanded in C around inf
Applied rewrites45.0%
if 1.00000000000000008e-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)))))) Initial program 60.3%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6467.3
Applied rewrites67.3%
Taylor expanded in B around -inf
Applied rewrites62.3%
Final simplification60.8%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B))))
(if (<= t_0 -0.5)
(* (/ (atan (/ (- C B) B)) (PI)) 180.0)
(if (<= t_0 1e-5)
(* (/ (atan 0.0) (PI)) 180.0)
(* (/ (atan (+ (/ C B) 1.0)) (PI)) 180.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - B}{B}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 10^{-5}:\\
\;\;\;\;\frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -0.5Initial program 58.3%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6469.1
Applied rewrites69.1%
Taylor expanded in C around 0
Applied rewrites63.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)))))) < 1.00000000000000008e-5Initial program 27.4%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval25.7
Applied rewrites25.7%
if 1.00000000000000008e-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)))))) Initial program 60.3%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6467.3
Applied rewrites67.3%
Taylor expanded in B around -inf
Applied rewrites62.3%
Final simplification58.7%
(FPCore (A B C)
:precision binary64
(if (<= C -9.2e-88)
(* (/ (atan (/ (- C (hypot C B)) B)) (PI)) 180.0)
(if (<= C 8.8e+70)
(* (/ (atan (/ (+ (hypot B A) A) (- B))) (PI)) 180.0)
(* (atan (fma (/ B C) -0.5 0.0)) (/ 180.0 (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -9.2 \cdot 10^{-88}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;C \leq 8.8 \cdot 10^{+70}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\mathsf{hypot}\left(B, A\right) + A}{-B}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, 0\right)\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < -9.19999999999999945e-88Initial program 72.7%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6487.4
Applied rewrites87.4%
if -9.19999999999999945e-88 < C < 8.80000000000000003e70Initial program 63.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.f6484.8
Applied rewrites84.8%
if 8.80000000000000003e70 < C Initial program 12.3%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
/-rgt-identityN/A
lower-*.f64N/A
lower-/.f6412.3
lift-*.f64N/A
*-commutativeN/A
Applied rewrites47.4%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6473.4
Applied rewrites73.4%
Final simplification83.3%
(FPCore (A B C)
:precision binary64
(if (<= A -8.5e+97)
(* (atan (* (/ (fma (/ C A) B B) A) 0.5)) (/ 180.0 (PI)))
(if (<= A 1e-105)
(* (/ (atan (/ (- C (hypot C B)) B)) (PI)) 180.0)
(if (<= A 9.5e-47)
(* (/ (atan (* (/ (fma A (/ B C) B) C) -0.5)) (PI)) 180.0)
(/ 1.0 (/ (PI) (* (atan (+ (/ (- C A) B) 1.0)) 180.0)))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -8.5 \cdot 10^{+97}:\\
\;\;\;\;\tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A} \cdot 0.5\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 10^{-105}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 9.5 \cdot 10^{-47}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(A, \frac{B}{C}, B\right)}{C} \cdot -0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\frac{C - A}{B} + 1\right) \cdot 180}}\\
\end{array}
\end{array}
if A < -8.4999999999999993e97Initial program 16.9%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
/-rgt-identityN/A
lower-*.f64N/A
lower-/.f6416.9
lift-*.f64N/A
*-commutativeN/A
Applied rewrites62.8%
Taylor expanded in A around -inf
mul-1-negN/A
distribute-lft-outN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6480.3
Applied rewrites80.3%
if -8.4999999999999993e97 < A < 9.99999999999999965e-106Initial program 59.3%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6478.1
Applied rewrites78.1%
if 9.99999999999999965e-106 < A < 9.4999999999999991e-47Initial program 59.3%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f64N/A
lift-/.f64N/A
inv-powN/A
lower-pow.f64N/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6458.6
Applied rewrites58.6%
Taylor expanded in C around inf
distribute-lft-outN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6475.8
Applied rewrites75.8%
if 9.4999999999999991e-47 < A Initial program 67.5%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f64N/A
lift-/.f64N/A
inv-powN/A
lower-pow.f64N/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6489.0
Applied rewrites89.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6488.9
Applied rewrites91.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6474.2
Applied rewrites74.2%
Final simplification77.0%
(FPCore (A B C) :precision binary64 (if (<= B 2.7e-159) (* (/ (atan (+ (/ C B) 1.0)) (PI)) 180.0) (* (/ (atan -1.0) (PI)) 180.0)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 2.7 \cdot 10^{-159}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if B < 2.7e-159Initial program 56.5%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6461.6
Applied rewrites61.6%
Taylor expanded in B around -inf
Applied rewrites52.2%
if 2.7e-159 < B Initial program 54.6%
Taylor expanded in B around inf
Applied rewrites52.7%
Final simplification52.4%
(FPCore (A B C)
:precision binary64
(if (<= B -8.8e-147)
(* (/ (atan 1.0) (PI)) 180.0)
(if (<= B 1.1e-202)
(* (/ (atan 0.0) (PI)) 180.0)
(* (/ (atan -1.0) (PI)) 180.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -8.8 \cdot 10^{-147}:\\
\;\;\;\;\frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;B \leq 1.1 \cdot 10^{-202}:\\
\;\;\;\;\frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if B < -8.8000000000000004e-147Initial program 55.0%
Taylor expanded in B around -inf
Applied rewrites52.1%
if -8.8000000000000004e-147 < B < 1.10000000000000004e-202Initial program 56.1%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval36.6
Applied rewrites36.6%
if 1.10000000000000004e-202 < B Initial program 56.5%
Taylor expanded in B around inf
Applied rewrites51.3%
Final simplification48.1%
(FPCore (A B C) :precision binary64 (if (<= B 1.1e-202) (* (/ (atan 0.0) (PI)) 180.0) (* (/ (atan -1.0) (PI)) 180.0)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.1 \cdot 10^{-202}:\\
\;\;\;\;\frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if B < 1.10000000000000004e-202Initial program 55.5%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval16.9
Applied rewrites16.9%
if 1.10000000000000004e-202 < B Initial program 56.5%
Taylor expanded in B around inf
Applied rewrites51.3%
Final simplification29.9%
(FPCore (A B C) :precision binary64 (* (/ (atan -1.0) (PI)) 180.0))
\begin{array}{l}
\\
\frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \cdot 180
\end{array}
Initial program 55.8%
Taylor expanded in B around inf
Applied rewrites21.1%
Final simplification21.1%
herbie shell --seed 2024264
(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))))