
(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.3e-6) (* (atan (* (/ (fma (/ C A) B B) A) 0.5)) (/ 180.0 (PI))) (/ 180.0 (/ (PI) (atan (/ (- (- C A) (hypot (- A C) B)) B))))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -3.3 \cdot 10^{-6}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;\frac{180}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right)}}\\
\end{array}
\end{array}
if A < -3.30000000000000017e-6Initial program 26.4%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
/-rgt-identityN/A
lower-*.f64N/A
lower-/.f6426.4
lift-*.f64N/A
*-commutativeN/A
Applied rewrites53.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6431.3
lift-hypot.f64N/A
+-commutativeN/A
lower-hypot.f6431.3
Applied rewrites31.3%
Taylor expanded in A around -inf
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-outN/A
associate-*r*N/A
metadata-evalN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.5
Applied rewrites79.5%
if -3.30000000000000017e-6 < A Initial program 63.9%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6463.9
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6463.9
Applied rewrites80.7%
Final simplification80.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)))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(* (atan (- t_1 1.0)) (/ 180.0 (PI)))
(if (<= t_0 1e-6)
(* (/ (atan (* -0.5 (/ B C))) (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:\\
\;\;\;\;\tan^{-1} \left(t\_1 - 1\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 10^{-6}:\\
\;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\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 61.2%
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.2
lift-*.f64N/A
*-commutativeN/A
Applied rewrites85.1%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6480.7
lift-hypot.f64N/A
+-commutativeN/A
lower-hypot.f6480.7
Applied rewrites80.7%
Taylor expanded in B around inf
Applied rewrites79.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)))))) < 9.99999999999999955e-7Initial program 20.6%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval18.3
Applied rewrites18.3%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
associate-*r/N/A
mul0-lftN/A
metadata-evalN/A
+-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6453.6
Applied rewrites53.6%
if 9.99999999999999955e-7 < (*.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 62.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6473.7
Applied rewrites73.7%
Final simplification72.5%
(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 1e-6)
(* (/ (atan (* -0.5 (/ B C))) (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 10^{-6}:\\
\;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\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 61.2%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.4
Applied rewrites79.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)))))) < 9.99999999999999955e-7Initial program 20.6%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval18.3
Applied rewrites18.3%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
associate-*r/N/A
mul0-lftN/A
metadata-evalN/A
+-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6453.6
Applied rewrites53.6%
if 9.99999999999999955e-7 < (*.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 62.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6473.7
Applied rewrites73.7%
Final simplification72.5%
(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 (/ (- (+ B A)) B)) (/ 180.0 (PI)))
(if (<= t_0 1e-6)
(* (/ (atan (* -0.5 (/ B C))) (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{-\left(B + A\right)}{B}\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 10^{-6}:\\
\;\;\;\;\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 - 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 61.2%
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.2
lift-*.f64N/A
*-commutativeN/A
Applied rewrites85.1%
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.f6470.2
Applied rewrites70.2%
Taylor expanded in A around 0
Applied rewrites65.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)))))) < 9.99999999999999955e-7Initial program 20.6%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval18.3
Applied rewrites18.3%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
associate-*r/N/A
mul0-lftN/A
metadata-evalN/A
+-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6453.6
Applied rewrites53.6%
if 9.99999999999999955e-7 < (*.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 62.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6473.7
Applied rewrites73.7%
Final simplification67.1%
(FPCore (A B C)
:precision binary64
(if (<= C -9.5e+64)
(* (/ (atan (- (/ (- C A) B) 1.0)) (PI)) 180.0)
(if (<= C 1.5e+152)
(* (/ (atan (/ (+ (hypot A B) A) (- B))) (PI)) 180.0)
(* (atan (* -0.5 (/ B C))) (/ 180.0 (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -9.5 \cdot 10^{+64}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} - 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;C \leq 1.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\mathsf{hypot}\left(A, B\right) + A}{-B}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < -9.50000000000000028e64Initial program 84.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6488.7
Applied rewrites88.7%
if -9.50000000000000028e64 < C < 1.49999999999999995e152Initial program 54.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
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6470.7
Applied rewrites70.7%
if 1.49999999999999995e152 < C Initial program 8.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-/.f648.0
lift-*.f64N/A
*-commutativeN/A
Applied rewrites43.8%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6412.0
lift-hypot.f64N/A
+-commutativeN/A
lower-hypot.f6412.0
Applied rewrites12.0%
Taylor expanded in C around inf
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
--rgt-identityN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.7
Applied rewrites91.7%
Final simplification77.1%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (/ 180.0 (PI))))
(if (<= A -3.3e-6)
(* (atan (* (/ (fma (/ C A) B B) A) 0.5)) t_0)
(* (atan (/ (- (- C A) (hypot (- A C) B)) B)) t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;A \leq -3.3 \cdot 10^{-6}:\\
\;\;\;\;\tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A} \cdot 0.5\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right) \cdot t\_0\\
\end{array}
\end{array}
if A < -3.30000000000000017e-6Initial program 26.4%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
/-rgt-identityN/A
lower-*.f64N/A
lower-/.f6426.4
lift-*.f64N/A
*-commutativeN/A
Applied rewrites53.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6431.3
lift-hypot.f64N/A
+-commutativeN/A
lower-hypot.f6431.3
Applied rewrites31.3%
Taylor expanded in A around -inf
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-outN/A
associate-*r*N/A
metadata-evalN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.5
Applied rewrites79.5%
if -3.30000000000000017e-6 < A Initial program 63.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-/.f6463.9
lift-*.f64N/A
*-commutativeN/A
Applied rewrites80.7%
Final simplification80.4%
(FPCore (A B C)
:precision binary64
(if (<= A -5e-15)
(* (/ (atan (* (/ B A) 0.5)) (PI)) 180.0)
(if (<= A 1.6e-193)
(* (atan (* -0.5 (/ B C))) (/ 180.0 (PI)))
(if (<= A 112000000.0)
(* (/ (atan 1.0) (PI)) 180.0)
(* (/ (atan (* -2.0 (/ A B))) (PI)) 180.0)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -5 \cdot 10^{-15}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 1.6 \cdot 10^{-193}:\\
\;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right) \cdot \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 112000000:\\
\;\;\;\;\frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(-2 \cdot \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if A < -4.99999999999999999e-15Initial program 26.3%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6474.0
Applied rewrites74.0%
if -4.99999999999999999e-15 < A < 1.60000000000000003e-193Initial program 52.2%
lift-*.f64N/A
metadata-evalN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
times-fracN/A
/-rgt-identityN/A
lower-*.f64N/A
lower-/.f6452.2
lift-*.f64N/A
*-commutativeN/A
Applied rewrites69.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6462.2
lift-hypot.f64N/A
+-commutativeN/A
lower-hypot.f6462.2
Applied rewrites62.2%
Taylor expanded in C around inf
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
--rgt-identityN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6442.3
Applied rewrites42.3%
if 1.60000000000000003e-193 < A < 1.12e8Initial program 62.5%
Taylor expanded in B around -inf
Applied rewrites44.1%
if 1.12e8 < A Initial program 81.1%
Taylor expanded in A around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.7
Applied rewrites75.7%
Final simplification58.7%
(FPCore (A B C)
:precision binary64
(if (<= A -5e-15)
(* (/ (atan (* (/ B A) 0.5)) (PI)) 180.0)
(if (<= A 1.6e-193)
(* (/ (atan (* -0.5 (/ B C))) (PI)) 180.0)
(if (<= A 112000000.0)
(* (/ (atan 1.0) (PI)) 180.0)
(* (/ (atan (* -2.0 (/ A B))) (PI)) 180.0)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -5 \cdot 10^{-15}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 1.6 \cdot 10^{-193}:\\
\;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 112000000:\\
\;\;\;\;\frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(-2 \cdot \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if A < -4.99999999999999999e-15Initial program 26.3%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6474.0
Applied rewrites74.0%
if -4.99999999999999999e-15 < A < 1.60000000000000003e-193Initial program 52.2%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval10.7
Applied rewrites10.7%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
associate-*r/N/A
mul0-lftN/A
metadata-evalN/A
+-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6442.2
Applied rewrites42.2%
if 1.60000000000000003e-193 < A < 1.12e8Initial program 62.5%
Taylor expanded in B around -inf
Applied rewrites44.1%
if 1.12e8 < A Initial program 81.1%
Taylor expanded in A around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.7
Applied rewrites75.7%
Final simplification58.7%
(FPCore (A B C)
:precision binary64
(if (<= A -5.5e-72)
(* (/ (atan (* (/ B A) 0.5)) (PI)) 180.0)
(if (<= A 2.5e-189)
(* (/ (atan -1.0) (PI)) 180.0)
(if (<= A 112000000.0)
(* (/ (atan 1.0) (PI)) 180.0)
(* (/ (atan (* -2.0 (/ A B))) (PI)) 180.0)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -5.5 \cdot 10^{-72}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 2.5 \cdot 10^{-189}:\\
\;\;\;\;\frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 112000000:\\
\;\;\;\;\frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(-2 \cdot \frac{A}{B}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if A < -5.49999999999999994e-72Initial program 29.5%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6465.7
Applied rewrites65.7%
if -5.49999999999999994e-72 < A < 2.4999999999999999e-189Initial program 54.5%
Taylor expanded in B around inf
Applied rewrites34.4%
if 2.4999999999999999e-189 < A < 1.12e8Initial program 62.5%
Taylor expanded in B around -inf
Applied rewrites44.1%
if 1.12e8 < A Initial program 81.1%
Taylor expanded in A around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.7
Applied rewrites75.7%
Final simplification56.0%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (/ 180.0 (PI))))
(if (<= C -2.9e+81)
(* (/ (atan (* (/ C B) 2.0)) (PI)) 180.0)
(if (<= C 4.4e-137)
(* (atan (/ (- (+ B A)) B)) t_0)
(* (atan (* -0.5 (/ B C))) t_0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{180}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;C \leq -2.9 \cdot 10^{+81}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} \cdot 2\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;C \leq 4.4 \cdot 10^{-137}:\\
\;\;\;\;\tan^{-1} \left(\frac{-\left(B + A\right)}{B}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right) \cdot t\_0\\
\end{array}
\end{array}
if C < -2.9e81Initial program 83.7%
Taylor expanded in C around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6481.2
Applied rewrites81.2%
if -2.9e81 < C < 4.4000000000000002e-137Initial program 63.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-/.f6463.0
lift-*.f64N/A
*-commutativeN/A
Applied rewrites82.4%
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.f6480.5
Applied rewrites80.5%
Taylor expanded in A around 0
Applied rewrites55.0%
if 4.4000000000000002e-137 < C Initial program 31.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-/.f6431.0
lift-*.f64N/A
*-commutativeN/A
Applied rewrites54.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6439.6
lift-hypot.f64N/A
+-commutativeN/A
lower-hypot.f6439.6
Applied rewrites39.6%
Taylor expanded in C around inf
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
--rgt-identityN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6462.1
Applied rewrites62.1%
Final simplification62.8%
(FPCore (A B C)
:precision binary64
(if (<= B -200000.0)
(* (/ (atan 1.0) (PI)) 180.0)
(if (<= B 6e-55)
(* (/ (atan (* -2.0 (/ A B))) (PI)) 180.0)
(* (/ (atan -1.0) (PI)) 180.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -200000:\\
\;\;\;\;\frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;B \leq 6 \cdot 10^{-55}:\\
\;\;\;\;\frac{\tan^{-1} \left(-2 \cdot \frac{A}{B}\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 < -2e5Initial program 51.8%
Taylor expanded in B around -inf
Applied rewrites51.2%
if -2e5 < B < 6.00000000000000033e-55Initial program 59.8%
Taylor expanded in A around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.3
Applied rewrites38.3%
if 6.00000000000000033e-55 < B Initial program 49.1%
Taylor expanded in B around inf
Applied rewrites57.1%
Final simplification46.8%
(FPCore (A B C)
:precision binary64
(if (<= B -2e-136)
(* (/ (atan 1.0) (PI)) 180.0)
(if (<= B 5.2e-209)
(* (/ (atan 0.0) (PI)) 180.0)
(* (/ (atan -1.0) (PI)) 180.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -2 \cdot 10^{-136}:\\
\;\;\;\;\frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;B \leq 5.2 \cdot 10^{-209}:\\
\;\;\;\;\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 < -2e-136Initial program 54.6%
Taylor expanded in B around -inf
Applied rewrites40.5%
if -2e-136 < B < 5.19999999999999969e-209Initial program 58.0%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval30.4
Applied rewrites30.4%
if 5.19999999999999969e-209 < B Initial program 52.9%
Taylor expanded in B around inf
Applied rewrites47.8%
Final simplification40.7%
(FPCore (A B C) :precision binary64 (if (<= B 5.2e-209) (* (/ (atan 0.0) (PI)) 180.0) (* (/ (atan -1.0) (PI)) 180.0)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 5.2 \cdot 10^{-209}:\\
\;\;\;\;\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 < 5.19999999999999969e-209Initial program 55.8%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval15.6
Applied rewrites15.6%
if 5.19999999999999969e-209 < B Initial program 52.9%
Taylor expanded in B around inf
Applied rewrites47.8%
Final simplification27.1%
(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 54.8%
Taylor expanded in B around inf
Applied rewrites19.1%
Final simplification19.1%
herbie shell --seed 2024288
(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))))