
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C) :precision binary64 (* 180.0 (/ (atan (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))) (PI))))
\begin{array}{l}
\\
180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\mathsf{PI}\left(\right)}
\end{array}
(FPCore (A B C)
:precision binary64
(if (<= A -340000000000.0)
(* 180.0 (/ (atan (* 0.5 (/ (fma C (/ B A) B) A))) (PI)))
(if (<= A 5e-225)
(* 180.0 (/ (atan (/ (- C (hypot B C)) B)) (PI)))
(* 180.0 (/ (atan (- (/ (- C A) B) (/ (hypot B (- A C)) B))) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -340000000000:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{\mathsf{fma}\left(C, \frac{B}{A}, B\right)}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 5 \cdot 10^{-225}:\\
\;\;\;\;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} - \frac{\mathsf{hypot}\left(B, A - C\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -3.4e11Initial program 21.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6414.9
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6427.2
Applied rewrites27.2%
Taylor expanded in A around 0
lower-/.f6427.7
Applied rewrites27.7%
Taylor expanded in A around -inf
mul-1-negN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-outN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6473.7
Applied rewrites73.7%
if -3.4e11 < A < 5.0000000000000001e-225Initial program 46.5%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6472.7
Applied rewrites72.7%
if 5.0000000000000001e-225 < A Initial program 70.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6469.9
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6489.7
Applied rewrites89.7%
Final simplification80.4%
(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 (* (/ 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({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:\\
\;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot \frac{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))) < -40Initial program 60.1%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6481.4
Applied rewrites81.4%
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 18.0%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6454.3
Applied rewrites54.3%
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 rewrites54.0%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites54.4%
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.9%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6474.9
Applied rewrites74.9%
Final simplification74.4%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (pow B -1.0) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.04)
(* 180.0 (/ (atan (- t_1 1.0)) (PI)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* 0.5 (/ (fma C (/ B A) B) A))) (PI)))
(* 180.0 (/ (atan (+ t_1 1.0)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{-1} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
t_1 := \frac{C - A}{B}\\
\mathbf{if}\;t\_0 \leq -0.04:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{\mathsf{fma}\left(C, \frac{B}{A}, B\right)}{A}\right)}{\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 (/.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.0400000000000000008Initial program 60.4%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6480.7
Applied rewrites80.7%
if -0.0400000000000000008 < (*.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 16.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f644.1
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f644.1
Applied rewrites4.1%
Taylor expanded in A around 0
lower-/.f644.8
Applied rewrites4.8%
Taylor expanded in A around -inf
mul-1-negN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-outN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6456.2
Applied rewrites56.2%
if -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 55.9%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6474.9
Applied rewrites74.9%
Final simplification74.5%
(FPCore (A B C)
:precision binary64
(if (<= A -340000000000.0)
(* 180.0 (/ (atan (* 0.5 (/ (fma C (/ B A) B) A))) (PI)))
(if (<= A 5e-225)
(* 180.0 (/ (atan (/ (- C (hypot B C)) B)) (PI)))
(* 180.0 (/ (atan (- (/ C B) (/ (hypot B (- A C)) B))) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -340000000000:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{\mathsf{fma}\left(C, \frac{B}{A}, B\right)}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 5 \cdot 10^{-225}:\\
\;\;\;\;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}{B} - \frac{\mathsf{hypot}\left(B, A - C\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -3.4e11Initial program 21.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6414.9
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6427.2
Applied rewrites27.2%
Taylor expanded in A around 0
lower-/.f6427.7
Applied rewrites27.7%
Taylor expanded in A around -inf
mul-1-negN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-outN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6473.7
Applied rewrites73.7%
if -3.4e11 < A < 5.0000000000000001e-225Initial program 46.5%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6472.7
Applied rewrites72.7%
if 5.0000000000000001e-225 < A Initial program 70.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6469.9
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6489.7
Applied rewrites89.7%
Taylor expanded in A around 0
lower-/.f6488.7
Applied rewrites88.7%
Final simplification79.9%
(FPCore (A B C)
:precision binary64
(if (<= A -340000000000.0)
(* 180.0 (/ (atan (* 0.5 (/ (fma C (/ B A) B) A))) (PI)))
(if (<= A 2.25e-102)
(* 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 -340000000000:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{\mathsf{fma}\left(C, \frac{B}{A}, B\right)}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 2.25 \cdot 10^{-102}:\\
\;\;\;\;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 < -3.4e11Initial program 21.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6414.9
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6427.2
Applied rewrites27.2%
Taylor expanded in A around 0
lower-/.f6427.7
Applied rewrites27.7%
Taylor expanded in A around -inf
mul-1-negN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-outN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6473.7
Applied rewrites73.7%
if -3.4e11 < A < 2.25e-102Initial program 50.6%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6476.4
Applied rewrites76.4%
if 2.25e-102 < A Initial program 72.6%
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%
Final simplification76.5%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (* 180.0 (/ (atan (+ (/ (- C A) B) 1.0)) (PI)))))
(if (<= B -3.4e-222)
t_0
(if (<= B -4.5e-306)
(* 180.0 (/ (atan 0.0) (PI)))
(if (<= B 2.4e-28)
t_0
(if (<= B 2.5e+51)
(/ (* (atan (* -0.5 (/ B C))) 180.0) (PI))
(* 180.0 (/ (atan -1.0) (PI)))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;B \leq -3.4 \cdot 10^{-222}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B \leq -4.5 \cdot 10^{-306}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 2.4 \cdot 10^{-28}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{+51}:\\
\;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\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.4000000000000001e-222 or -4.50000000000000005e-306 < B < 2.4000000000000002e-28Initial program 54.3%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6465.5
Applied rewrites65.5%
if -3.4000000000000001e-222 < B < -4.50000000000000005e-306Initial program 46.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6424.8
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6424.8
Applied rewrites24.8%
Taylor expanded in C around inf
mul-1-negN/A
distribute-lft1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
mul0-lft61.6
Applied rewrites61.6%
if 2.4000000000000002e-28 < B < 2.5e51Initial program 43.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-lft77.7
Applied rewrites77.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites77.7%
if 2.5e51 < B Initial program 48.4%
Taylor expanded in B around inf
Applied rewrites70.8%
Final simplification67.0%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (/ (* (atan (* -0.5 (/ B C))) 180.0) (PI))))
(if (<= B -5.5e-31)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B -4.4e-306)
t_0
(if (<= B 4.4e-221)
(* 180.0 (/ (atan (* (/ C B) 2.0)) (PI)))
(if (<= B 2.5e+51) t_0 (* 180.0 (/ (atan -1.0) (PI)))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;B \leq -5.5 \cdot 10^{-31}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq -4.4 \cdot 10^{-306}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B \leq 4.4 \cdot 10^{-221}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} \cdot 2\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{+51}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -5.49999999999999958e-31Initial program 50.4%
Taylor expanded in B around -inf
Applied rewrites64.4%
if -5.49999999999999958e-31 < B < -4.40000000000000031e-306 or 4.40000000000000003e-221 < B < 2.5e51Initial program 48.7%
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-lft43.3
Applied rewrites43.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites43.3%
if -4.40000000000000031e-306 < B < 4.40000000000000003e-221Initial program 83.9%
Taylor expanded in C around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6472.7
Applied rewrites72.7%
if 2.5e51 < B Initial program 48.4%
Taylor expanded in B around inf
Applied rewrites70.8%
Final simplification57.5%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (* 180.0 (/ (atan (* B (/ -0.5 C))) (PI)))))
(if (<= B -5.5e-31)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B -4.4e-306)
t_0
(if (<= B 4.4e-221)
(* 180.0 (/ (atan (* (/ C B) 2.0)) (PI)))
(if (<= B 2.5e+51) t_0 (* 180.0 (/ (atan -1.0) (PI)))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;B \leq -5.5 \cdot 10^{-31}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq -4.4 \cdot 10^{-306}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B \leq 4.4 \cdot 10^{-221}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} \cdot 2\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{+51}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -5.49999999999999958e-31Initial program 50.4%
Taylor expanded in B around -inf
Applied rewrites64.4%
if -5.49999999999999958e-31 < B < -4.40000000000000031e-306 or 4.40000000000000003e-221 < B < 2.5e51Initial program 48.7%
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-lft43.3
Applied rewrites43.3%
Applied rewrites43.2%
if -4.40000000000000031e-306 < B < 4.40000000000000003e-221Initial program 83.9%
Taylor expanded in C around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6472.7
Applied rewrites72.7%
if 2.5e51 < B Initial program 48.4%
Taylor expanded in B around inf
Applied rewrites70.8%
Final simplification57.5%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (* 180.0 (/ (atan (* B (/ -0.5 C))) (PI)))))
(if (<= B -5.5e-31)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B -4.5e-306)
t_0
(if (<= B 2.2e-28)
(* 180.0 (/ (atan (* (/ A B) -2.0)) (PI)))
(if (<= B 2.5e+51) t_0 (* 180.0 (/ (atan -1.0) (PI)))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;B \leq -5.5 \cdot 10^{-31}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq -4.5 \cdot 10^{-306}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B \leq 2.2 \cdot 10^{-28}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{A}{B} \cdot -2\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{+51}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -5.49999999999999958e-31Initial program 50.4%
Taylor expanded in B around -inf
Applied rewrites64.4%
if -5.49999999999999958e-31 < B < -4.50000000000000005e-306 or 2.19999999999999996e-28 < B < 2.5e51Initial program 47.6%
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-lft51.3
Applied rewrites51.3%
Applied rewrites51.2%
if -4.50000000000000005e-306 < B < 2.19999999999999996e-28Initial program 61.8%
Taylor expanded in A around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6440.1
Applied rewrites40.1%
if 2.5e51 < B Initial program 48.4%
Taylor expanded in B around inf
Applied rewrites70.8%
Final simplification57.0%
(FPCore (A B C)
:precision binary64
(if (<= B -5.5e-31)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 2.5e+51)
(* 180.0 (/ (atan (* B (/ -0.5 C))) (PI)))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -5.5 \cdot 10^{-31}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{+51}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -5.49999999999999958e-31Initial program 50.4%
Taylor expanded in B around -inf
Applied rewrites64.4%
if -5.49999999999999958e-31 < B < 2.5e51Initial program 53.7%
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-lft38.3
Applied rewrites38.3%
Applied rewrites38.3%
if 2.5e51 < B Initial program 48.4%
Taylor expanded in B around inf
Applied rewrites70.8%
Final simplification52.9%
(FPCore (A B C)
:precision binary64
(if (<= B -3.3e-192)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 1.1e-155)
(* 180.0 (/ (atan 0.0) (PI)))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -3.3 \cdot 10^{-192}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 1.1 \cdot 10^{-155}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -3.29999999999999989e-192Initial program 49.4%
Taylor expanded in B around -inf
Applied rewrites50.5%
if -3.29999999999999989e-192 < B < 1.1e-155Initial program 58.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6449.1
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6450.2
Applied rewrites50.2%
Taylor expanded in C around inf
mul-1-negN/A
distribute-lft1-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
mul0-lft35.3
Applied rewrites35.3%
if 1.1e-155 < B Initial program 49.7%
Taylor expanded in B around inf
Applied rewrites50.1%
Final simplification46.7%
(FPCore (A B C) :precision binary64 (if (<= B -3.5e-301) (* 180.0 (/ (atan 1.0) (PI))) (* 180.0 (/ (atan -1.0) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -3.5 \cdot 10^{-301}:\\
\;\;\;\;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 < -3.49999999999999992e-301Initial program 50.2%
Taylor expanded in B around -inf
Applied rewrites40.5%
if -3.49999999999999992e-301 < B Initial program 52.8%
Taylor expanded in B around inf
Applied rewrites41.4%
Final simplification40.9%
(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 51.5%
Taylor expanded in B around inf
Applied rewrites22.2%
Final simplification22.2%
herbie shell --seed 2024364
(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))))