Average Error: 52.0 → 34.3
Time: 42.2s
Precision: binary64
\[[A, C] = \mathsf{sort}([A, C]) \\]
\[\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 := \sqrt{2 \cdot \left(F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)}\\ \mathbf{if}\;B \leq -1.5045379819184283 \cdot 10^{+60}:\\ \;\;\;\;-\frac{t_0}{-B}\\ \mathbf{elif}\;B \leq -1.5618196159827645 \cdot 10^{+41}:\\ \;\;\;\;-\sqrt{-0.5 \cdot \frac{F}{C}} \cdot \sqrt{2}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_1 := \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\\ \mathbf{if}\;B \leq -9.066057881034669 \cdot 10^{-84}:\\ \;\;\;\;\sqrt{t_1} \cdot \frac{-\sqrt{2} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{t_1}\\ \mathbf{elif}\;B \leq 1.0607308399078237 \cdot 10^{+66}:\\ \;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(F \cdot \left(2 \cdot A\right)\right)\right)}}{t_1}\\ \mathbf{else}:\\ \;\;\;\;-\frac{t_0}{B}\\ \end{array}\\ \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 := \sqrt{2 \cdot \left(F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)}\\
\mathbf{if}\;B \leq -1.5045379819184283 \cdot 10^{+60}:\\
\;\;\;\;-\frac{t_0}{-B}\\

\mathbf{elif}\;B \leq -1.5618196159827645 \cdot 10^{+41}:\\
\;\;\;\;-\sqrt{-0.5 \cdot \frac{F}{C}} \cdot \sqrt{2}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\\
\mathbf{if}\;B \leq -9.066057881034669 \cdot 10^{-84}:\\
\;\;\;\;\sqrt{t_1} \cdot \frac{-\sqrt{2} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{t_1}\\

\mathbf{elif}\;B \leq 1.0607308399078237 \cdot 10^{+66}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(F \cdot \left(2 \cdot A\right)\right)\right)}}{t_1}\\

\mathbf{else}:\\
\;\;\;\;-\frac{t_0}{B}\\


\end{array}\\


\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 (sqrt (* 2.0 (* F (- (+ A C) (hypot B (- A C))))))))
   (if (<= B -1.5045379819184283e+60)
     (- (/ t_0 (- B)))
     (if (<= B -1.5618196159827645e+41)
       (- (* (sqrt (* -0.5 (/ F C))) (sqrt 2.0)))
       (let* ((t_1 (fma A (* C -4.0) (* B B))))
         (if (<= B -9.066057881034669e-84)
           (*
            (sqrt t_1)
            (/ (- (* (sqrt 2.0) (sqrt (* F (- A (hypot B A)))))) t_1))
           (if (<= B 1.0607308399078237e+66)
             (/ (- (sqrt (* t_1 (* 2.0 (* F (* 2.0 A)))))) t_1)
             (- (/ t_0 B)))))))))
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 = sqrt(2.0 * (F * ((A + C) - hypot(B, (A - C)))));
	double tmp;
	if (B <= -1.5045379819184283e+60) {
		tmp = -(t_0 / -B);
	} else if (B <= -1.5618196159827645e+41) {
		tmp = -(sqrt(-0.5 * (F / C)) * sqrt(2.0));
	} else {
		double t_1 = fma(A, (C * -4.0), (B * B));
		double tmp_1;
		if (B <= -9.066057881034669e-84) {
			tmp_1 = sqrt(t_1) * (-(sqrt(2.0) * sqrt(F * (A - hypot(B, A)))) / t_1);
		} else if (B <= 1.0607308399078237e+66) {
			tmp_1 = -sqrt(t_1 * (2.0 * (F * (2.0 * A)))) / t_1;
		} else {
			tmp_1 = -(t_0 / B);
		}
		tmp = tmp_1;
	}
	return tmp;
}

Error

Bits error versus A

Bits error versus B

Bits error versus C

Bits error versus F

Derivation

  1. Split input into 5 regimes
  2. if B < -1.5045379819184283e60

    1. Initial program 57.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. Simplified56.3

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

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

      \[\leadsto \frac{-\color{blue}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{2 \cdot \left(F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}} \]
    5. Applied distribute-lft-neg-in_binary6451.0

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

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

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

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

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

    if -1.5045379819184283e60 < B < -1.56181961598276451e41

    1. Initial program 36.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. Simplified33.1

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

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

      \[\leadsto \color{blue}{-\sqrt{-0.5 \cdot \frac{F}{C}} \cdot \sqrt{2}} \]

    if -1.56181961598276451e41 < B < -9.0660578810346685e-84

    1. Initial program 43.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. Simplified39.0

      \[\leadsto \color{blue}{\frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right) \cdot \left(2 \cdot \left(F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}} \]
    3. Applied *-un-lft-identity_binary6439.0

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

      \[\leadsto \frac{-\color{blue}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{2 \cdot \left(F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{1 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \]
    5. Applied distribute-rgt-neg-in_binary6439.8

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

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

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

      \[\leadsto \sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \frac{-\color{blue}{\sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)} \cdot \sqrt{2}}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \]
    9. Simplified37.8

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

    if -9.0660578810346685e-84 < B < 1.06073083990782366e66

    1. Initial program 49.3

      \[\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. Simplified44.5

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

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

    if 1.06073083990782366e66 < B

    1. Initial program 58.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.0

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

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

      \[\leadsto \frac{-\color{blue}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{2 \cdot \left(F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}} \]
    5. Applied distribute-lft-neg-in_binary6451.9

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

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

      \[\leadsto \color{blue}{-1} \cdot \frac{\sqrt{2 \cdot \left(F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}} \]
    8. Taylor expanded in A around 0 29.9

      \[\leadsto -1 \cdot \frac{\sqrt{2 \cdot \left(F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\color{blue}{B}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification34.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq -1.5045379819184283 \cdot 10^{+60}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{-B}\\ \mathbf{elif}\;B \leq -1.5618196159827645 \cdot 10^{+41}:\\ \;\;\;\;-\sqrt{-0.5 \cdot \frac{F}{C}} \cdot \sqrt{2}\\ \mathbf{elif}\;B \leq -9.066057881034669 \cdot 10^{-84}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \frac{-\sqrt{2} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\\ \mathbf{elif}\;B \leq 1.0607308399078237 \cdot 10^{+66}:\\ \;\;\;\;\frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right) \cdot \left(2 \cdot \left(F \cdot \left(2 \cdot A\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\\ \mathbf{else}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{B}\\ \end{array} \]

Reproduce

herbie shell --seed 2022067 
(FPCore (A B C F)
  :name "ABCF->ab-angle b"
  :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))))