
(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 (<= C 2.9e+181) (/ (* (atan (/ (- (- C A) (hypot (- A C) B)) B)) 180.0) (PI)) (/ (* (atan (* -0.5 (/ B C))) 180.0) (PI))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq 2.9 \cdot 10^{+181}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < 2.9e181Initial program 58.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites78.2%
if 2.9e181 < C Initial program 12.5%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft95.4
Applied rewrites95.4%
Applied rewrites95.5%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(*
(pow B -1.0)
(- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -40.0)
(* 180.0 (/ (atan (- t_1 1.0)) (PI)))
(if (<= t_0 0.0)
(* (/ (atan (* -0.5 (/ B C))) (PI)) 180.0)
(* 180.0 (/ (atan (+ t_1 1.0)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left({B}^{-1} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -40:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 + 1\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -40Initial program 64.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.8
Applied rewrites79.8%
if -40 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0Initial program 17.4%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft54.5
Applied rewrites54.5%
Applied rewrites54.5%
if -0.0 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) Initial program 55.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6468.4
Applied rewrites68.4%
Final simplification71.5%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(*
(pow B -1.0)
(- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI)))))
(if (<= t_0 -40.0)
(/ (* (atan (/ (- C B) B)) 180.0) (PI))
(if (<= t_0 0.0)
(* (/ (atan (* -0.5 (/ B C))) (PI)) 180.0)
(* 180.0 (/ (atan (+ (/ (- C A) B) 1.0)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left({B}^{-1} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;t\_0 \leq -40:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - B}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -40Initial program 64.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites86.1%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6465.6
Applied rewrites65.6%
Taylor expanded in C around 0
Applied rewrites60.1%
if -40 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -0.0Initial program 17.4%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft54.5
Applied rewrites54.5%
Applied rewrites54.5%
if -0.0 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) Initial program 55.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6468.4
Applied rewrites68.4%
Final simplification62.5%
(FPCore (A B C)
:precision binary64
(if (<= A -5.6e+147)
(/ (* (atan (/ (* (fma (/ C A) B B) 0.5) A)) 180.0) (PI))
(if (<= A 3.6e-47)
(* 180.0 (/ (atan (/ (- C (hypot C B)) B)) (PI)))
(/ (* (atan (/ (- (- C A) (sqrt (fma C C (* B B)))) B)) 180.0) (PI)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -5.6 \cdot 10^{+147}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{C}{A}, B, B\right) \cdot 0.5}{A}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 3.6 \cdot 10^{-47}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{\mathsf{fma}\left(C, C, B \cdot B\right)}}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -5.6000000000000002e147Initial program 19.0%
Taylor expanded in A around -inf
associate-*r/N/A
lower-/.f64N/A
distribute-lft-outN/A
associate-*r*N/A
metadata-evalN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6481.1
Applied rewrites81.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites81.3%
if -5.6000000000000002e147 < A < 3.59999999999999991e-47Initial program 49.4%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6469.6
Applied rewrites69.6%
if 3.59999999999999991e-47 < A Initial program 88.9%
Taylor expanded in A around 0
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6488.9
Applied rewrites88.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites88.9%
Final simplification75.9%
(FPCore (A B C)
:precision binary64
(if (<= A -6e+27)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(if (<= A -6.5e-190)
(* (/ (atan (* -0.5 (/ B C))) (PI)) 180.0)
(if (<= A 5.9e-50)
(/ (* (atan (/ (- C B) B)) 180.0) (PI))
(/ (* (atan (- 1.0 (/ A B))) 180.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -6 \cdot 10^{+27}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq -6.5 \cdot 10^{-190}:\\
\;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 5.9 \cdot 10^{-50}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - B}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(1 - \frac{A}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -5.99999999999999953e27Initial program 30.2%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6462.1
Applied rewrites62.1%
if -5.99999999999999953e27 < A < -6.4999999999999997e-190Initial program 41.1%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft47.0
Applied rewrites47.0%
Applied rewrites47.0%
if -6.4999999999999997e-190 < A < 5.9e-50Initial program 59.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.7%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6481.5
Applied rewrites81.5%
Taylor expanded in C around 0
Applied rewrites59.2%
if 5.9e-50 < A Initial program 87.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites90.7%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6480.4
Applied rewrites80.4%
Taylor expanded in C around 0
Applied rewrites78.0%
Final simplification61.8%
(FPCore (A B C)
:precision binary64
(if (<= A -6e+27)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(if (<= A -6.5e-190)
(* 180.0 (/ (atan (* B (/ -0.5 C))) (PI)))
(if (<= A 5.9e-50)
(/ (* (atan (/ (- C B) B)) 180.0) (PI))
(/ (* (atan (- 1.0 (/ A B))) 180.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -6 \cdot 10^{+27}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq -6.5 \cdot 10^{-190}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 5.9 \cdot 10^{-50}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - B}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(1 - \frac{A}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -5.99999999999999953e27Initial program 30.2%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6462.1
Applied rewrites62.1%
if -5.99999999999999953e27 < A < -6.4999999999999997e-190Initial program 41.1%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft47.0
Applied rewrites47.0%
Applied rewrites47.0%
if -6.4999999999999997e-190 < A < 5.9e-50Initial program 59.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.7%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6481.5
Applied rewrites81.5%
Taylor expanded in C around 0
Applied rewrites59.2%
if 5.9e-50 < A Initial program 87.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites90.7%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6480.4
Applied rewrites80.4%
Taylor expanded in C around 0
Applied rewrites78.0%
Final simplification61.8%
(FPCore (A B C)
:precision binary64
(if (<= B -3.8e-162)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 1.1e-288)
(/ (* (atan 0.0) 180.0) (PI))
(if (<= B 8.2e-19)
(/ (* (atan (/ (- A) B)) 180.0) (PI))
(* 180.0 (/ (atan -1.0) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -3.8 \cdot 10^{-162}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 1.1 \cdot 10^{-288}:\\
\;\;\;\;\frac{\tan^{-1} 0 \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 8.2 \cdot 10^{-19}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-A}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -3.80000000000000005e-162Initial program 49.2%
Taylor expanded in B around -inf
Applied rewrites44.7%
if -3.80000000000000005e-162 < B < 1.1000000000000001e-288Initial program 50.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites79.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6438.7
lift-hypot.f64N/A
pow1/2N/A
pow2N/A
lift--.f64N/A
pow2N/A
pow1/2N/A
lift--.f64N/A
pow2N/A
pow2N/A
+-commutativeN/A
lower-hypot.f6438.7
Applied rewrites38.7%
Taylor expanded in C around inf
mul-1-negN/A
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-eval43.0
Applied rewrites43.0%
if 1.1000000000000001e-288 < B < 8.1999999999999997e-19Initial program 66.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites73.0%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6456.4
Applied rewrites56.4%
Taylor expanded in A around inf
Applied rewrites43.9%
if 8.1999999999999997e-19 < B Initial program 52.5%
Taylor expanded in B around inf
Applied rewrites61.6%
Final simplification49.1%
(FPCore (A B C)
:precision binary64
(if (<= C -3.6e-144)
(/ (* (atan (/ (- C B) B)) 180.0) (PI))
(if (<= C 1e+61)
(/ (* (atan (- 1.0 (/ A B))) 180.0) (PI))
(* 180.0 (/ (atan (* B (/ -0.5 C))) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -3.6 \cdot 10^{-144}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - B}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;C \leq 10^{+61}:\\
\;\;\;\;\frac{\tan^{-1} \left(1 - \frac{A}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < -3.6e-144Initial program 74.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites91.8%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6483.7
Applied rewrites83.7%
Taylor expanded in C around 0
Applied rewrites70.3%
if -3.6e-144 < C < 9.99999999999999949e60Initial program 57.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites74.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6445.3
Applied rewrites45.3%
Taylor expanded in C around 0
Applied rewrites45.4%
if 9.99999999999999949e60 < C Initial program 24.3%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-/.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft71.8
Applied rewrites71.8%
Applied rewrites71.7%
Final simplification58.5%
(FPCore (A B C)
:precision binary64
(if (<= B -3.7e+27)
(/ (* (atan (- 1.0 (/ A B))) 180.0) (PI))
(if (<= B 3.4e-19)
(/ (* (atan (/ (- C A) B)) 180.0) (PI))
(/ (* (atan (/ (- C B) B)) 180.0) (PI)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -3.7 \cdot 10^{+27}:\\
\;\;\;\;\frac{\tan^{-1} \left(1 - \frac{A}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 3.4 \cdot 10^{-19}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - B}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -3.70000000000000002e27Initial program 50.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites71.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6469.9
Applied rewrites69.9%
Taylor expanded in C around 0
Applied rewrites65.2%
if -3.70000000000000002e27 < B < 3.4000000000000002e-19Initial program 57.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites69.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6449.3
Applied rewrites49.3%
Taylor expanded in B around 0
Applied rewrites46.3%
if 3.4000000000000002e-19 < B Initial program 52.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites80.2%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6470.9
Applied rewrites70.9%
Taylor expanded in C around 0
Applied rewrites68.0%
(FPCore (A B C)
:precision binary64
(if (<= B -3.7e+27)
(/ (* (atan (- 1.0 (/ A B))) 180.0) (PI))
(if (<= B 3.6e-16)
(/ (* (atan (/ (- C A) B)) 180.0) (PI))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -3.7 \cdot 10^{+27}:\\
\;\;\;\;\frac{\tan^{-1} \left(1 - \frac{A}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 3.6 \cdot 10^{-16}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -3.70000000000000002e27Initial program 50.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites71.1%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6469.9
Applied rewrites69.9%
Taylor expanded in C around 0
Applied rewrites65.2%
if -3.70000000000000002e27 < B < 3.59999999999999983e-16Initial program 57.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites69.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6449.3
Applied rewrites49.3%
Taylor expanded in B around 0
Applied rewrites46.3%
if 3.59999999999999983e-16 < B Initial program 52.5%
Taylor expanded in B around inf
Applied rewrites61.6%
Final simplification55.3%
(FPCore (A B C) :precision binary64 (if (<= B 8.2e-19) (/ (* (atan (- 1.0 (/ A B))) 180.0) (PI)) (* 180.0 (/ (atan -1.0) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 8.2 \cdot 10^{-19}:\\
\;\;\;\;\frac{\tan^{-1} \left(1 - \frac{A}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < 8.1999999999999997e-19Initial program 54.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites70.0%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6456.4
Applied rewrites56.4%
Taylor expanded in C around 0
Applied rewrites45.3%
if 8.1999999999999997e-19 < B Initial program 52.5%
Taylor expanded in B around inf
Applied rewrites61.6%
Final simplification49.9%
(FPCore (A B C)
:precision binary64
(if (<= B -3.8e-162)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 2e-262)
(/ (* (atan 0.0) 180.0) (PI))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -3.8 \cdot 10^{-162}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 2 \cdot 10^{-262}:\\
\;\;\;\;\frac{\tan^{-1} 0 \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -3.80000000000000005e-162Initial program 49.2%
Taylor expanded in B around -inf
Applied rewrites44.7%
if -3.80000000000000005e-162 < B < 2.00000000000000002e-262Initial program 52.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites78.2%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6442.3
lift-hypot.f64N/A
pow1/2N/A
pow2N/A
lift--.f64N/A
pow2N/A
pow1/2N/A
lift--.f64N/A
pow2N/A
pow2N/A
+-commutativeN/A
lower-hypot.f6442.3
Applied rewrites42.3%
Taylor expanded in C around inf
mul-1-negN/A
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-eval38.5
Applied rewrites38.5%
if 2.00000000000000002e-262 < B Initial program 58.6%
Taylor expanded in B around inf
Applied rewrites44.5%
Final simplification43.7%
(FPCore (A B C) :precision binary64 (if (<= B -5e-310) (* 180.0 (/ (atan 1.0) (PI))) (* 180.0 (/ (atan -1.0) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -5 \cdot 10^{-310}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -4.999999999999985e-310Initial program 49.2%
Taylor expanded in B around -inf
Applied rewrites36.3%
if -4.999999999999985e-310 < B Initial program 58.8%
Taylor expanded in B around inf
Applied rewrites42.1%
Final simplification39.3%
(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 54.2%
Taylor expanded in B around inf
Applied rewrites22.6%
Final simplification22.6%
herbie shell --seed 2024351
(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))))