Average Error: 52.3 → 37.9
Time: 30.7s
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 := \mathsf{hypot}\left(B, A - C\right)\\ t_1 := \sqrt{2 \cdot \left(F \cdot \left(\left(A + C\right) + t_0\right)\right)}\\ t_2 := \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\\ t_3 := \frac{-\sqrt{t_2 \cdot \left(2 \cdot \left(F \cdot \left(A + \left(C + t_0\right)\right)\right)\right)}}{t_2}\\ t_4 := \sqrt{-8 \cdot \left(F \cdot C\right)}\\ \mathbf{if}\;B \leq -2.0715755995410293 \cdot 10^{+32}:\\ \;\;\;\;-\frac{t_1}{-B}\\ \mathbf{elif}\;B \leq -3.883371458485761 \cdot 10^{-210}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;B \leq 7.496348083330435 \cdot 10^{-303}:\\ \;\;\;\;\frac{-\mathsf{fma}\left(A, \sqrt{2} \cdot t_4, \frac{F \cdot \left(\left(B \cdot B\right) \cdot \sqrt{2}\right)}{t_4}\right)}{t_2}\\ \mathbf{elif}\;B \leq 1174.7036553333758:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;-\frac{t_1}{B}\\ \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 (hypot B (- A C)))
        (t_1 (sqrt (* 2.0 (* F (+ (+ A C) t_0)))))
        (t_2 (fma A (* C -4.0) (* B B)))
        (t_3 (/ (- (sqrt (* t_2 (* 2.0 (* F (+ A (+ C t_0))))))) t_2))
        (t_4 (sqrt (* -8.0 (* F C)))))
   (if (<= B -2.0715755995410293e+32)
     (- (/ t_1 (- B)))
     (if (<= B -3.883371458485761e-210)
       t_3
       (if (<= B 7.496348083330435e-303)
         (/
          (- (fma A (* (sqrt 2.0) t_4) (/ (* F (* (* B B) (sqrt 2.0))) t_4)))
          t_2)
         (if (<= B 1174.7036553333758) t_3 (- (/ t_1 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 = hypot(B, (A - C));
	double t_1 = sqrt((2.0 * (F * ((A + C) + t_0))));
	double t_2 = fma(A, (C * -4.0), (B * B));
	double t_3 = -sqrt((t_2 * (2.0 * (F * (A + (C + t_0)))))) / t_2;
	double t_4 = sqrt((-8.0 * (F * C)));
	double tmp;
	if (B <= -2.0715755995410293e+32) {
		tmp = -(t_1 / -B);
	} else if (B <= -3.883371458485761e-210) {
		tmp = t_3;
	} else if (B <= 7.496348083330435e-303) {
		tmp = -fma(A, (sqrt(2.0) * t_4), ((F * ((B * B) * sqrt(2.0))) / t_4)) / t_2;
	} else if (B <= 1174.7036553333758) {
		tmp = t_3;
	} else {
		tmp = -(t_1 / B);
	}
	return tmp;
}
function code(A, B, C, F)
	return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)))
end
function code(A, B, C, F)
	t_0 = hypot(B, Float64(A - C))
	t_1 = sqrt(Float64(2.0 * Float64(F * Float64(Float64(A + C) + t_0))))
	t_2 = fma(A, Float64(C * -4.0), Float64(B * B))
	t_3 = Float64(Float64(-sqrt(Float64(t_2 * Float64(2.0 * Float64(F * Float64(A + Float64(C + t_0))))))) / t_2)
	t_4 = sqrt(Float64(-8.0 * Float64(F * C)))
	tmp = 0.0
	if (B <= -2.0715755995410293e+32)
		tmp = Float64(-Float64(t_1 / Float64(-B)));
	elseif (B <= -3.883371458485761e-210)
		tmp = t_3;
	elseif (B <= 7.496348083330435e-303)
		tmp = Float64(Float64(-fma(A, Float64(sqrt(2.0) * t_4), Float64(Float64(F * Float64(Float64(B * B) * sqrt(2.0))) / t_4))) / t_2);
	elseif (B <= 1174.7036553333758)
		tmp = t_3;
	else
		tmp = Float64(-Float64(t_1 / B));
	end
	return tmp
end
code[A_, B_, C_, F_] := N[((-N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[A_, B_, C_, F_] := Block[{t$95$0 = N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(2.0 * N[(F * N[(N[(A + C), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(A * N[(C * -4.0), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(t$95$2 * N[(2.0 * N[(F * N[(A + N[(C + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(-8.0 * N[(F * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -2.0715755995410293e+32], (-N[(t$95$1 / (-B)), $MachinePrecision]), If[LessEqual[B, -3.883371458485761e-210], t$95$3, If[LessEqual[B, 7.496348083330435e-303], N[((-N[(A * N[(N[Sqrt[2.0], $MachinePrecision] * t$95$4), $MachinePrecision] + N[(N[(F * N[(N[(B * B), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[B, 1174.7036553333758], t$95$3, (-N[(t$95$1 / B), $MachinePrecision])]]]]]]]]]
\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 := \mathsf{hypot}\left(B, A - C\right)\\
t_1 := \sqrt{2 \cdot \left(F \cdot \left(\left(A + C\right) + t_0\right)\right)}\\
t_2 := \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\\
t_3 := \frac{-\sqrt{t_2 \cdot \left(2 \cdot \left(F \cdot \left(A + \left(C + t_0\right)\right)\right)\right)}}{t_2}\\
t_4 := \sqrt{-8 \cdot \left(F \cdot C\right)}\\
\mathbf{if}\;B \leq -2.0715755995410293 \cdot 10^{+32}:\\
\;\;\;\;-\frac{t_1}{-B}\\

\mathbf{elif}\;B \leq -3.883371458485761 \cdot 10^{-210}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;B \leq 7.496348083330435 \cdot 10^{-303}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(A, \sqrt{2} \cdot t_4, \frac{F \cdot \left(\left(B \cdot B\right) \cdot \sqrt{2}\right)}{t_4}\right)}{t_2}\\

\mathbf{elif}\;B \leq 1174.7036553333758:\\
\;\;\;\;t_3\\

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


\end{array}

Error

Bits error versus A

Bits error versus B

Bits error versus C

Bits error versus F

Derivation

  1. Split input into 4 regimes
  2. if B < -2.0715755995410293e32

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

      \[\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.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_binary6450.4

      \[\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_binary6450.4

      \[\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_binary6450.4

      \[\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.1

      \[\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 32.3

      \[\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. Simplified32.3

      \[\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 -2.0715755995410293e32 < B < -3.8833714584857612e-210 or 7.4963480833304348e-303 < B < 1174.70365533337576

    1. Initial program 48.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. Simplified43.8

      \[\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 associate-+l+_binary6442.8

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

    if -3.8833714584857612e-210 < B < 7.4963480833304348e-303

    1. Initial program 53.9

      \[\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. Simplified47.9

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

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

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

    if 1174.70365533337576 < B

    1. Initial program 53.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. Simplified51.9

      \[\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_binary6452.1

      \[\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_binary6446.4

      \[\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_binary6446.4

      \[\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_binary6446.3

      \[\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. Simplified45.2

      \[\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 30.6

      \[\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 4 regimes into one program.
  4. Final simplification37.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq -2.0715755995410293 \cdot 10^{+32}:\\ \;\;\;\;-\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 -3.883371458485761 \cdot 10^{-210}:\\ \;\;\;\;\frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right) \cdot \left(2 \cdot \left(F \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\\ \mathbf{elif}\;B \leq 7.496348083330435 \cdot 10^{-303}:\\ \;\;\;\;\frac{-\mathsf{fma}\left(A, \sqrt{2} \cdot \sqrt{-8 \cdot \left(F \cdot C\right)}, \frac{F \cdot \left(\left(B \cdot B\right) \cdot \sqrt{2}\right)}{\sqrt{-8 \cdot \left(F \cdot C\right)}}\right)}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\\ \mathbf{elif}\;B \leq 1174.7036553333758:\\ \;\;\;\;\frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right) \cdot \left(2 \cdot \left(F \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\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 2022131 
(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))))