
(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
(let* ((t_0
(* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B)))
(t_1 (pow (PI) 0.25))
(t_2
(/
(* (/ 180.0 t_1) (/ (atan (/ (- (- C A) (hypot B (- A C))) B)) t_1))
(sqrt (PI)))))
(if (<= t_0 -5e-48)
t_2
(if (<= t_0 0.0) (/ 180.0 (/ (PI) (atan (* (/ B C) -0.5)))) t_2))))\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 := {\mathsf{PI}\left(\right)}^{0.25}\\
t_2 := \frac{\frac{180}{t\_1} \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, A - C\right)}{B}\right)}{t\_1}}{\sqrt{\mathsf{PI}\left(\right)}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-48}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{180}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\frac{B}{C} \cdot -0.5\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -4.9999999999999999e-48 or 0.0 < (*.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 59.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-PI.f64N/A
add-sqr-sqrtN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites87.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-sqrt.f64N/A
pow1/2N/A
sqr-powN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites87.3%
if -4.9999999999999999e-48 < (*.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.0Initial program 21.0%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6456.1
Applied rewrites56.1%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6456.2
Applied rewrites56.2%
Final simplification83.1%
(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 (sqrt (PI)))
(t_2
(/ (* (/ 180.0 t_1) (atan (/ (- (- C A) (hypot (- A C) B)) B))) t_1)))
(if (<= t_0 -5e-48)
t_2
(if (<= t_0 0.0) (/ 180.0 (/ (PI) (atan (* (/ B C) -0.5)))) t_2))))\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 := \sqrt{\mathsf{PI}\left(\right)}\\
t_2 := \frac{\frac{180}{t\_1} \cdot \tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)}{B}\right)}{t\_1}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-48}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{180}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\frac{B}{C} \cdot -0.5\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -4.9999999999999999e-48 or 0.0 < (*.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 59.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-PI.f64N/A
add-sqr-sqrtN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites87.3%
if -4.9999999999999999e-48 < (*.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.0Initial program 21.0%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6456.1
Applied rewrites56.1%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6456.2
Applied rewrites56.2%
Final simplification83.0%
(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 -1e-15)
(* (/ (atan (- t_1 1.0)) (PI)) 180.0)
(if (<= t_0 0.0001)
(/ 180.0 (/ (PI) (atan (* (/ B C) -0.5))))
(/ (* (atan (+ t_1 1.0)) 180.0) (PI))))))\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 -1 \cdot 10^{-15}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 0.0001:\\
\;\;\;\;\frac{180}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(\frac{B}{C} \cdot -0.5\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -1.0000000000000001e-15Initial program 58.2%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6480.2
Applied rewrites80.2%
if -1.0000000000000001e-15 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < 1.00000000000000005e-4Initial program 21.7%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6453.9
Applied rewrites53.9%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6454.0
Applied rewrites54.0%
if 1.00000000000000005e-4 < (*.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 61.5%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6426.6
Applied rewrites26.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites26.6%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6477.4
Applied rewrites77.4%
Final simplification75.1%
(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 -1e-15)
(* (/ (atan (- t_1 1.0)) (PI)) 180.0)
(if (<= t_0 0.0001)
(* (/ (atan (* (/ -0.5 C) B)) (PI)) 180.0)
(/ (* (atan (+ t_1 1.0)) 180.0) (PI))))))\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 -1 \cdot 10^{-15}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 0.0001:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-0.5}{C} \cdot B\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -1.0000000000000001e-15Initial program 58.2%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6480.2
Applied rewrites80.2%
if -1.0000000000000001e-15 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < 1.00000000000000005e-4Initial program 21.7%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6453.9
Applied rewrites53.9%
Applied rewrites53.9%
if 1.00000000000000005e-4 < (*.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 61.5%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6426.6
Applied rewrites26.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites26.6%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6477.4
Applied rewrites77.4%
Final simplification75.1%
(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 -1e-15)
(* (/ (atan (- t_1 1.0)) (PI)) 180.0)
(if (<= t_0 0.0001)
(* (/ (atan (* (/ -0.5 C) B)) (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 -1 \cdot 10^{-15}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;t\_0 \leq 0.0001:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-0.5}{C} \cdot B\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)))))) < -1.0000000000000001e-15Initial program 58.2%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6480.2
Applied rewrites80.2%
if -1.0000000000000001e-15 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < 1.00000000000000005e-4Initial program 21.7%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6453.9
Applied rewrites53.9%
Applied rewrites53.9%
if 1.00000000000000005e-4 < (*.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 61.5%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6477.4
Applied rewrites77.4%
Final simplification75.1%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (sqrt (PI))))
(if (<= C -5e-11)
(* (/ (atan (- (/ (- C A) B) 1.0)) (PI)) 180.0)
(if (<= C 5.6e+126)
(/ (* (atan (/ (- (+ (hypot B A) A)) B)) (/ 180.0 t_0)) t_0)
(* (/ (atan (* (/ -0.5 C) B)) (PI)) 180.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;C \leq -5 \cdot 10^{-11}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} - 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;C \leq 5.6 \cdot 10^{+126}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-\left(\mathsf{hypot}\left(B, A\right) + A\right)}{B}\right) \cdot \frac{180}{t\_0}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-0.5}{C} \cdot B\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if C < -5.00000000000000018e-11Initial program 71.1%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6478.5
Applied rewrites78.5%
if -5.00000000000000018e-11 < C < 5.60000000000000018e126Initial program 52.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-PI.f64N/A
add-sqr-sqrtN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites77.7%
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.f6474.7
Applied rewrites74.7%
if 5.60000000000000018e126 < C Initial program 17.3%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6482.2
Applied rewrites82.2%
Applied rewrites82.2%
Final simplification76.5%
(FPCore (A B C)
:precision binary64
(if (<= A -4.3e-190)
(/ (atan (* 0.5 (/ B A))) (* 0.005555555555555556 (PI)))
(if (<= A 1.6e-303)
(* (/ (atan 1.0) (PI)) 180.0)
(if (<= A 7.6e-159)
(* (/ (atan (* (/ C B) 2.0)) (PI)) 180.0)
(if (<= A 5.6e-79)
(* (/ (atan (* (/ -0.5 C) B)) (PI)) 180.0)
(* (/ (atan (* (/ A B) -2.0)) (PI)) 180.0))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -4.3 \cdot 10^{-190}:\\
\;\;\;\;\frac{\tan^{-1} \left(0.5 \cdot \frac{B}{A}\right)}{0.005555555555555556 \cdot \mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 1.6 \cdot 10^{-303}:\\
\;\;\;\;\frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 7.6 \cdot 10^{-159}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} \cdot 2\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 5.6 \cdot 10^{-79}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-0.5}{C} \cdot B\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{A}{B} \cdot -2\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if A < -4.3e-190Initial program 38.6%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6459.1
Applied rewrites59.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites59.1%
lift-/.f64N/A
lift-*.f64N/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
Applied rewrites59.2%
if -4.3e-190 < A < 1.59999999999999995e-303Initial program 50.1%
Taylor expanded in B around -inf
Applied rewrites47.2%
if 1.59999999999999995e-303 < A < 7.6000000000000002e-159Initial program 69.4%
Taylor expanded in C around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.2
Applied rewrites38.2%
if 7.6000000000000002e-159 < A < 5.60000000000000023e-79Initial program 36.4%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6453.3
Applied rewrites53.3%
Applied rewrites53.3%
if 5.60000000000000023e-79 < A Initial program 78.2%
Taylor expanded in A around inf
lower-*.f64N/A
lower-/.f6465.5
Applied rewrites65.5%
Final simplification56.7%
(FPCore (A B C)
:precision binary64
(if (<= A -4.3e-190)
(* (/ (atan (* 0.5 (/ B A))) (PI)) 180.0)
(if (<= A 1.6e-303)
(* (/ (atan 1.0) (PI)) 180.0)
(if (<= A 7.6e-159)
(* (/ (atan (* (/ C B) 2.0)) (PI)) 180.0)
(if (<= A 5.6e-79)
(* (/ (atan (* (/ -0.5 C) B)) (PI)) 180.0)
(* (/ (atan (* (/ A B) -2.0)) (PI)) 180.0))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -4.3 \cdot 10^{-190}:\\
\;\;\;\;\frac{\tan^{-1} \left(0.5 \cdot \frac{B}{A}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 1.6 \cdot 10^{-303}:\\
\;\;\;\;\frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 7.6 \cdot 10^{-159}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} \cdot 2\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 5.6 \cdot 10^{-79}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-0.5}{C} \cdot B\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{A}{B} \cdot -2\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if A < -4.3e-190Initial program 38.6%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6459.1
Applied rewrites59.1%
if -4.3e-190 < A < 1.59999999999999995e-303Initial program 50.1%
Taylor expanded in B around -inf
Applied rewrites47.2%
if 1.59999999999999995e-303 < A < 7.6000000000000002e-159Initial program 69.4%
Taylor expanded in C around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.2
Applied rewrites38.2%
if 7.6000000000000002e-159 < A < 5.60000000000000023e-79Initial program 36.4%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6453.3
Applied rewrites53.3%
Applied rewrites53.3%
if 5.60000000000000023e-79 < A Initial program 78.2%
Taylor expanded in A around inf
lower-*.f64N/A
lower-/.f6465.5
Applied rewrites65.5%
Final simplification56.6%
(FPCore (A B C)
:precision binary64
(if (<= A -4.3e-190)
(* (/ (atan (* 0.5 (/ B A))) (PI)) 180.0)
(if (<= A 1.2e-269)
(* (/ (atan 1.0) (PI)) 180.0)
(if (<= A 5.6e-79)
(* (/ (atan (* (/ -0.5 C) B)) (PI)) 180.0)
(* (/ (atan (* (/ A B) -2.0)) (PI)) 180.0)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -4.3 \cdot 10^{-190}:\\
\;\;\;\;\frac{\tan^{-1} \left(0.5 \cdot \frac{B}{A}\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 1.2 \cdot 10^{-269}:\\
\;\;\;\;\frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;A \leq 5.6 \cdot 10^{-79}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{-0.5}{C} \cdot B\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{A}{B} \cdot -2\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if A < -4.3e-190Initial program 38.6%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6459.1
Applied rewrites59.1%
if -4.3e-190 < A < 1.20000000000000005e-269Initial program 61.2%
Taylor expanded in B around -inf
Applied rewrites42.2%
if 1.20000000000000005e-269 < A < 5.60000000000000023e-79Initial program 49.8%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6435.5
Applied rewrites35.5%
Applied rewrites35.5%
if 5.60000000000000023e-79 < A Initial program 78.2%
Taylor expanded in A around inf
lower-*.f64N/A
lower-/.f6465.5
Applied rewrites65.5%
Final simplification54.7%
(FPCore (A B C)
:precision binary64
(if (<= B -5.8e-37)
(* (/ (atan 1.0) (PI)) 180.0)
(if (<= B 1.6e-102)
(* (/ (atan (* (/ A B) -2.0)) (PI)) 180.0)
(* (/ (atan -1.0) (PI)) 180.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -5.8 \cdot 10^{-37}:\\
\;\;\;\;\frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;B \leq 1.6 \cdot 10^{-102}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{A}{B} \cdot -2\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 < -5.80000000000000009e-37Initial program 53.4%
Taylor expanded in B around -inf
Applied rewrites59.6%
if -5.80000000000000009e-37 < B < 1.59999999999999993e-102Initial program 56.7%
Taylor expanded in A around inf
lower-*.f64N/A
lower-/.f6434.9
Applied rewrites34.9%
if 1.59999999999999993e-102 < B Initial program 52.8%
Taylor expanded in B around inf
Applied rewrites56.0%
Final simplification49.4%
(FPCore (A B C) :precision binary64 (if (<= A -1.1e-98) (/ (atan (* 0.5 (/ B A))) (* 0.005555555555555556 (PI))) (* (/ (atan (+ (/ (- C A) B) 1.0)) (PI)) 180.0)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -1.1 \cdot 10^{-98}:\\
\;\;\;\;\frac{\tan^{-1} \left(0.5 \cdot \frac{B}{A}\right)}{0.005555555555555556 \cdot \mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\mathsf{PI}\left(\right)} \cdot 180\\
\end{array}
\end{array}
if A < -1.09999999999999998e-98Initial program 31.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6462.7
Applied rewrites62.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites62.7%
lift-/.f64N/A
lift-*.f64N/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
Applied rewrites62.8%
if -1.09999999999999998e-98 < A Initial program 66.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6464.5
Applied rewrites64.5%
Final simplification63.9%
(FPCore (A B C)
:precision binary64
(if (<= B -1.6e-92)
(* (/ (atan 1.0) (PI)) 180.0)
(if (<= B 4.6e-94)
(* (/ (atan 0.0) (PI)) 180.0)
(* (/ (atan -1.0) (PI)) 180.0))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -1.6 \cdot 10^{-92}:\\
\;\;\;\;\frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)} \cdot 180\\
\mathbf{elif}\;B \leq 4.6 \cdot 10^{-94}:\\
\;\;\;\;\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 < -1.5999999999999998e-92Initial program 53.2%
Taylor expanded in B around -inf
Applied rewrites52.4%
if -1.5999999999999998e-92 < B < 4.5999999999999999e-94Initial program 56.3%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval32.7
Applied rewrites32.7%
if 4.5999999999999999e-94 < B Initial program 54.0%
Taylor expanded in B around inf
Applied rewrites57.2%
Final simplification47.7%
(FPCore (A B C) :precision binary64 (if (<= B 4.6e-94) (* (/ (atan 0.0) (PI)) 180.0) (* (/ (atan -1.0) (PI)) 180.0)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 4.6 \cdot 10^{-94}:\\
\;\;\;\;\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 < 4.5999999999999999e-94Initial program 54.6%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval17.1
Applied rewrites17.1%
if 4.5999999999999999e-94 < B Initial program 54.0%
Taylor expanded in B around inf
Applied rewrites57.2%
Final simplification29.9%
(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.4%
Taylor expanded in B around inf
Applied rewrites21.2%
Final simplification21.2%
herbie shell --seed 2024255
(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))))