
(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 (if (<= A -2.4e-12) (* 180.0 (/ (atan (* 0.5 (* (fma (/ C A) B B) (pow A -1.0)))) (PI))) (/ (* (atan (/ (- (- C A) (hypot B (- A C))) B)) 180.0) (PI))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -2.4 \cdot 10^{-12}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \left(\mathsf{fma}\left(\frac{C}{A}, B, B\right) \cdot {A}^{-1}\right)\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, A - C\right)}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -2.39999999999999987e-12Initial program 19.3%
Taylor expanded in A around -inf
mul-1-negN/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
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.9
Applied rewrites79.9%
Applied rewrites79.9%
if -2.39999999999999987e-12 < A Initial program 59.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites87.2%
(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 -2e-46)
(* 180.0 (/ (atan (- t_1 1.0)) (PI)))
(if (<= t_0 0.0)
(/ 180.0 (/ (PI) (atan (* 0.5 (/ B A)))))
(/ (* (atan (+ t_1 1.0)) 180.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 -2 \cdot 10^{-46}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 - 1\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{180}{\frac{\mathsf{PI}\left(\right)}{\tan^{-1} \left(0.5 \cdot \frac{B}{A}\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)))))) < -2.00000000000000005e-46Initial program 53.4%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.9
Applied rewrites77.9%
if -2.00000000000000005e-46 < (*.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 15.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.0
Applied rewrites64.0%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6464.0
Applied rewrites64.0%
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 58.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites89.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.4
Applied rewrites78.4%
Final simplification76.2%
(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 -2e-46)
(* 180.0 (/ (atan (- t_1 1.0)) (PI)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(/ (* (atan (+ t_1 1.0)) 180.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 -2 \cdot 10^{-46}:\\
\;\;\;\;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(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(t\_1 + 1\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if (*.f64 (/.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)))))) < -2.00000000000000005e-46Initial program 53.4%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.9
Applied rewrites77.9%
if -2.00000000000000005e-46 < (*.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 15.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.0
Applied rewrites64.0%
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 58.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites89.8%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.4
Applied rewrites78.4%
Final simplification76.2%
(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 -2e-46)
(* 180.0 (/ (atan (- t_1 1.0)) (PI)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (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 -2 \cdot 10^{-46}:\\
\;\;\;\;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(\frac{B}{A} \cdot 0.5\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)))))) < -2.00000000000000005e-46Initial program 53.4%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.9
Applied rewrites77.9%
if -2.00000000000000005e-46 < (*.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 15.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.0
Applied rewrites64.0%
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 58.3%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.4
Applied rewrites78.4%
Final simplification76.2%
(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)))))))
(if (<= t_0 -2e-46)
(* (/ 180.0 (PI)) (atan (- (/ C B) 1.0)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(* 180.0 (/ (atan (+ (/ (- C A) B) 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)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-46}:\\
\;\;\;\;\frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\frac{C}{B} - 1\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;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(\frac{C - A}{B} + 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)))))) < -2.00000000000000005e-46Initial program 53.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites83.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.9
Applied rewrites77.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6477.9
Applied rewrites77.9%
Taylor expanded in A around 0
Applied rewrites69.8%
if -2.00000000000000005e-46 < (*.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 15.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.0
Applied rewrites64.0%
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 58.3%
Taylor expanded in B around -inf
associate--l+N/A
div-subN/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6478.4
Applied rewrites78.4%
Final simplification72.5%
(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)))))))
(if (<= t_0 -2e-46)
(* (/ 180.0 (PI)) (atan (- (/ C B) 1.0)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* (/ B A) 0.5)) (PI)))
(* 180.0 (/ (atan 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)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-46}:\\
\;\;\;\;\frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\frac{C}{B} - 1\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\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)))))) < -2.00000000000000005e-46Initial program 53.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites83.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.9
Applied rewrites77.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6477.9
Applied rewrites77.9%
Taylor expanded in A around 0
Applied rewrites69.8%
if -2.00000000000000005e-46 < (*.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 15.9%
Taylor expanded in A around -inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.0
Applied rewrites64.0%
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 58.3%
Taylor expanded in B around -inf
Applied rewrites53.3%
Final simplification62.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)))))))
(if (<= t_0 -2e-46)
(* (/ 180.0 (PI)) (atan (- (/ C B) 1.0)))
(if (<= t_0 0.0)
(* 180.0 (/ (atan (* B (/ -0.5 C))) (PI)))
(* 180.0 (/ (atan 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)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-46}:\\
\;\;\;\;\frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\frac{C}{B} - 1\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;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 (*.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)))))) < -2.00000000000000005e-46Initial program 53.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites83.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.9
Applied rewrites77.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6477.9
Applied rewrites77.9%
Taylor expanded in A around 0
Applied rewrites69.8%
if -2.00000000000000005e-46 < (*.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 15.9%
Taylor expanded in C around inf
+-commutativeN/A
*-commutativeN/A
associate-*r/N/A
mul-1-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
div0N/A
lower-fma.f64N/A
lower-/.f6440.0
Applied rewrites40.0%
Applied rewrites39.9%
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 58.3%
Taylor expanded in B around -inf
Applied rewrites53.3%
Final simplification59.1%
(FPCore (A B C)
:precision binary64
(if (<= A -2.4e-12)
(* 180.0 (/ (atan (* 0.5 (/ (fma (/ C A) B B) A))) (PI)))
(if (<= A 1.02e+30)
(/ (* (atan (/ (- C (hypot B C)) B)) 180.0) (PI))
(* 180.0 (/ (atan (/ (+ (hypot B A) A) (- B))) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -2.4 \cdot 10^{-12}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{\mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 1.02 \cdot 10^{+30}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{hypot}\left(B, A\right) + A}{-B}\right)}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -2.39999999999999987e-12Initial program 19.3%
Taylor expanded in A around -inf
mul-1-negN/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
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.9
Applied rewrites79.9%
if -2.39999999999999987e-12 < A < 1.02e30Initial program 57.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.8%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6483.6
Applied rewrites83.6%
if 1.02e30 < A Initial program 67.3%
Taylor expanded in C around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
mul-1-negN/A
lower-neg.f6489.4
Applied rewrites89.4%
(FPCore (A B C)
:precision binary64
(if (<= A -2.4e-12)
(* 180.0 (/ (atan (* 0.5 (/ (fma (/ C A) B B) A))) (PI)))
(if (<= A 2.85e+18)
(/ (* (atan (/ (- C (hypot B C)) B)) 180.0) (PI))
(* (/ 180.0 (PI)) (atan (- (/ (- C A) B) 1.0))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -2.4 \cdot 10^{-12}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{\mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 2.85 \cdot 10^{+18}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\frac{C - A}{B} - 1\right)\\
\end{array}
\end{array}
if A < -2.39999999999999987e-12Initial program 19.3%
Taylor expanded in A around -inf
mul-1-negN/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
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.9
Applied rewrites79.9%
if -2.39999999999999987e-12 < A < 2.85e18Initial program 56.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites84.4%
Taylor expanded in A around 0
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6483.3
Applied rewrites83.3%
if 2.85e18 < A Initial program 70.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites95.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6482.6
Applied rewrites82.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.6
Applied rewrites82.6%
Final simplification82.4%
(FPCore (A B C)
:precision binary64
(if (<= A -2.4e-12)
(* 180.0 (/ (atan (* 0.5 (/ (fma (/ C A) B B) A))) (PI)))
(if (<= A 2.85e+18)
(* 180.0 (/ (atan (/ (- C (hypot B C)) B)) (PI)))
(* (/ 180.0 (PI)) (atan (- (/ (- C A) B) 1.0))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -2.4 \cdot 10^{-12}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{\mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;A \leq 2.85 \cdot 10^{+18}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\frac{C - A}{B} - 1\right)\\
\end{array}
\end{array}
if A < -2.39999999999999987e-12Initial program 19.3%
Taylor expanded in A around -inf
mul-1-negN/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
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.9
Applied rewrites79.9%
if -2.39999999999999987e-12 < A < 2.85e18Initial program 56.6%
Taylor expanded in A around 0
lower-/.f64N/A
lower--.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6483.3
Applied rewrites83.3%
if 2.85e18 < A Initial program 70.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites95.9%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6482.6
Applied rewrites82.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.6
Applied rewrites82.6%
Final simplification82.4%
(FPCore (A B C) :precision binary64 (if (<= A -2.4e-12) (* 180.0 (/ (atan (* 0.5 (/ (fma (/ C A) B B) A))) (PI))) (/ (* (atan (/ (- (- C A) (hypot B (- A C))) B)) 180.0) (PI))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -2.4 \cdot 10^{-12}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{\mathsf{fma}\left(\frac{C}{A}, B, B\right)}{A}\right)}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, A - C\right)}{B}\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
\end{array}
\end{array}
if A < -2.39999999999999987e-12Initial program 19.3%
Taylor expanded in A around -inf
mul-1-negN/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
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.9
Applied rewrites79.9%
if -2.39999999999999987e-12 < A Initial program 59.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites87.2%
(FPCore (A B C)
:precision binary64
(if (<= B -3.3e-140)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 2.5e-303)
(* 180.0 (/ (atan 0.0) (PI)))
(* (/ 180.0 (PI)) (atan (- (/ C B) 1.0))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -3.3 \cdot 10^{-140}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{-303}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\mathsf{PI}\left(\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\frac{C}{B} - 1\right)\\
\end{array}
\end{array}
if B < -3.29999999999999987e-140Initial program 51.8%
Taylor expanded in B around -inf
Applied rewrites55.1%
if -3.29999999999999987e-140 < B < 2.4999999999999999e-303Initial program 54.0%
Taylor expanded in C around inf
associate-*r/N/A
mul-1-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
div039.7
Applied rewrites39.7%
if 2.4999999999999999e-303 < B Initial program 48.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites74.8%
Taylor expanded in B around inf
+-commutativeN/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6469.2
Applied rewrites69.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6469.2
Applied rewrites69.2%
Taylor expanded in A around 0
Applied rewrites62.9%
Final simplification57.5%
(FPCore (A B C)
:precision binary64
(if (<= B -3.3e-140)
(* 180.0 (/ (atan 1.0) (PI)))
(if (<= B 1.3e-158)
(* 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^{-140}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\mathsf{PI}\left(\right)}\\
\mathbf{elif}\;B \leq 1.3 \cdot 10^{-158}:\\
\;\;\;\;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.29999999999999987e-140Initial program 51.8%
Taylor expanded in B around -inf
Applied rewrites55.1%
if -3.29999999999999987e-140 < B < 1.3e-158Initial program 54.2%
Taylor expanded in C around inf
associate-*r/N/A
mul-1-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
div030.0
Applied rewrites30.0%
if 1.3e-158 < B Initial program 46.9%
Taylor expanded in B around inf
Applied rewrites54.1%
(FPCore (A B C) :precision binary64 (if (<= B 1.3e-158) (* 180.0 (/ (atan 0.0) (PI))) (* 180.0 (/ (atan -1.0) (PI)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.3 \cdot 10^{-158}:\\
\;\;\;\;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 < 1.3e-158Initial program 52.7%
Taylor expanded in C around inf
associate-*r/N/A
mul-1-negN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
div015.9
Applied rewrites15.9%
if 1.3e-158 < B Initial program 46.9%
Taylor expanded in B around inf
Applied rewrites54.1%
(FPCore (A B C) :precision binary64 (* 180.0 (/ (atan -1.0) (PI))))
\begin{array}{l}
\\
180 \cdot \frac{\tan^{-1} -1}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 50.3%
Taylor expanded in B around inf
Applied rewrites25.0%
herbie shell --seed 2024327
(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))))