Average Error: 51.4 → 41.3
Time: 54.5s
Precision: binary64
\[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
\[\begin{array}{l} t_0 := B \cdot B - \left(4 \cdot A\right) \cdot C\\ t_1 := \sqrt{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}\\ t_2 := \frac{-\left(\sqrt{t_0} \cdot {\left(F \cdot 2\right)}^{0.5}\right) \cdot t_1}{t_0}\\ \mathbf{if}\;A \leq -2.592644457333761 \cdot 10^{-17}:\\ \;\;\;\;-1 \cdot \left(\sqrt{2} \cdot \sqrt{-0.5 \cdot \frac{F}{A}}\right)\\ \mathbf{elif}\;A \leq -2.1406366566139761 \cdot 10^{-134}:\\ \;\;\;\;\frac{-\sqrt{-16 \cdot \left({A}^{2} \cdot \left(C \cdot F\right)\right)}}{t_0}\\ \mathbf{elif}\;A \leq 1.9811684140282612 \cdot 10^{-269}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;A \leq 1.1150151595515204 \cdot 10^{+54}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \frac{t_0 \cdot F}{1}} \cdot t_1}{t_0}\\ \mathbf{elif}\;A \leq 3.718423827809515 \cdot 10^{+173}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left(\sqrt{-0.5 \cdot \frac{F}{C}} \cdot \sqrt{2}\right)\\ \end{array} \]
\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}
\begin{array}{l}
t_0 := B \cdot B - \left(4 \cdot A\right) \cdot C\\
t_1 := \sqrt{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}\\
t_2 := \frac{-\left(\sqrt{t_0} \cdot {\left(F \cdot 2\right)}^{0.5}\right) \cdot t_1}{t_0}\\
\mathbf{if}\;A \leq -2.592644457333761 \cdot 10^{-17}:\\
\;\;\;\;-1 \cdot \left(\sqrt{2} \cdot \sqrt{-0.5 \cdot \frac{F}{A}}\right)\\

\mathbf{elif}\;A \leq -2.1406366566139761 \cdot 10^{-134}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left({A}^{2} \cdot \left(C \cdot F\right)\right)}}{t_0}\\

\mathbf{elif}\;A \leq 1.9811684140282612 \cdot 10^{-269}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;A \leq 1.1150151595515204 \cdot 10^{+54}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \frac{t_0 \cdot F}{1}} \cdot t_1}{t_0}\\

\mathbf{elif}\;A \leq 3.718423827809515 \cdot 10^{+173}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(\sqrt{-0.5 \cdot \frac{F}{C}} \cdot \sqrt{2}\right)\\


\end{array}
(FPCore (A B C F)
 :precision binary64
 (/
  (-
   (sqrt
    (*
     (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F))
     (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
  (- (pow B 2.0) (* (* 4.0 A) C))))
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (* B B) (* (* 4.0 A) C)))
        (t_1 (sqrt (+ (+ A C) (hypot B (- A C)))))
        (t_2 (/ (- (* (* (sqrt t_0) (pow (* F 2.0) 0.5)) t_1)) t_0)))
   (if (<= A -2.592644457333761e-17)
     (* -1.0 (* (sqrt 2.0) (sqrt (* -0.5 (/ F A)))))
     (if (<= A -2.1406366566139761e-134)
       (/ (- (sqrt (* -16.0 (* (pow A 2.0) (* C F))))) t_0)
       (if (<= A 1.9811684140282612e-269)
         t_2
         (if (<= A 1.1150151595515204e+54)
           (/ (- (* (sqrt (* 2.0 (/ (* t_0 F) 1.0))) t_1)) t_0)
           (if (<= A 3.718423827809515e+173)
             t_2
             (* -1.0 (* (sqrt (* -0.5 (/ F C))) (sqrt 2.0))))))))))
