
(FPCore (A B C) :precision binary64 (* 180.0 (/ (atan (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))) (PI))))
\begin{array}{l}
\\
180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C) :precision binary64 (* 180.0 (/ (atan (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))) (PI))))
\begin{array}{l}
\\
180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}
\end{array}
(FPCore (A B C)
:precision binary64
(let* ((t_0
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(PI)))))
(if (or (<= t_0 -0.02) (not (<= t_0 0.0)))
(/ (* 180.0 (atan (* (- (- C A) (hypot (- A C) B)) (pow B -1.0)))) (PI))
(/ (* 180.0 (atan (* (/ B A) 0.5))) (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 -0.02 \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\left(\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)\right) \cdot {B}^{-1}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{B}{A} \cdot 0.5\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))) < -0.0200000000000000004 or 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 60.9%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites90.8%
if -0.0200000000000000004 < (*.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 10.5%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites10.5%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.1
Applied rewrites56.1%
Final simplification86.1%
(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 -0.02)
(* 180.0 (/ (atan (* (/ 1.0 B) (- (- C A) B))) (PI)))
(if (<= t_0 5e-41)
(/ (* 180.0 (atan (* (/ B A) 0.5))) (PI))
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (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 -0.02:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - B\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-41}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\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))) < -0.0200000000000000004Initial program 60.7%
Taylor expanded in B around inf
Applied rewrites77.1%
if -0.0200000000000000004 < (*.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))) < 4.9999999999999996e-41Initial program 10.3%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites13.0%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.1
Applied rewrites55.1%
if 4.9999999999999996e-41 < (*.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 61.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6482.0
Applied rewrites82.0%
Final simplification75.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)))))
(if (<= t_0 -0.02)
(* 180.0 (/ (atan (- (/ C B) 1.0)) (PI)))
(if (<= t_0 5e-41)
(/ (* 180.0 (atan (* (/ B A) 0.5))) (PI))
(* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (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 -0.02:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-41}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\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))) < -0.0200000000000000004Initial program 60.7%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6474.6
Applied rewrites74.6%
Taylor expanded in A around 0
lift-/.f64N/A
lift--.f6467.2
Applied rewrites67.2%
if -0.0200000000000000004 < (*.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))) < 4.9999999999999996e-41Initial program 10.3%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites13.0%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.1
Applied rewrites55.1%
if 4.9999999999999996e-41 < (*.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 61.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6482.0
Applied rewrites82.0%
Final simplification71.1%
(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 -0.02)
(* 180.0 (/ (atan (- (/ C B) 1.0)) (PI)))
(if (<= t_0 5e-41)
(/ (* 180.0 (atan (* (/ B A) 0.5))) (PI))
(/ (* 180.0 (atan (- (- (/ 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 -0.02:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-41}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(-\left(\frac{A}{B} - 1\right)\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))) < -0.0200000000000000004Initial program 60.7%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6474.6
Applied rewrites74.6%
Taylor expanded in A around 0
lift-/.f64N/A
lift--.f6467.2
Applied rewrites67.2%
if -0.0200000000000000004 < (*.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))) < 4.9999999999999996e-41Initial program 10.3%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites13.0%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.1
Applied rewrites55.1%
if 4.9999999999999996e-41 < (*.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 61.8%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites92.0%
Taylor expanded in C around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
unpow2N/A
lower-hypot.f6480.0
Applied rewrites80.0%
Taylor expanded in B around -inf
lower--.f64N/A
lower-/.f6472.5
Applied rewrites72.5%
Final simplification67.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)))))
(if (<= t_0 -0.02)
(* 180.0 (/ (atan (- (/ C B) 1.0)) (PI)))
(if (<= t_0 5e-41)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(/ (* 180.0 (atan (- (- (/ 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 -0.02:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-41}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(-\left(\frac{A}{B} - 1\right)\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))) < -0.0200000000000000004Initial program 60.7%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6474.6
Applied rewrites74.6%
Taylor expanded in A around 0
lift-/.f64N/A
lift--.f6467.2
Applied rewrites67.2%
if -0.0200000000000000004 < (*.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))) < 4.9999999999999996e-41Initial program 10.3%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.0
Applied rewrites55.0%
if 4.9999999999999996e-41 < (*.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 61.8%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites92.0%
Taylor expanded in C around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
unpow2N/A
lower-hypot.f6480.0
Applied rewrites80.0%
Taylor expanded in B around -inf
lower--.f64N/A
lower-/.f6472.5
Applied rewrites72.5%
Final simplification67.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)))))
(if (<= t_0 -0.02)
(* 180.0 (/ (atan (- (/ C B) 1.0)) (PI)))
(if (<= t_0 5e-41)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(* 180.0 (/ (atan (- (- (/ 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 -0.02:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-41}:\\
\;\;\;\;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(-\left(\frac{A}{B} - 1\right)\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))) < -0.0200000000000000004Initial program 60.7%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6474.6
Applied rewrites74.6%
Taylor expanded in A around 0
lift-/.f64N/A
lift--.f6467.2
Applied rewrites67.2%
if -0.0200000000000000004 < (*.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))) < 4.9999999999999996e-41Initial program 10.3%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.0
Applied rewrites55.0%
if 4.9999999999999996e-41 < (*.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 61.8%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites92.0%
Taylor expanded in C around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
unpow2N/A
lower-hypot.f6480.0
Applied rewrites80.0%
Taylor expanded in B around -inf
lower--.f64N/A
lower-/.f6472.5
Applied rewrites72.5%
lift-PI.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites72.4%
Final simplification67.5%
(FPCore (A B C)
:precision binary64
(if (<= A -9e+68)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(if (<= A 2.3e-156)
(* 180.0 (/ (atan (/ (- C (hypot C B)) B)) (PI)))
(* 180.0 (/ (atan (/ (+ (hypot A B) A) (- B))) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -9 \cdot 10^{+68}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 2.3 \cdot 10^{-156}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{hypot}\left(A, B\right) + A}{-B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -9.0000000000000007e68Initial program 14.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.4
Applied rewrites71.4%
if -9.0000000000000007e68 < A < 2.3e-156Initial program 55.0%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6479.4
Applied rewrites79.4%
if 2.3e-156 < A Initial program 71.9%
Taylor expanded in C around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6489.0
Applied rewrites89.0%
Final simplification81.4%
(FPCore (A B C)
:precision binary64
(if (<= A -9e+68)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(if (<= A 1.85e+25)
(* 180.0 (/ (atan (/ (- C (hypot C B)) B)) (PI)))
(* 180.0 (/ (atan (- (- (/ A B) 1.0))) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -9 \cdot 10^{+68}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 1.85 \cdot 10^{+25}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-\left(\frac{A}{B} - 1\right)\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -9.0000000000000007e68Initial program 14.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.4
Applied rewrites71.4%
if -9.0000000000000007e68 < A < 1.8499999999999999e25Initial program 56.4%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6480.4
Applied rewrites80.4%
if 1.8499999999999999e25 < A Initial program 78.7%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites93.0%
Taylor expanded in C around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
unpow2N/A
lower-hypot.f6491.4
Applied rewrites91.4%
Taylor expanded in B around -inf
lower--.f64N/A
lower-/.f6483.7
Applied rewrites83.7%
lift-PI.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites83.7%
Final simplification79.5%
(FPCore (A B C)
:precision binary64
(if (<= B 8e-276)
(/ (* 180.0 (atan (+ (/ C B) 1.0))) (PI))
(if (<= B 5.2e-242)
(/ (* (atan 0.0) 180.0) (PI))
(* 180.0 (/ (atan (- (/ C B) 1.0)) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 8 \cdot 10^{-276}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 5.2 \cdot 10^{-242}:\\
\;\;\;\;\frac{\tan^{-1} 0 \cdot 180}{\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 B < 8e-276Initial program 54.3%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites79.6%
Taylor expanded in C around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
unpow2N/A
lower-hypot.f6469.4
Applied rewrites69.4%
Taylor expanded in A around 0
inv-powN/A
*-commutativeN/A
pow2N/A
pow2N/A
lower-/.f64N/A
lower--.f64N/A
pow2N/A
unpow2N/A
lower-hypot.f6461.7
Applied rewrites61.7%
Taylor expanded in B around -inf
+-commutativeN/A
lower-+.f64N/A
lift-/.f6457.3
Applied rewrites57.3%
if 8e-276 < B < 5.20000000000000034e-242Initial program 37.2%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites90.1%
Taylor expanded in C around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
unpow2N/A
lower-hypot.f6472.5
Applied rewrites72.5%
Taylor expanded in C around inf
inv-powN/A
*-commutativeN/A
pow2N/A
pow2N/A
associate-*r/N/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
mul0-lftN/A
lift-/.f64N/A
mul0-lft63.7
Applied rewrites63.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6463.7
lift-/.f64N/A
div063.7
Applied rewrites63.7%
if 5.20000000000000034e-242 < B Initial program 55.2%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6469.8
Applied rewrites69.8%
Taylor expanded in A around 0
lift-/.f64N/A
lift--.f6462.7
Applied rewrites62.7%
Final simplification60.3%
(FPCore (A B C)
:precision binary64
(if (<= B -2.4e-21)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 2.6e-230)
(* 180.0 (/ (atan (/ (- A) B)) (PI)))
(* 180.0 (/ (atan (- (/ C B) 1.0)) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -2.4 \cdot 10^{-21}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 2.6 \cdot 10^{-230}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\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 B < -2.3999999999999999e-21Initial program 53.4%
Taylor expanded in B around -inf
Applied rewrites64.1%
if -2.3999999999999999e-21 < B < 2.6000000000000001e-230Initial program 55.2%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6448.0
Applied rewrites48.0%
Taylor expanded in A around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6439.0
Applied rewrites39.0%
if 2.6000000000000001e-230 < B Initial program 53.8%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6468.8
Applied rewrites68.8%
Taylor expanded in A around 0
lift-/.f64N/A
lift--.f6463.1
Applied rewrites63.1%
Final simplification57.6%
(FPCore (A B C)
:precision binary64
(if (<= B -2.4e-21)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 2.3e-34)
(/ (* 180.0 (atan (- (/ A B)))) (PI))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -2.4 \cdot 10^{-21}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 2.3 \cdot 10^{-34}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(-\frac{A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -2.3999999999999999e-21Initial program 53.4%
Taylor expanded in B around -inf
Applied rewrites64.1%
if -2.3999999999999999e-21 < B < 2.30000000000000011e-34Initial program 52.6%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites72.6%
Taylor expanded in C around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
unpow2N/A
lower-hypot.f6455.7
Applied rewrites55.7%
Taylor expanded in B around -inf
lower--.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
Taylor expanded in A around inf
lift-/.f6433.9
Applied rewrites33.9%
if 2.30000000000000011e-34 < B Initial program 56.5%
Taylor expanded in B around inf
Applied rewrites70.4%
Final simplification53.5%
(FPCore (A B C)
:precision binary64
(if (<= B -2.4e-21)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 2.3e-34)
(* 180.0 (/ (atan (/ (- A) B)) (PI)))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -2.4 \cdot 10^{-21}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 2.3 \cdot 10^{-34}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -2.3999999999999999e-21Initial program 53.4%
Taylor expanded in B around -inf
Applied rewrites64.1%
if -2.3999999999999999e-21 < B < 2.30000000000000011e-34Initial program 52.6%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6446.7
Applied rewrites46.7%
Taylor expanded in A around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6433.9
Applied rewrites33.9%
if 2.30000000000000011e-34 < B Initial program 56.5%
Taylor expanded in B around inf
Applied rewrites70.4%
Final simplification53.5%
(FPCore (A B C)
:precision binary64
(if (<= B -6.2e-15)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 4.75e-91)
(* 180.0 (/ (atan (/ C B)) (PI)))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -6.2 \cdot 10^{-15}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 4.75 \cdot 10^{-91}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -6.1999999999999998e-15Initial program 52.7%
Taylor expanded in B around -inf
Applied rewrites64.8%
if -6.1999999999999998e-15 < B < 4.75e-91Initial program 53.1%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6446.7
Applied rewrites46.7%
Taylor expanded in C around inf
lift-/.f6433.7
Applied rewrites33.7%
if 4.75e-91 < B Initial program 55.9%
Taylor expanded in B around inf
Applied rewrites64.6%
Final simplification53.1%
(FPCore (A B C) :precision binary64 (if (<= B 2.6e-230) (* 180.0 (/ (atan (- (- (/ A B) 1.0))) (PI))) (* 180.0 (/ (atan (- (/ C B) 1.0)) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 2.6 \cdot 10^{-230}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-\left(\frac{A}{B} - 1\right)\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 B < 2.6000000000000001e-230Initial program 54.3%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites81.1%
Taylor expanded in C around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
unpow2N/A
lower-hypot.f6469.9
Applied rewrites69.9%
Taylor expanded in B around -inf
lower--.f64N/A
lower-/.f6459.0
Applied rewrites59.0%
lift-PI.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites59.0%
if 2.6000000000000001e-230 < B Initial program 53.8%
Taylor expanded in B around inf
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6468.8
Applied rewrites68.8%
Taylor expanded in A around 0
lift-/.f64N/A
lift--.f6463.1
Applied rewrites63.1%
Final simplification61.0%
(FPCore (A B C)
:precision binary64
(if (<= B -3.8e-98)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 5.7e-99)
(/ (* (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^{-98}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 5.7 \cdot 10^{-99}:\\
\;\;\;\;\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.8000000000000003e-98Initial program 55.0%
Taylor expanded in B around -inf
Applied rewrites58.2%
if -3.8000000000000003e-98 < B < 5.70000000000000032e-99Initial program 50.4%
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites76.2%
Taylor expanded in C around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
unpow2N/A
lower-hypot.f6457.3
Applied rewrites57.3%
Taylor expanded in C around inf
inv-powN/A
*-commutativeN/A
pow2N/A
pow2N/A
associate-*r/N/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
mul0-lftN/A
lift-/.f64N/A
mul0-lft29.6
Applied rewrites29.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6429.6
lift-/.f64N/A
div029.6
Applied rewrites29.6%
if 5.70000000000000032e-99 < B Initial program 56.4%
Taylor expanded in B around inf
Applied rewrites64.1%
Final simplification51.1%
(FPCore (A B C) :precision binary64 (if (<= B -1e-309) (* 180.0 (/ (atan 1.0) (PI))) (* 180.0 (/ (atan -1.0) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -1 \cdot 10^{-309}:\\
\;\;\;\;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 < -1.000000000000002e-309Initial program 55.2%
Taylor expanded in B around -inf
Applied rewrites45.6%
if -1.000000000000002e-309 < B Initial program 53.1%
Taylor expanded in B around inf
Applied rewrites45.3%
Final simplification45.4%
(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.0%
Taylor expanded in B around inf
Applied rewrites26.6%
Final simplification26.6%
herbie shell --seed 2025037
(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))))