Average Error: 52.2 → 42.6
Time: 41.0s
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 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\ t_2 := \sqrt{-8 \cdot \left(F \cdot C\right)}\\ t_3 := -\sqrt{2}\\ \mathbf{if}\;A \leq -3.863170166797547 \cdot 10^{+218}:\\ \;\;\;\;\sqrt{-0.5 \cdot \frac{F}{C}} \cdot t_3\\ \mathbf{elif}\;A \leq -3.542441429623425 \cdot 10^{+151}:\\ \;\;\;\;\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(A - \left(t_0 - C\right)\right)} \cdot \frac{-1}{t_1}\\ \mathbf{elif}\;A \leq -2.9146789387030064 \cdot 10^{+88}:\\ \;\;\;\;\frac{A \cdot \left(\sqrt{2} \cdot t_2\right) + \frac{F \cdot \left(\sqrt{2} \cdot {B}^{2}\right)}{t_2}}{t_1}\\ \mathbf{elif}\;A \leq 1.0395642144106505 \cdot 10^{-62}:\\ \;\;\;\;-\frac{{\left({t_1}^{0.25} \cdot {\left(F \cdot \left(2 \cdot \mathsf{fma}\left({\left(\sqrt[3]{A}\right)}^{2}, \sqrt[3]{A}, C - t_0\right)\right)\right)}^{0.25}\right)}^{2}}{t_1}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{-0.5 \cdot \frac{F}{A}} \cdot t_3\\ \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 (fma B B (* C (* A -4.0))))
        (t_2 (sqrt (* -8.0 (* F C))))
        (t_3 (- (sqrt 2.0))))
   (if (<= A -3.863170166797547e+218)
     (* (sqrt (* -0.5 (/ F C))) t_3)
     (if (<= A -3.542441429623425e+151)
       (* (sqrt (* (* 2.0 (* F t_1)) (- A (- t_0 C)))) (/ -1.0 t_1))
       (if (<= A -2.9146789387030064e+88)
         (/
          (+ (* A (* (sqrt 2.0) t_2)) (/ (* F (* (sqrt 2.0) (pow B 2.0))) t_2))
          t_1)
         (if (<= A 1.0395642144106505e-62)
           (-
            (/
             (pow
              (*
               (pow t_1 0.25)
               (pow
                (* F (* 2.0 (fma (pow (cbrt A) 2.0) (cbrt A) (- C t_0))))
                0.25))
              2.0)
             t_1))
           (* (sqrt (* -0.5 (/ F A))) t_3)))))))
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 = fma(B, B, (C * (A * -4.0)));
	double t_2 = sqrt((-8.0 * (F * C)));
	double t_3 = -sqrt(2.0);
	double tmp;
	if (A <= -3.863170166797547e+218) {
		tmp = sqrt((-0.5 * (F / C))) * t_3;
	} else if (A <= -3.542441429623425e+151) {
		tmp = sqrt(((2.0 * (F * t_1)) * (A - (t_0 - C)))) * (-1.0 / t_1);
	} else if (A <= -2.9146789387030064e+88) {
		tmp = ((A * (sqrt(2.0) * t_2)) + ((F * (sqrt(2.0) * pow(B, 2.0))) / t_2)) / t_1;
	} else if (A <= 1.0395642144106505e-62) {
		tmp = -(pow((pow(t_1, 0.25) * pow((F * (2.0 * fma(pow(cbrt(A), 2.0), cbrt(A), (C - t_0)))), 0.25)), 2.0) / t_1);
	} else {
		tmp = sqrt((-0.5 * (F / A))) * t_3;
	}
	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 = fma(B, B, Float64(C * Float64(A * -4.0)))
	t_2 = sqrt(Float64(-8.0 * Float64(F * C)))
	t_3 = Float64(-sqrt(2.0))
	tmp = 0.0
	if (A <= -3.863170166797547e+218)
		tmp = Float64(sqrt(Float64(-0.5 * Float64(F / C))) * t_3);
	elseif (A <= -3.542441429623425e+151)
		tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * Float64(A - Float64(t_0 - C)))) * Float64(-1.0 / t_1));
	elseif (A <= -2.9146789387030064e+88)
		tmp = Float64(Float64(Float64(A * Float64(sqrt(2.0) * t_2)) + Float64(Float64(F * Float64(sqrt(2.0) * (B ^ 2.0))) / t_2)) / t_1);
	elseif (A <= 1.0395642144106505e-62)
		tmp = Float64(-Float64((Float64((t_1 ^ 0.25) * (Float64(F * Float64(2.0 * fma((cbrt(A) ^ 2.0), cbrt(A), Float64(C - t_0)))) ^ 0.25)) ^ 2.0) / t_1));
	else
		tmp = Float64(sqrt(Float64(-0.5 * Float64(F / A))) * t_3);
	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[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(-8.0 * N[(F * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[A, -3.863170166797547e+218], N[(N[Sqrt[N[(-0.5 * N[(F / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[A, -3.542441429623425e+151], N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(A - N[(t$95$0 - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, -2.9146789387030064e+88], N[(N[(N[(A * N[(N[Sqrt[2.0], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(F * N[(N[Sqrt[2.0], $MachinePrecision] * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[A, 1.0395642144106505e-62], (-N[(N[Power[N[(N[Power[t$95$1, 0.25], $MachinePrecision] * N[Power[N[(F * N[(2.0 * N[(N[Power[N[Power[A, 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[Power[A, 1/3], $MachinePrecision] + N[(C - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / t$95$1), $MachinePrecision]), N[(N[Sqrt[N[(-0.5 * N[(F / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$3), $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 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_2 := \sqrt{-8 \cdot \left(F \cdot C\right)}\\
t_3 := -\sqrt{2}\\
\mathbf{if}\;A \leq -3.863170166797547 \cdot 10^{+218}:\\
\;\;\;\;\sqrt{-0.5 \cdot \frac{F}{C}} \cdot t_3\\

\mathbf{elif}\;A \leq -3.542441429623425 \cdot 10^{+151}:\\
\;\;\;\;\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(A - \left(t_0 - C\right)\right)} \cdot \frac{-1}{t_1}\\

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

\mathbf{elif}\;A \leq 1.0395642144106505 \cdot 10^{-62}:\\
\;\;\;\;-\frac{{\left({t_1}^{0.25} \cdot {\left(F \cdot \left(2 \cdot \mathsf{fma}\left({\left(\sqrt[3]{A}\right)}^{2}, \sqrt[3]{A}, C - t_0\right)\right)\right)}^{0.25}\right)}^{2}}{t_1}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{-0.5 \cdot \frac{F}{A}} \cdot t_3\\


\end{array}

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 A < -3.86317016679754695e218

    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. Simplified55.7

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

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

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

    if -3.86317016679754695e218 < A < -3.542441429623425e151

    1. Initial program 62.8

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

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

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

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

    if -3.542441429623425e151 < A < -2.91467893870300642e88

    1. Initial program 43.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. Simplified43.3

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

      \[\leadsto \frac{-\color{blue}{\left(-\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)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \]

    if -2.91467893870300642e88 < A < 1.0395642144106505e-62

    1. Initial program 46.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. Simplified42.6

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

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

      \[\leadsto \frac{-{\color{blue}{\left({\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{0.25} \cdot {\left(F \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}^{0.25}\right)}}^{2}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \]
    5. Applied egg-rr42.4

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

    if 1.0395642144106505e-62 < A

    1. Initial program 59.1

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

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

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

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{-0.5 \cdot \frac{F}{A}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification42.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -3.863170166797547 \cdot 10^{+218}:\\ \;\;\;\;\sqrt{-0.5 \cdot \frac{F}{C}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;A \leq -3.542441429623425 \cdot 10^{+151}:\\ \;\;\;\;\sqrt{\left(2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)\right) \cdot \left(A - \left(\mathsf{hypot}\left(B, A - C\right) - C\right)\right)} \cdot \frac{-1}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\\ \mathbf{elif}\;A \leq -2.9146789387030064 \cdot 10^{+88}:\\ \;\;\;\;\frac{A \cdot \left(\sqrt{2} \cdot \sqrt{-8 \cdot \left(F \cdot C\right)}\right) + \frac{F \cdot \left(\sqrt{2} \cdot {B}^{2}\right)}{\sqrt{-8 \cdot \left(F \cdot C\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\\ \mathbf{elif}\;A \leq 1.0395642144106505 \cdot 10^{-62}:\\ \;\;\;\;-\frac{{\left({\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{0.25} \cdot {\left(F \cdot \left(2 \cdot \mathsf{fma}\left({\left(\sqrt[3]{A}\right)}^{2}, \sqrt[3]{A}, C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}^{0.25}\right)}^{2}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{-0.5 \cdot \frac{F}{A}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]

Reproduce

herbie shell --seed 2022150 
(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))))