
(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
(let* ((t_0 (/ (* 180.0 (atan (/ (- (- C A) (hypot (- A C) B)) B))) (PI)))
(t_1
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B))))
(if (<= t_1 -0.5)
t_0
(if (<= t_1 0.0) (/ 180.0 (/ (PI) (atan (* (/ B A) 0.5)))) t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{180 \cdot \tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
t_1 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
\mathbf{if}\;t\_1 \leq -0.5:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{180}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\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)))))) < -0.5 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 61.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites90.9%
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 23.1%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.6
Applied rewrites63.6%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6465.8
Applied rewrites65.8%
Final simplification87.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)))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(/ (atan (- t_1 1.0)) (* 0.005555555555555556 (PI)))
(if (<= t_0 0.0)
(/ 180.0 (/ (PI) (atan (* (/ B A) 0.5))))
(/ (* (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)}{0.005555555555555556 \cdot \mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{180}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right) \cdot 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 62.8%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6415.5
Applied rewrites15.5%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites15.5%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6482.1
Applied rewrites82.1%
lift-*.f64N/A
lift-/.f64N/A
/-rgt-identityN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
Applied rewrites82.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 23.1%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.6
Applied rewrites63.6%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6465.8
Applied rewrites65.8%
if -0.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) Initial program 60.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites90.3%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.9
Applied rewrites78.9%
Final simplification78.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)))
(t_1 (/ (- C A) B))
(t_2 (* 0.005555555555555556 (PI))))
(if (<= t_0 -0.5)
(/ (atan (- t_1 1.0)) t_2)
(if (<= t_0 0.0)
(/ (atan (* (/ B A) 0.5)) t_2)
(/ (* (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}\\
t_2 := 0.005555555555555556 \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right)}{t\_2}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right) \cdot 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 62.8%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6415.5
Applied rewrites15.5%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites15.5%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6482.1
Applied rewrites82.1%
lift-*.f64N/A
lift-/.f64N/A
/-rgt-identityN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
Applied rewrites82.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 23.1%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.6
Applied rewrites63.6%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites63.7%
lift-*.f64N/A
lift-/.f64N/A
/-rgt-identityN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
Applied rewrites63.8%
if -0.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) Initial program 60.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites90.3%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.9
Applied rewrites78.9%
Final simplification78.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)))
(t_1 (/ (- C A) B))
(t_2 (* 0.005555555555555556 (PI))))
(if (<= t_0 -0.5)
(/ (atan (- t_1 1.0)) t_2)
(if (<= t_0 0.0)
(/ (atan (* (/ B A) 0.5)) t_2)
(* (/ (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}\\
t_2 := 0.005555555555555556 \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;t\_0 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right)}{t\_2}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{t\_2}\\
\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 62.8%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6415.5
Applied rewrites15.5%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites15.5%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6482.1
Applied rewrites82.1%
lift-*.f64N/A
lift-/.f64N/A
/-rgt-identityN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
Applied rewrites82.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 23.1%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.6
Applied rewrites63.6%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites63.7%
lift-*.f64N/A
lift-/.f64N/A
/-rgt-identityN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
Applied rewrites63.8%
if -0.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) Initial program 60.9%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.9
Applied rewrites78.9%
Final simplification78.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)))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(* (/ (atan (- t_1 1.0)) (PI)) 180.0)
(if (<= t_0 0.0)
(/ (atan (* (/ B A) 0.5)) (* 0.005555555555555556 (PI)))
(* (/ (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:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{0.005555555555555556 \cdot \mathsf{PI}\left(\right)}\\
\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 62.8%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6482.1
Applied rewrites82.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 23.1%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.6
Applied rewrites63.6%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites63.7%
lift-*.f64N/A
lift-/.f64N/A
/-rgt-identityN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
Applied rewrites63.8%
if -0.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) Initial program 60.9%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.9
Applied rewrites78.9%
Final simplification78.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 (/ (- (+ A B)) B)) 180.0) (PI))
(if (<= t_0 0.0)
(/ (atan (* (/ B A) 0.5)) (* 0.005555555555555556 (PI)))
(* (/ (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:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-\left(A + B\right)}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{0.005555555555555556 \cdot \mathsf{PI}\left(\right)}\\
\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 62.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites91.6%
Taylor expanded in C around 0
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6478.0
Applied rewrites78.0%
Taylor expanded in A around 0
Applied rewrites71.5%
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 23.1%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.6
Applied rewrites63.6%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites63.7%
lift-*.f64N/A
lift-/.f64N/A
/-rgt-identityN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
Applied rewrites63.8%
if -0.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) Initial program 60.9%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.9
Applied rewrites78.9%
Final simplification73.6%
(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)) B)) 180.0) (PI))
(if (<= t_0 0.0)
(/ (atan (* (/ B A) 0.5)) (* 0.005555555555555556 (PI)))
(* (/ (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{-\left(A + B\right)}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{0.005555555555555556 \cdot \mathsf{PI}\left(\right)}\\
\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 62.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites91.6%
Taylor expanded in C around 0
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6478.0
Applied rewrites78.0%
Taylor expanded in A around 0
Applied rewrites71.5%
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 23.1%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.6
Applied rewrites63.6%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites63.7%
lift-*.f64N/A
lift-/.f64N/A
/-rgt-identityN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
Applied rewrites63.8%
if -0.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) Initial program 60.9%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.9
Applied rewrites78.9%
Taylor expanded in A around 0
Applied rewrites69.3%
Final simplification69.4%
(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 -1.0) (PI)) 180.0)
(if (<= t_0 0.0)
(* (/ (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} -1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\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 62.8%
Taylor expanded in B around inf
Applied rewrites53.7%
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 23.1%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.6
Applied rewrites63.6%
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 60.9%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.9
Applied rewrites78.9%
Taylor expanded in A around 0
Applied rewrites69.3%
Final simplification62.0%
(FPCore (A B C)
:precision binary64
(if (<= C -0.00074)
(* (/ (atan (+ (/ (- C A) B) 1.0)) (PI)) 180.0)
(if (<= C 2.4e+90)
(/ (* (atan (/ (- (+ (hypot B A) A)) B)) 180.0) (PI))
(/ (* (atan (* (/ (fma (/ B C) A B) C) -0.5)) 180.0) (PI)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -0.00074:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;C \leq 2.4 \cdot 10^{+90}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-\left(\mathsf{hypot}\left(B, A\right) + A\right)}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{B}{C}, A, B\right)}{C} \cdot -0.5\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < -7.3999999999999999e-4Initial program 76.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 -7.3999999999999999e-4 < C < 2.4000000000000001e90Initial program 55.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites80.9%
Taylor expanded in C around 0
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6479.6
Applied rewrites79.6%
if 2.4000000000000001e90 < C Initial program 24.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites61.2%
Taylor expanded in C around inf
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f6481.7
Applied rewrites81.7%
Taylor expanded in C around inf
Applied rewrites81.8%
Final simplification79.6%
(FPCore (A B C)
:precision binary64
(if (<= C -0.00074)
(* (/ (atan (+ (/ (- C A) B) 1.0)) (PI)) 180.0)
(if (<= C 2.4e+90)
(* (/ (atan (/ (+ (hypot A B) A) (- B))) (PI)) 180.0)
(/ (* (atan (* (/ (fma (/ B C) A B) C) -0.5)) 180.0) (PI)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -0.00074:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;C \leq 2.4 \cdot 10^{+90}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\mathsf{hypot}\left(A, B\right) + A}{-B}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{B}{C}, A, B\right)}{C} \cdot -0.5\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < -7.3999999999999999e-4Initial program 76.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 -7.3999999999999999e-4 < C < 2.4000000000000001e90Initial program 55.6%
Taylor expanded in C around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6479.6
Applied rewrites79.6%
if 2.4000000000000001e90 < C Initial program 24.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites61.2%
Taylor expanded in C around inf
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f6481.7
Applied rewrites81.7%
Taylor expanded in C around inf
Applied rewrites81.8%
Final simplification79.6%
(FPCore (A B C)
:precision binary64
(if (<= C -4.6e-51)
(* (/ (atan (+ (/ C B) 1.0)) (PI)) 180.0)
(if (<= C 4.4e-250)
(* (/ (atan (+ (/ (- A) B) 1.0)) (PI)) 180.0)
(if (<= C 2.6e-30)
(* (/ (atan -1.0) (PI)) 180.0)
(/ (* (atan (* (/ B C) -0.5)) 180.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -4.6 \cdot 10^{-51}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;C \leq 4.4 \cdot 10^{-250}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-A}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;C \leq 2.6 \cdot 10^{-30}:\\
\;\;\;\;\frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{C} \cdot -0.5\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < -4.60000000000000004e-51Initial program 74.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6475.8
Applied rewrites75.8%
Taylor expanded in A around 0
Applied rewrites74.9%
if -4.60000000000000004e-51 < C < 4.4e-250Initial program 58.9%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6458.2
Applied rewrites58.2%
Taylor expanded in A around inf
Applied rewrites56.9%
if 4.4e-250 < C < 2.59999999999999987e-30Initial program 62.0%
Taylor expanded in B around inf
Applied rewrites52.5%
if 2.59999999999999987e-30 < C Initial program 24.1%
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-/.f6467.8
Applied rewrites67.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites68.0%
Final simplification64.6%
(FPCore (A B C)
:precision binary64
(if (<= C -4.6e-51)
(* (/ (atan (+ (/ C B) 1.0)) (PI)) 180.0)
(if (<= C 4.4e-250)
(* (/ (atan (+ (/ (- A) B) 1.0)) (PI)) 180.0)
(if (<= C 2.6e-30)
(* (/ (atan -1.0) (PI)) 180.0)
(* (/ (atan (* (/ -0.5 C) B)) (PI)) 180.0)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -4.6 \cdot 10^{-51}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;C \leq 4.4 \cdot 10^{-250}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-A}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;C \leq 2.6 \cdot 10^{-30}:\\
\;\;\;\;\frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-0.5}{C} \cdot B\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if C < -4.60000000000000004e-51Initial program 74.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6475.8
Applied rewrites75.8%
Taylor expanded in A around 0
Applied rewrites74.9%
if -4.60000000000000004e-51 < C < 4.4e-250Initial program 58.9%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6458.2
Applied rewrites58.2%
Taylor expanded in A around inf
Applied rewrites56.9%
if 4.4e-250 < C < 2.59999999999999987e-30Initial program 62.0%
Taylor expanded in B around inf
Applied rewrites52.5%
if 2.59999999999999987e-30 < C Initial program 24.1%
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-/.f6467.8
Applied rewrites67.8%
Applied rewrites67.9%
Final simplification64.6%
(FPCore (A B C)
:precision binary64
(if (<= C 2.75e-250)
(* (/ (atan (+ (/ C B) 1.0)) (PI)) 180.0)
(if (<= C 2.6e-30)
(* (/ (atan -1.0) (PI)) 180.0)
(* (/ (atan (* (/ -0.5 C) B)) (PI)) 180.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq 2.75 \cdot 10^{-250}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;C \leq 2.6 \cdot 10^{-30}:\\
\;\;\;\;\frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-0.5}{C} \cdot B\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if C < 2.75e-250Initial program 67.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6467.7
Applied rewrites67.7%
Taylor expanded in A around 0
Applied rewrites59.9%
if 2.75e-250 < C < 2.59999999999999987e-30Initial program 62.0%
Taylor expanded in B around inf
Applied rewrites52.5%
if 2.59999999999999987e-30 < C Initial program 24.1%
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-/.f6467.8
Applied rewrites67.8%
Applied rewrites67.9%
Final simplification60.6%
(FPCore (A B C) :precision binary64 (if (<= B 1.6) (* (/ (atan (+ (/ C B) 1.0)) (PI)) 180.0) (* (/ (atan -1.0) (PI)) 180.0)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.6:\\
\;\;\;\;\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 < 1.6000000000000001Initial program 56.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6460.7
Applied rewrites60.7%
Taylor expanded in A around 0
Applied rewrites51.6%
if 1.6000000000000001 < B Initial program 56.6%
Taylor expanded in B around inf
Applied rewrites74.6%
Final simplification57.3%
(FPCore (A B C)
:precision binary64
(if (<= B -9e-94)
(* (/ (atan 1.0) (PI)) 180.0)
(if (<= B 1.4e-73)
(* (/ (atan 0.0) (PI)) 180.0)
(* (/ (atan -1.0) (PI)) 180.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -9 \cdot 10^{-94}:\\
\;\;\;\;\frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;B \leq 1.4 \cdot 10^{-73}:\\
\;\;\;\;\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 < -9.0000000000000004e-94Initial program 53.7%
Taylor expanded in B around -inf
Applied rewrites55.7%
if -9.0000000000000004e-94 < B < 1.40000000000000006e-73Initial program 55.8%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval31.3
Applied rewrites31.3%
if 1.40000000000000006e-73 < B Initial program 59.4%
Taylor expanded in B around inf
Applied rewrites67.0%
Final simplification50.3%
(FPCore (A B C) :precision binary64 (if (<= B 1.4e-73) (* (/ (atan 0.0) (PI)) 180.0) (* (/ (atan -1.0) (PI)) 180.0)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.4 \cdot 10^{-73}:\\
\;\;\;\;\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.40000000000000006e-73Initial program 54.8%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval18.5
Applied rewrites18.5%
if 1.40000000000000006e-73 < B Initial program 59.4%
Taylor expanded in B around inf
Applied rewrites67.0%
Final simplification33.3%
(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 56.2%
Taylor expanded in B around inf
Applied rewrites23.5%
Final simplification23.5%
herbie shell --seed 2024283
(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))))