
(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 15 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) (hypot (- C A) B)))) (PI))))
(t_1
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
(if (<= t_1 -0.5)
t_0
(if (<= t_1 0.0) (* (/ 180.0 (PI)) (atan (/ B (* (- A C) 2.0)))) t_0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \mathsf{hypot}\left(C - A, B\right)\right)\right)}{\mathsf{PI}\left(\right)}\\
t_1 := \frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
\mathbf{if}\;t\_1 \leq -0.5:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\frac{B}{\left(A - C\right) \cdot 2}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\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.5 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 64.4%
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites90.2%
if -0.5 < (*.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 28.0%
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites28.0%
Taylor expanded in B around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-frac2N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower-/.f64N/A
lower--.f6499.1
Applied rewrites99.1%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6496.9
Applied rewrites97.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6499.4
Applied rewrites99.4%
Final simplification91.7%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(/ (* 180.0 (atan (+ t_1 -1.0))) (PI))
(if (<= t_0 0.0)
(* (/ 180.0 (PI)) (atan (/ B (* (- A C) 2.0))))
(/ 180.0 (/ (PI) (atan (+ 1.0 t_1))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{B} \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.5:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(t\_1 + -1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\frac{B}{\left(A - C\right) \cdot 2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{180}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(1 + t\_1\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.5Initial program 61.8%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.0
Applied rewrites78.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6478.0
Applied rewrites78.0%
if -0.5 < (*.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 28.0%
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites28.0%
Taylor expanded in B around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-frac2N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower-/.f64N/A
lower--.f6499.1
Applied rewrites99.1%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6496.9
Applied rewrites97.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6499.4
Applied rewrites99.4%
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 66.4%
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites90.0%
Taylor expanded in B around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-frac2N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower-/.f64N/A
lower--.f6423.2
Applied rewrites23.2%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6422.7
Applied rewrites22.7%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
sub-negN/A
mul-1-negN/A
lower-+.f64N/A
mul-1-negN/A
sub-negN/A
lower-/.f64N/A
lower--.f6480.4
Applied rewrites80.4%
Final simplification82.6%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(/ (* 180.0 (atan (+ t_1 -1.0))) (PI))
(if (<= t_0 0.0)
(* (/ 180.0 (PI)) (atan (/ B (* (- A C) 2.0))))
(* 180.0 (/ (atan (+ 1.0 t_1)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{B} \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.5:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(t\_1 + -1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\frac{B}{\left(A - C\right) \cdot 2}\right)\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + t\_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.5Initial program 61.8%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.0
Applied rewrites78.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6478.0
Applied rewrites78.0%
if -0.5 < (*.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 28.0%
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites28.0%
Taylor expanded in B around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-frac2N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower-/.f64N/A
lower--.f6499.1
Applied rewrites99.1%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6496.9
Applied rewrites97.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6499.4
Applied rewrites99.4%
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 66.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6480.4
Applied rewrites80.4%
Final simplification82.6%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(/ (* 180.0 (atan (+ t_1 -1.0))) (PI))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* B (/ 0.5 (- A C)))) (PI)))
(* 180.0 (/ (atan (+ 1.0 t_1)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{B} \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.5:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(t\_1 + -1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(B \cdot \frac{0.5}{A - C}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + t\_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.5Initial program 61.8%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.0
Applied rewrites78.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6478.0
Applied rewrites78.0%
if -0.5 < (*.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 28.0%
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites28.0%
Taylor expanded in B around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-frac2N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower-/.f64N/A
lower--.f6499.1
Applied rewrites99.1%
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 66.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6480.4
Applied rewrites80.4%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(/ (* 180.0 (atan (+ t_1 -1.0))) (PI))
(if (<= t_0 0.0)
(/ (* 180.0 (atan (/ (* B 0.5) A))) (PI))
(* 180.0 (/ (atan (+ 1.0 t_1)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{B} \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.5:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(t\_1 + -1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{B \cdot 0.5}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + t\_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.5Initial program 61.8%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.0
Applied rewrites78.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6478.0
Applied rewrites78.0%
if -0.5 < (*.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 28.0%
Taylor expanded in A around -inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6467.1
Applied rewrites67.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6467.1
Applied rewrites67.1%
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 66.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6480.4
Applied rewrites80.4%
(FPCore (A B C)
:precision binary64
(let* ((t_0
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (/ (- C A) B)))
(if (<= t_0 -0.5)
(* 180.0 (/ (atan (+ t_1 -1.0)) (PI)))
(if (<= t_0 0.0)
(/ (* 180.0 (atan (/ (* B 0.5) A))) (PI))
(* 180.0 (/ (atan (+ 1.0 t_1)) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{B} \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.5:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 + -1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{B \cdot 0.5}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + t\_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.5Initial program 61.8%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.0
Applied rewrites78.0%
if -0.5 < (*.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 28.0%
Taylor expanded in A around -inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6467.1
Applied rewrites67.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6467.1
Applied rewrites67.1%
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 66.4%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6480.4
Applied rewrites80.4%
(FPCore (A B C)
:precision binary64
(if (<= B -3.3e-271)
(* 180.0 (/ (atan (+ 1.0 (/ C B))) (PI)))
(if (<= B 1.68e-233)
(* 180.0 (/ (atan 0.0) (PI)))
(if (<= B 40000.0)
(* 180.0 (/ (atan (* 2.0 (/ C B))) (PI)))
(* 180.0 (/ (atan -1.0) (PI)))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -3.3 \cdot 10^{-271}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 1.68 \cdot 10^{-233}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 40000:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(2 \cdot \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 < -3.3000000000000002e-271Initial program 63.0%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.8
Applied rewrites50.8%
Taylor expanded in B around -inf
Applied rewrites61.9%
if -3.3000000000000002e-271 < B < 1.67999999999999993e-233Initial program 45.7%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval57.0
Applied rewrites57.0%
if 1.67999999999999993e-233 < B < 4e4Initial program 59.8%
Taylor expanded in C around -inf
lower-*.f64N/A
lower-/.f6436.3
Applied rewrites36.3%
if 4e4 < B Initial program 53.1%
Taylor expanded in B around inf
Applied rewrites63.0%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (* 180.0 (/ (atan (+ 1.0 (/ C B))) (PI)))))
(if (<= B -3.3e-271)
t_0
(if (<= B 4.8e-108)
(* 180.0 (/ (atan 0.0) (PI)))
(if (<= B 40000.0) t_0 (* 180.0 (/ (atan -1.0) (PI))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;B \leq -3.3 \cdot 10^{-271}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B \leq 4.8 \cdot 10^{-108}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 40000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if B < -3.3000000000000002e-271 or 4.80000000000000034e-108 < B < 4e4Initial program 62.7%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6451.7
Applied rewrites51.7%
Taylor expanded in B around -inf
Applied rewrites58.9%
if -3.3000000000000002e-271 < B < 4.80000000000000034e-108Initial program 52.6%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval43.7
Applied rewrites43.7%
if 4e4 < B Initial program 53.1%
Taylor expanded in B around inf
Applied rewrites63.0%
(FPCore (A B C)
:precision binary64
(if (<= A -5.5e-32)
(/ (* 180.0 (atan (/ (* B 0.5) A))) (PI))
(if (<= A 2.9e+82)
(* 180.0 (/ (atan (+ 1.0 (/ C B))) (PI)))
(* 180.0 (/ (atan (/ (* A -2.0) B)) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -5.5 \cdot 10^{-32}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{B \cdot 0.5}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 2.9 \cdot 10^{+82}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{A \cdot -2}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -5.50000000000000024e-32Initial program 28.6%
Taylor expanded in A around -inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6464.7
Applied rewrites64.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6464.7
Applied rewrites64.7%
if -5.50000000000000024e-32 < A < 2.9000000000000001e82Initial program 64.4%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.6
Applied rewrites58.6%
Taylor expanded in B around -inf
Applied rewrites54.8%
if 2.9000000000000001e82 < A Initial program 81.8%
Taylor expanded in A around inf
associate-*r/N/A
lower-/.f64N/A
lower-*.f6478.3
Applied rewrites78.3%
Final simplification62.2%
(FPCore (A B C)
:precision binary64
(if (<= A -5.5e-32)
(* 180.0 (/ (atan (/ (* B 0.5) A)) (PI)))
(if (<= A 2.9e+82)
(* 180.0 (/ (atan (+ 1.0 (/ C B))) (PI)))
(* 180.0 (/ (atan (/ (* A -2.0) B)) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -5.5 \cdot 10^{-32}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B \cdot 0.5}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 2.9 \cdot 10^{+82}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{A \cdot -2}{B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -5.50000000000000024e-32Initial program 28.6%
Taylor expanded in A around -inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6464.7
Applied rewrites64.7%
if -5.50000000000000024e-32 < A < 2.9000000000000001e82Initial program 64.4%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.6
Applied rewrites58.6%
Taylor expanded in B around -inf
Applied rewrites54.8%
if 2.9000000000000001e82 < A Initial program 81.8%
Taylor expanded in A around inf
associate-*r/N/A
lower-/.f64N/A
lower-*.f6478.3
Applied rewrites78.3%
Final simplification62.1%
(FPCore (A B C) :precision binary64 (if (<= A -5.5e-32) (/ (* 180.0 (atan (/ (* B 0.5) A))) (PI)) (* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -5.5 \cdot 10^{-32}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{B \cdot 0.5}{A}\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 A < -5.50000000000000024e-32Initial program 28.6%
Taylor expanded in A around -inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6464.7
Applied rewrites64.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6464.7
Applied rewrites64.7%
if -5.50000000000000024e-32 < A Initial program 69.2%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6468.4
Applied rewrites68.4%
(FPCore (A B C) :precision binary64 (if (<= C 1.1e-284) (* 180.0 (/ (atan (+ 1.0 (/ C B))) (PI))) (* 180.0 (/ (atan (/ (* B -0.5) C)) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq 1.1 \cdot 10^{-284}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B \cdot -0.5}{C}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if C < 1.1e-284Initial program 73.8%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
lower-sqrt.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6465.1
Applied rewrites65.1%
Taylor expanded in B around -inf
Applied rewrites65.2%
if 1.1e-284 < C Initial program 43.1%
Taylor expanded in C around inf
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6450.5
Applied rewrites50.5%
Applied rewrites50.6%
(FPCore (A B C)
:precision binary64
(if (<= B -2.05e-199)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 3.1e-62)
(* 180.0 (/ (atan 0.0) (PI)))
(* 180.0 (/ (atan -1.0) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -2.05 \cdot 10^{-199}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 3.1 \cdot 10^{-62}:\\
\;\;\;\;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 < -2.05000000000000011e-199Initial program 63.3%
Taylor expanded in B around -inf
Applied rewrites47.3%
if -2.05000000000000011e-199 < B < 3.0999999999999999e-62Initial program 54.8%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval38.9
Applied rewrites38.9%
if 3.0999999999999999e-62 < B Initial program 55.8%
Taylor expanded in B around inf
Applied rewrites55.2%
(FPCore (A B C) :precision binary64 (if (<= B 3.1e-62) (* 180.0 (/ (atan 0.0) (PI))) (* 180.0 (/ (atan -1.0) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 3.1 \cdot 10^{-62}:\\
\;\;\;\;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.0999999999999999e-62Initial program 59.5%
Taylor expanded in C around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
div0N/A
metadata-eval19.3
Applied rewrites19.3%
if 3.0999999999999999e-62 < B Initial program 55.8%
Taylor expanded in B around inf
Applied rewrites55.2%
(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.6%
Taylor expanded in B around inf
Applied rewrites17.0%
herbie shell --seed 2024221
(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))))