
(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 2.6e+54) (* (/ 180.0 (PI)) (atan (/ (- (- C A) (hypot (- A C) B)) B))) (* 180.0 (/ (atan (fma (/ B C) -0.5 0.0)) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq 2.6 \cdot 10^{+54}:\\
\;\;\;\;\frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, 0\right)\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < 2.60000000000000007e54Initial program 63.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-/.f6463.7
lift-*.f64N/A
*-commutativeN/A
Applied rewrites87.4%
if 2.60000000000000007e54 < C Initial program 25.3%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
associate-*r/N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
mul-1-negN/A
metadata-evalN/A
div0N/A
lower-fma.f64N/A
lower-/.f6479.8
Applied rewrites79.8%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(atan
(*
(pow B -1.0)
(- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))))
(if (<= t_0 -1e-9)
(* (/ 180.0 (PI)) (atan (/ (- C B) B)))
(if (<= t_0 2e-68)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(* 180.0 (/ (atan (+ (/ C B) 1.0)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1} \left({B}^{-1} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-9}:\\
\;\;\;\;\frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\frac{C - B}{B}\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-68}:\\
\;\;\;\;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(\frac{C}{B} + 1\right)}{\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))))))) < -1.00000000000000006e-9Initial program 58.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-/.f6458.9
lift-*.f64N/A
*-commutativeN/A
Applied rewrites89.2%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6475.0
Applied rewrites75.0%
Taylor expanded in C around 0
Applied rewrites67.1%
if -1.00000000000000006e-9 < (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))))))) < 2.00000000000000013e-68Initial program 26.5%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6458.0
Applied rewrites58.0%
if 2.00000000000000013e-68 < (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 67.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6487.3
Applied rewrites87.3%
Taylor expanded in A around 0
Applied rewrites77.4%
Final simplification69.9%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (pow B -1.0) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ (- C A) B))
(t_2 (/ 180.0 (PI))))
(if (<= t_0 -1e-9)
(* (atan (- t_1 1.0)) t_2)
(if (<= t_0 2e-68)
(/ (* (atan (* (/ (fma (/ C A) B B) A) 0.5)) 180.0) (PI))
(* (atan (+ t_1 1.0)) t_2)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{-1} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
t_1 := \frac{C - A}{B}\\
t_2 := \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1} \left(t\_1 - 1\right) \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-68}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A} \cdot 0.5\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(t\_1 + 1\right) \cdot t\_2\\
\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)))))) < -1.00000000000000006e-9Initial 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--.f6436.1
Applied rewrites36.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f6436.1
Applied rewrites36.1%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6476.3
Applied rewrites76.3%
if -1.00000000000000006e-9 < (*.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.00000000000000013e-68Initial program 26.5%
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-/.f6458.0
Applied rewrites58.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites58.1%
if 2.00000000000000013e-68 < (*.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 67.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6487.3
Applied rewrites87.3%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f6487.3
Applied rewrites87.3%
Final simplification78.0%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (pow B -1.0) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ (- C A) B))
(t_2 (/ 180.0 (PI))))
(if (<= t_0 -1e-9)
(* (atan (- t_1 1.0)) t_2)
(if (<= t_0 2e-68)
(* 180.0 (/ (atan (* 0.5 (/ (fma (/ C A) B B) A))) (PI)))
(* (atan (+ t_1 1.0)) t_2)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{-1} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
t_1 := \frac{C - A}{B}\\
t_2 := \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1} \left(t\_1 - 1\right) \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-68}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{\mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(t\_1 + 1\right) \cdot t\_2\\
\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)))))) < -1.00000000000000006e-9Initial 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--.f6436.1
Applied rewrites36.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f6436.1
Applied rewrites36.1%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6476.3
Applied rewrites76.3%
if -1.00000000000000006e-9 < (*.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.00000000000000013e-68Initial program 26.5%
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-/.f6458.0
Applied rewrites58.0%
if 2.00000000000000013e-68 < (*.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 67.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6487.3
Applied rewrites87.3%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f6487.3
Applied rewrites87.3%
Final simplification78.0%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (pow B -1.0) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ (- C A) B))
(t_2 (/ 180.0 (PI))))
(if (<= t_0 -1e-9)
(* (atan (- t_1 1.0)) t_2)
(if (<= t_0 2e-68)
(* (atan (* (/ B A) 0.5)) t_2)
(* (atan (+ t_1 1.0)) t_2)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{-1} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
t_1 := \frac{C - A}{B}\\
t_2 := \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1} \left(t\_1 - 1\right) \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-68}:\\
\;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(t\_1 + 1\right) \cdot t\_2\\
\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)))))) < -1.00000000000000006e-9Initial 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--.f6436.1
Applied rewrites36.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f6436.1
Applied rewrites36.1%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6476.3
Applied rewrites76.3%
if -1.00000000000000006e-9 < (*.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.00000000000000013e-68Initial program 26.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f642.4
Applied rewrites2.4%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f642.4
Applied rewrites2.4%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6458.0
Applied rewrites58.0%
if 2.00000000000000013e-68 < (*.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 67.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6487.3
Applied rewrites87.3%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f6487.3
Applied rewrites87.3%
Final simplification78.0%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (/ 180.0 (PI)))
(t_1
(* (pow B -1.0) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_2 (/ (- C A) B)))
(if (<= t_1 -1e-9)
(* 180.0 (/ (atan (- t_2 1.0)) (PI)))
(if (<= t_1 2e-68)
(* (atan (* (/ B A) 0.5)) t_0)
(* (atan (+ t_2 1.0)) t_0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{180}{\mathsf{PI}\left(\right)}\\
t_1 := {B}^{-1} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
t_2 := \frac{C - A}{B}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-9}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_2 - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-68}:\\
\;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(t\_2 + 1\right) \cdot 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)))))) < -1.00000000000000006e-9Initial program 58.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6476.3
Applied rewrites76.3%
if -1.00000000000000006e-9 < (*.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.00000000000000013e-68Initial program 26.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f642.4
Applied rewrites2.4%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f642.4
Applied rewrites2.4%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6458.0
Applied rewrites58.0%
if 2.00000000000000013e-68 < (*.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 67.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6487.3
Applied rewrites87.3%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f6487.3
Applied rewrites87.3%
Final simplification78.0%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (pow B -1.0) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -1e-9)
(* 180.0 (/ (atan (- t_1 1.0)) (PI)))
(if (<= t_0 2e-68)
(* (atan (* (/ B A) 0.5)) (/ 180.0 (PI)))
(* 180.0 (/ (atan (+ t_1 1.0)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{-1} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-9}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-68}:\\
\;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot \frac{180}{\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 (/.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.00000000000000006e-9Initial program 58.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6476.3
Applied rewrites76.3%
if -1.00000000000000006e-9 < (*.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.00000000000000013e-68Initial program 26.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f642.4
Applied rewrites2.4%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f642.4
Applied rewrites2.4%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6458.0
Applied rewrites58.0%
if 2.00000000000000013e-68 < (*.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 67.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6487.3
Applied rewrites87.3%
Final simplification78.0%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (pow B -1.0) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ 180.0 (PI))))
(if (<= t_0 -1e-9)
(* t_1 (atan (/ (- C B) B)))
(if (<= t_0 2e-68)
(* (atan (* (/ B A) 0.5)) t_1)
(* 180.0 (/ (atan (+ (/ (- C A) B) 1.0)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{-1} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
t_1 := \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-9}:\\
\;\;\;\;t\_1 \cdot \tan^{-1} \left(\frac{C - B}{B}\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-68}:\\
\;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B} + 1\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)))))) < -1.00000000000000006e-9Initial program 58.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-/.f6458.9
lift-*.f64N/A
*-commutativeN/A
Applied rewrites89.2%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6475.0
Applied rewrites75.0%
Taylor expanded in C around 0
Applied rewrites67.1%
if -1.00000000000000006e-9 < (*.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.00000000000000013e-68Initial program 26.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f642.4
Applied rewrites2.4%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f642.4
Applied rewrites2.4%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6458.0
Applied rewrites58.0%
if 2.00000000000000013e-68 < (*.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 67.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6487.3
Applied rewrites87.3%
Final simplification73.9%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (pow B -1.0) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ 180.0 (PI))))
(if (<= t_0 -1e-9)
(* t_1 (atan (/ (- C B) B)))
(if (<= t_0 2e-68)
(* (atan (* (/ B A) 0.5)) t_1)
(* 180.0 (/ (atan (+ (/ C B) 1.0)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{-1} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
t_1 := \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-9}:\\
\;\;\;\;t\_1 \cdot \tan^{-1} \left(\frac{C - B}{B}\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-68}:\\
\;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} + 1\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)))))) < -1.00000000000000006e-9Initial program 58.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-/.f6458.9
lift-*.f64N/A
*-commutativeN/A
Applied rewrites89.2%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6475.0
Applied rewrites75.0%
Taylor expanded in C around 0
Applied rewrites67.1%
if -1.00000000000000006e-9 < (*.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.00000000000000013e-68Initial program 26.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f642.4
Applied rewrites2.4%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f642.4
Applied rewrites2.4%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6458.0
Applied rewrites58.0%
if 2.00000000000000013e-68 < (*.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 67.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6487.3
Applied rewrites87.3%
Taylor expanded in A around 0
Applied rewrites77.4%
Final simplification69.9%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
(pow B -1.0)
(- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
(if (<= t_0 -1e-9)
(* (/ 180.0 (PI)) (atan (/ (- C B) B)))
(if (<= t_0 2e-68)
(* 180.0 (/ (atan 0.0) (PI)))
(* 180.0 (/ (atan (+ (/ C B) 1.0)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{-1} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-9}:\\
\;\;\;\;\frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\frac{C - B}{B}\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-68}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\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 (*.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.00000000000000006e-9Initial program 58.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-/.f6458.9
lift-*.f64N/A
*-commutativeN/A
Applied rewrites89.2%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6475.0
Applied rewrites75.0%
Taylor expanded in C around 0
Applied rewrites67.1%
if -1.00000000000000006e-9 < (*.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.00000000000000013e-68Initial program 26.5%
Taylor expanded in C around inf
associate-*r/N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
mul-1-negN/A
metadata-evalN/A
div026.5
Applied rewrites26.5%
if 2.00000000000000013e-68 < (*.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 67.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6487.3
Applied rewrites87.3%
Taylor expanded in A around 0
Applied rewrites77.4%
Final simplification65.2%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (/ 180.0 (PI))))
(if (<= A -5.5e+81)
(/ (* (atan (* (/ (fma (/ C A) B B) A) 0.5)) 180.0) (PI))
(if (<= A 6e+163)
(* t_0 (atan (/ (- C (hypot B C)) B)))
(* (atan (- (/ (- C A) B) 1.0)) t_0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;A \leq -5.5 \cdot 10^{+81}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A} \cdot 0.5\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 6 \cdot 10^{+163}:\\
\;\;\;\;t\_0 \cdot \tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{C - A}{B} - 1\right) \cdot t\_0\\
\end{array}
\end{array}
if A < -5.5000000000000003e81Initial program 21.3%
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-/.f6470.9
Applied rewrites70.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites71.1%
if -5.5000000000000003e81 < A < 6.00000000000000027e163Initial program 61.0%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
/-rgt-identityN/A
lower-*.f64N/A
lower-/.f6461.0
lift-*.f64N/A
*-commutativeN/A
Applied rewrites83.9%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6482.7
Applied rewrites82.7%
if 6.00000000000000027e163 < A Initial program 84.6%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6482.2
Applied rewrites82.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f6482.2
Applied rewrites82.2%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6496.2
Applied rewrites96.2%
(FPCore (A B C)
:precision binary64
(if (<= A -5.5e+81)
(/ (* (atan (* (/ (fma (/ C A) B B) A) 0.5)) 180.0) (PI))
(if (<= A 6e+163)
(* 180.0 (/ (atan (/ (- C (hypot C B)) B)) (PI)))
(* (atan (- (/ (- C A) B) 1.0)) (/ 180.0 (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -5.5 \cdot 10^{+81}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A} \cdot 0.5\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 6 \cdot 10^{+163}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{C - A}{B} - 1\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -5.5000000000000003e81Initial program 21.3%
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-/.f6470.9
Applied rewrites70.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites71.1%
if -5.5000000000000003e81 < A < 6.00000000000000027e163Initial program 61.0%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6482.7
Applied rewrites82.7%
if 6.00000000000000027e163 < A Initial program 84.6%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6482.2
Applied rewrites82.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f6482.2
Applied rewrites82.2%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6496.2
Applied rewrites96.2%
(FPCore (A B C)
:precision binary64
(if (<= B -2.7e-83)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B -2e-222)
(* (atan (/ (- A) B)) (/ 180.0 (PI)))
(if (<= B 3.25e-136)
(* 180.0 (/ (atan 0.0) (PI)))
(* 180.0 (/ (atan -1.0) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -2.7 \cdot 10^{-83}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq -2 \cdot 10^{-222}:\\
\;\;\;\;\tan^{-1} \left(\frac{-A}{B}\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 3.25 \cdot 10^{-136}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -2.69999999999999991e-83Initial program 58.9%
Taylor expanded in B around -inf
Applied rewrites66.1%
if -2.69999999999999991e-83 < B < -2.0000000000000001e-222Initial program 79.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6479.2
Applied rewrites79.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
associate-/r/N/A
clear-numN/A
lift-/.f64N/A
lower-*.f6479.2
Applied rewrites79.2%
Taylor expanded in A around inf
Applied rewrites58.8%
if -2.0000000000000001e-222 < B < 3.25000000000000005e-136Initial program 56.2%
Taylor expanded in C around inf
associate-*r/N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
mul-1-negN/A
metadata-evalN/A
div039.5
Applied rewrites39.5%
if 3.25000000000000005e-136 < B Initial program 53.8%
Taylor expanded in B around inf
Applied rewrites53.9%
(FPCore (A B C) :precision binary64 (if (<= B 3.2e-58) (* 180.0 (/ (atan (+ (/ C B) 1.0)) (PI))) (* 180.0 (/ (atan -1.0) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 3.2 \cdot 10^{-58}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < 3.2000000000000001e-58Initial program 59.7%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6463.9
Applied rewrites63.9%
Taylor expanded in A around 0
Applied rewrites56.8%
if 3.2000000000000001e-58 < B Initial program 51.7%
Taylor expanded in B around inf
Applied rewrites61.7%
(FPCore (A B C)
:precision binary64
(if (<= B -1.05e-107)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 3.25e-136)
(* 180.0 (/ (atan 0.0) (PI)))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -1.05 \cdot 10^{-107}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 3.25 \cdot 10^{-136}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -1.05e-107Initial program 60.3%
Taylor expanded in B around -inf
Applied rewrites64.5%
if -1.05e-107 < B < 3.25000000000000005e-136Initial program 58.7%
Taylor expanded in C around inf
associate-*r/N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
mul-1-negN/A
metadata-evalN/A
div038.1
Applied rewrites38.1%
if 3.25000000000000005e-136 < B Initial program 53.8%
Taylor expanded in B around inf
Applied rewrites53.9%
(FPCore (A B C) :precision binary64 (if (<= B 3.25e-136) (* 180.0 (/ (atan 0.0) (PI))) (* 180.0 (/ (atan -1.0) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 3.25 \cdot 10^{-136}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < 3.25000000000000005e-136Initial program 59.6%
Taylor expanded in C around inf
associate-*r/N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
mul-1-negN/A
metadata-evalN/A
div020.2
Applied rewrites20.2%
if 3.25000000000000005e-136 < B Initial program 53.8%
Taylor expanded in B around inf
Applied rewrites53.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.4%
Taylor expanded in B around inf
Applied rewrites23.2%
herbie shell --seed 2024313
(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))))