double code(double A, double B, double C, double F) {
	return -sqrt(((2.0 * ((pow(B, 2.0) - ((4.0 * A) * C)) * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / (pow(B, 2.0) - ((4.0 * A) * C));
}
double code(double A, double B, double C, double F) {
	double t_0 = (B * B) - ((4.0 * A) * C);
	double t_1 = sqrt(((A + C) + hypot(B, (A - C))));
	double t_2 = -((sqrt(t_0) * pow((F * 2.0), 0.5)) * t_1) / t_0;
	double tmp;
	if (A <= -2.592644457333761e-17) {
		tmp = -1.0 * (sqrt(2.0) * sqrt((-0.5 * (F / A))));
	} else if (A <= -2.1406366566139761e-134) {
		tmp = -sqrt((-16.0 * (pow(A, 2.0) * (C * F)))) / t_0;
	} else if (A <= 1.9811684140282612e-269) {
		tmp = t_2;
	} else if (A <= 1.1150151595515204e+54) {
		tmp = -(sqrt((2.0 * ((t_0 * F) / 1.0))) * t_1) / t_0;
	} else if (A <= 3.718423827809515e+173) {
		tmp = t_2;
	} else {
		tmp = -1.0 * (sqrt((-0.5 * (F / C))) * sqrt(2.0));
	}
	return tmp;
}

Error

Bits error versus A

Bits error versus B

Bits error versus C

Bits error versus F

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 5 regimes
  2. if A < -2.5926444573337611e-17

    1. Initial program 59.7

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified58.5

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(2 \cdot \left(\left(B \cdot B - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}} \]
    3. Taylor expanded in C around inf 41.5

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{2} \cdot \sqrt{-0.5 \cdot \frac{F}{A}}\right)} \]

    if -2.5926444573337611e-17 < A < -2.14063665661397612e-134

    1. Initial program 48.6

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified45.6

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(2 \cdot \left(\left(B \cdot B - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}} \]
    3. Taylor expanded in A around inf 55.4

      \[\leadsto \frac{-\sqrt{\color{blue}{-16 \cdot \left({A}^{2} \cdot \left(C \cdot F\right)\right)}}}{B \cdot B - \left(4 \cdot A\right) \cdot C} \]

    if -2.14063665661397612e-134 < A < 1.9811684140282612e-269 or 1.1150151595515204e54 < A < 3.718423827809515e173

    1. Initial program 46.4

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified43.3

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(2 \cdot \left(\left(B \cdot B - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}} \]
    3. Applied egg-rr38.4

      \[\leadsto \frac{-\color{blue}{\sqrt{2 \cdot \left(\left(B \cdot B - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)} \cdot \sqrt{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}}}{B \cdot B - \left(4 \cdot A\right) \cdot C} \]
    4. Applied egg-rr38.6

      \[\leadsto \frac{-\color{blue}{\left(\sqrt{B \cdot B - \left(4 \cdot A\right) \cdot C} \cdot {\left(F \cdot 2\right)}^{0.5}\right)} \cdot \sqrt{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C} \]

    if 1.9811684140282612e-269 < A < 1.1150151595515204e54

    1. Initial program 44.0

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified41.1

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(2 \cdot \left(\left(B \cdot B - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}} \]
    3. Applied egg-rr36.7

      \[\leadsto \frac{-\color{blue}{\sqrt{2 \cdot \left(\left(B \cdot B - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)} \cdot \sqrt{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}}}{B \cdot B - \left(4 \cdot A\right) \cdot C} \]
    4. Applied egg-rr36.7

      \[\leadsto \frac{-\sqrt{2 \cdot \color{blue}{\frac{\left(B \cdot B - \left(4 \cdot A\right) \cdot C\right) \cdot F}{1}}} \cdot \sqrt{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C} \]

    if 3.718423827809515e173 < A

    1. Initial program 64.0

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified53.1

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(2 \cdot \left(\left(B \cdot B - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}} \]
    3. Taylor expanded in A around inf 46.2

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{-0.5 \cdot \frac{F}{C}} \cdot \sqrt{2}\right)} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification41.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -2.592644457333761 \cdot 10^{-17}:\\ \;\;\;\;-1 \cdot \left(\sqrt{2} \cdot \sqrt{-0.5 \cdot \frac{F}{A}}\right)\\ \mathbf{elif}\;A \leq -2.1406366566139761 \cdot 10^{-134}:\\ \;\;\;\;\frac{-\sqrt{-16 \cdot \left({A}^{2} \cdot \left(C \cdot F\right)\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}\\ \mathbf{elif}\;A \leq 1.9811684140282612 \cdot 10^{-269}:\\ \;\;\;\;\frac{-\left(\sqrt{B \cdot B - \left(4 \cdot A\right) \cdot C} \cdot {\left(F \cdot 2\right)}^{0.5}\right) \cdot \sqrt{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}\\ \mathbf{elif}\;A \leq 1.1150151595515204 \cdot 10^{+54}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \frac{\left(B \cdot B - \left(4 \cdot A\right) \cdot C\right) \cdot F}{1}} \cdot \sqrt{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}\\ \mathbf{elif}\;A \leq 3.718423827809515 \cdot 10^{+173}:\\ \;\;\;\;\frac{-\left(\sqrt{B \cdot B - \left(4 \cdot A\right) \cdot C} \cdot {\left(F \cdot 2\right)}^{0.5}\right) \cdot \sqrt{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left(\sqrt{-0.5 \cdot \frac{F}{C}} \cdot \sqrt{2}\right)\\ \end{array} \]

Reproduce

herbie shell --seed 2022127 
(FPCore (A B C F)
  :name "ABCF->ab-angle a"
  :precision binary64
  (/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))