
(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 1.08e+123) (/ (* (atan (/ (- (- C A) (hypot B (- A C))) B)) 180.0) (PI)) (* 180.0 (/ (atan (fma -0.5 (/ (fma (/ B C) A B) C) (/ 0.0 B))) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq 1.08 \cdot 10^{+123}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, A - C\right)}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(-0.5, \frac{\mathsf{fma}\left(\frac{B}{C}, A, B\right)}{C}, \frac{0}{B}\right)\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < 1.0799999999999999e123Initial program 65.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites85.5%
if 1.0799999999999999e123 < C Initial program 17.0%
Taylor expanded in C around inf
+-commutativeN/A
associate-*r/N/A
unpow2N/A
associate-/r*N/A
associate-/l*N/A
div-addN/A
distribute-lft-outN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
distribute-frac-negN/A
Applied rewrites84.3%
Final simplification85.3%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -1.0)
(/ (* (atan (- t_1 1.0)) 180.0) (PI))
(if (<= t_0 1e-62)
(/ (* (atan (/ (* 0.5 (* (+ (/ B C) (/ B A)) C)) A)) 180.0) (PI))
(/ (* (atan (+ t_1 1.0)) 180.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 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)}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -1:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 10^{-62}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{0.5 \cdot \left(\left(\frac{B}{C} + \frac{B}{A}\right) \cdot C\right)}{A}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right) \cdot 180}{\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))) < -1Initial program 64.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites88.4%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.9
Applied rewrites74.9%
if -1 < (*.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))) < 1e-62Initial program 25.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites28.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-/.f6457.7
Applied rewrites57.7%
Taylor expanded in C around inf
Applied rewrites57.7%
if 1e-62 < (*.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 63.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites88.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6481.9
Applied rewrites81.9%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -1.0)
(/ (* (atan (- t_1 1.0)) 180.0) (PI))
(if (<= t_0 1e-62)
(/ (* (atan (/ (* 0.5 (fma (/ C A) B B)) A)) 180.0) (PI))
(/ (* (atan (+ t_1 1.0)) 180.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 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)}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -1:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 10^{-62}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{0.5 \cdot \mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right) \cdot 180}{\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))) < -1Initial program 64.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites88.4%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.9
Applied rewrites74.9%
if -1 < (*.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))) < 1e-62Initial program 25.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites28.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-/.f6457.7
Applied rewrites57.7%
if 1e-62 < (*.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 63.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites88.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6481.9
Applied rewrites81.9%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -1.0)
(/ (* (atan (- t_1 1.0)) 180.0) (PI))
(if (<= t_0 1e-62)
(* 180.0 (/ (atan (/ (* 0.5 (fma (/ C A) B B)) A)) (PI)))
(/ (* (atan (+ t_1 1.0)) 180.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 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)}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -1:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 10^{-62}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{0.5 \cdot \mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right) \cdot 180}{\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))) < -1Initial program 64.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites88.4%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.9
Applied rewrites74.9%
if -1 < (*.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))) < 1e-62Initial program 25.3%
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-/.f6457.6
Applied rewrites57.6%
if 1e-62 < (*.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 63.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites88.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6481.9
Applied rewrites81.9%
Final simplification75.5%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -1.0)
(/ (* (atan (- t_1 1.0)) 180.0) (PI))
(if (<= t_0 1e-62)
(/ (* (atan (* (/ B A) 0.5)) 180.0) (PI))
(/ (* (atan (+ t_1 1.0)) 180.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 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)}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -1:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 10^{-62}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right) \cdot 180}{\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))) < -1Initial program 64.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites88.4%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.9
Applied rewrites74.9%
if -1 < (*.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))) < 1e-62Initial program 25.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites28.0%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.8
Applied rewrites56.8%
if 1e-62 < (*.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 63.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites88.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6481.9
Applied rewrites81.9%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -1.0)
(* 180.0 (/ (atan (- t_1 1.0)) (PI)))
(if (<= t_0 1e-62)
(/ (* (atan (* (/ B A) 0.5)) 180.0) (PI))
(/ (* (atan (+ t_1 1.0)) 180.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 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)}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -1:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 10^{-62}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right) \cdot 180}{\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))) < -1Initial program 64.7%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.8
Applied rewrites74.8%
if -1 < (*.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))) < 1e-62Initial program 25.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites28.0%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.8
Applied rewrites56.8%
if 1e-62 < (*.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 63.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites88.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6481.9
Applied rewrites81.9%
Final simplification75.3%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -1.0)
(* 180.0 (/ (atan (- t_1 1.0)) (PI)))
(if (<= t_0 1e-62)
(/ (* (atan (* (/ B A) 0.5)) 180.0) (PI))
(* 180.0 (/ (atan (+ t_1 1.0)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 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)}\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -1:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 10^{-62}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot 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 #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))) < -1Initial program 64.7%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.8
Applied rewrites74.8%
if -1 < (*.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))) < 1e-62Initial program 25.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites28.0%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.8
Applied rewrites56.8%
if 1e-62 < (*.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 63.6%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6481.9
Applied rewrites81.9%
Final simplification75.3%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI)))))
(if (<= t_0 -1.0)
(/ (* (atan (/ (- C B) B)) 180.0) (PI))
(if (<= t_0 1e-62)
(/ (* (atan (* (/ B A) 0.5)) 180.0) (PI))
(* 180.0 (/ (atan (+ (/ (- C A) B) 1.0)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 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)}\\
\mathbf{if}\;t\_0 \leq -1:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - B}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 10^{-62}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\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))) < -1Initial program 64.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites88.4%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6469.0
Applied rewrites69.0%
Taylor expanded in C around 0
Applied rewrites59.4%
if -1 < (*.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))) < 1e-62Initial program 25.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites28.0%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.8
Applied rewrites56.8%
if 1e-62 < (*.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 63.6%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6481.9
Applied rewrites81.9%
Final simplification68.7%
(FPCore (A B C)
:precision binary64
(if (<= A -1.5e-43)
(/ (* (atan (/ (* 0.5 (* (+ (/ B C) (/ B A)) C)) A)) 180.0) (PI))
(if (<= A 5.5e+28)
(/ (* (atan (/ (- C (hypot B C)) B)) 180.0) (PI))
(* 180.0 (/ (atan (- (/ (- C A) B) 1.0)) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -1.5 \cdot 10^{-43}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{0.5 \cdot \left(\left(\frac{B}{C} + \frac{B}{A}\right) \cdot C\right)}{A}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 5.5 \cdot 10^{+28}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -1.50000000000000002e-43Initial program 32.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites56.2%
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-/.f6477.0
Applied rewrites77.0%
Taylor expanded in C around inf
Applied rewrites77.0%
if -1.50000000000000002e-43 < A < 5.5000000000000003e28Initial program 61.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.8%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6481.1
Applied rewrites81.1%
if 5.5000000000000003e28 < A Initial program 77.5%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6483.4
Applied rewrites83.4%
Final simplification80.7%
(FPCore (A B C)
:precision binary64
(if (<= A -1.5e-43)
(/ (* (atan (/ (* 0.5 (* (+ (/ B C) (/ B A)) C)) A)) 180.0) (PI))
(if (<= A 5.5e+28)
(* 180.0 (/ (atan (/ (- C (hypot B C)) B)) (PI)))
(* 180.0 (/ (atan (- (/ (- C A) B) 1.0)) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -1.5 \cdot 10^{-43}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{0.5 \cdot \left(\left(\frac{B}{C} + \frac{B}{A}\right) \cdot C\right)}{A}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 5.5 \cdot 10^{+28}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -1.50000000000000002e-43Initial program 32.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites56.2%
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-/.f6477.0
Applied rewrites77.0%
Taylor expanded in C around inf
Applied rewrites77.0%
if -1.50000000000000002e-43 < A < 5.5000000000000003e28Initial program 61.8%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6481.1
Applied rewrites81.1%
if 5.5000000000000003e28 < A Initial program 77.5%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6483.4
Applied rewrites83.4%
Final simplification80.7%
(FPCore (A B C)
:precision binary64
(if (<= B -1.8e-30)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B -6.2e-249)
(* 180.0 (/ (atan (* (/ A B) -2.0)) (PI)))
(if (<= B 9.2e-248)
(* 180.0 (/ (atan (/ 0.0 B)) (PI)))
(/ (* (atan (/ (- C B) B)) 180.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -1.8 \cdot 10^{-30}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq -6.2 \cdot 10^{-249}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{A}{B} \cdot -2\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 9.2 \cdot 10^{-248}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{0}{B}\right)}{\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 < -1.8000000000000002e-30Initial program 48.3%
Taylor expanded in B around -inf
Applied rewrites65.6%
if -1.8000000000000002e-30 < B < -6.19999999999999971e-249Initial program 73.8%
Taylor expanded in A around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6457.7
Applied rewrites57.7%
if -6.19999999999999971e-249 < B < 9.2000000000000001e-248Initial program 60.1%
Taylor expanded in C around inf
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-lft48.0
Applied rewrites48.0%
if 9.2000000000000001e-248 < B Initial program 58.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites77.8%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6462.1
Applied rewrites62.1%
Taylor expanded in C around 0
Applied rewrites55.8%
Final simplification58.1%
(FPCore (A B C)
:precision binary64
(if (<= A -2.45e-56)
(/ (* (atan (* (/ B A) 0.5)) 180.0) (PI))
(if (<= A 5e-19)
(/ (* (atan (/ (- C B) B)) 180.0) (PI))
(* 180.0 (/ (atan (* (/ A B) -2.0)) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -2.45 \cdot 10^{-56}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 5 \cdot 10^{-19}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - B}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{A}{B} \cdot -2\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -2.45e-56Initial program 33.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites56.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.8
Applied rewrites71.8%
if -2.45e-56 < A < 5.0000000000000004e-19Initial program 60.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites83.8%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6481.1
Applied rewrites81.1%
Taylor expanded in C around 0
Applied rewrites47.8%
if 5.0000000000000004e-19 < A Initial program 75.8%
Taylor expanded in A around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6467.4
Applied rewrites67.4%
Final simplification59.6%
(FPCore (A B C)
:precision binary64
(if (<= A -2.45e-56)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(if (<= A 5e-19)
(/ (* (atan (/ (- C B) B)) 180.0) (PI))
(* 180.0 (/ (atan (* (/ A B) -2.0)) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -2.45 \cdot 10^{-56}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 5 \cdot 10^{-19}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - B}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{A}{B} \cdot -2\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -2.45e-56Initial program 33.1%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.8
Applied rewrites71.8%
if -2.45e-56 < A < 5.0000000000000004e-19Initial program 60.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites83.8%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6481.1
Applied rewrites81.1%
Taylor expanded in C around 0
Applied rewrites47.8%
if 5.0000000000000004e-19 < A Initial program 75.8%
Taylor expanded in A around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6467.4
Applied rewrites67.4%
Final simplification59.6%
(FPCore (A B C)
:precision binary64
(if (<= B -5e-150)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 1.52e-91)
(* 180.0 (/ (atan (/ 0.0 B)) (PI)))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -5 \cdot 10^{-150}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 1.52 \cdot 10^{-91}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{0}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -4.9999999999999999e-150Initial program 55.4%
Taylor expanded in B around -inf
Applied rewrites53.6%
if -4.9999999999999999e-150 < B < 1.52e-91Initial program 61.9%
Taylor expanded in C around inf
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-lft32.6
Applied rewrites32.6%
if 1.52e-91 < B Initial program 59.2%
Taylor expanded in B around inf
Applied rewrites45.6%
Final simplification44.3%
(FPCore (A B C) :precision binary64 (if (<= B -8.5e-48) (* 180.0 (/ (atan 1.0) (PI))) (/ (* (atan (/ (- C B) B)) 180.0) (PI))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -8.5 \cdot 10^{-48}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\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 < -8.5000000000000004e-48Initial program 51.8%
Taylor expanded in B around -inf
Applied rewrites62.5%
if -8.5000000000000004e-48 < B Initial program 61.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites80.0%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6459.6
Applied rewrites59.6%
Taylor expanded in C around 0
Applied rewrites48.0%
Final simplification52.2%
(FPCore (A B C) :precision binary64 (if (<= B -6.5e-294) (* 180.0 (/ (atan 1.0) (PI))) (* 180.0 (/ (atan -1.0) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -6.5 \cdot 10^{-294}:\\
\;\;\;\;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 < -6.4999999999999995e-294Initial program 59.3%
Taylor expanded in B around -inf
Applied rewrites44.0%
if -6.4999999999999995e-294 < B Initial program 58.1%
Taylor expanded in B around inf
Applied rewrites32.6%
Final simplification38.1%
(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 58.7%
Taylor expanded in B around inf
Applied rewrites17.8%
Final simplification17.8%
herbie shell --seed 2025006
(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))))