Average Error: 52.3 → 41.8
Time: 44.6s
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 := A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\\ t_1 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\ \mathbf{if}\;A \leq -8.618866089292812 \cdot 10^{+101}:\\ \;\;\;\;\frac{A \cdot \left(\sqrt{2} \cdot \sqrt{-8 \cdot \left(C \cdot F\right)}\right)}{t_1}\\ \mathbf{elif}\;A \leq -5.45911078926389 \cdot 10^{-135}:\\ \;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot t_0}}{t_1}\\ \mathbf{elif}\;A \leq 7.86622038382639 \cdot 10^{+31}:\\ \;\;\;\;\frac{-{\left({t_1}^{0.25} \cdot {\left(F \cdot \left(2 \cdot t_0\right)\right)}^{0.25}\right)}^{2}}{t_1}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \left(-\sqrt{-0.5 \cdot \frac{F}{A}}\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 (+ A (- C (hypot B (- A C))))) (t_1 (fma B B (* C (* A -4.0)))))
   (if (<= A -8.618866089292812e+101)
     (/ (* A (* (sqrt 2.0) (sqrt (* -8.0 (* C F))))) t_1)
     (if (<= A -5.45911078926389e-135)
       (/ (- (sqrt (* (* 2.0 (* F t_1)) t_0))) t_1)
       (if (<= A 7.86622038382639e+31)
         (/ (- (pow (* (pow t_1 0.25) (pow (* F (* 2.0 t_0)) 0.25)) 2.0)) t_1)
         (* (sqrt 2.0) (- (sqrt (* -0.5 (/ F A))))))))))
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 = A + (C - hypot(B, (A - C)));
	double t_1 = fma(B, B, (C * (A * -4.0)));
	double tmp;
	if (A <= -8.618866089292812e+101) {
		tmp = (A * (sqrt(2.0) * sqrt((-8.0 * (C * F))))) / t_1;
	} else if (A <= -5.45911078926389e-135) {
		tmp = -sqrt(((2.0 * (F * t_1)) * t_0)) / t_1;
	} else if (A <= 7.86622038382639e+31) {
		tmp = -pow((pow(t_1, 0.25) * pow((F * (2.0 * t_0)), 0.25)), 2.0) / t_1;
	} else {
		tmp = sqrt(2.0) * -sqrt((-0.5 * (F / A)));
	}
	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 = Float64(A + Float64(C - hypot(B, Float64(A - C))))
	t_1 = fma(B, B, Float64(C * Float64(A * -4.0)))
	tmp = 0.0
	if (A <= -8.618866089292812e+101)
		tmp = Float64(Float64(A * Float64(sqrt(2.0) * sqrt(Float64(-8.0 * Float64(C * F))))) / t_1);
	elseif (A <= -5.45911078926389e-135)
		tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * t_0))) / t_1);
	elseif (A <= 7.86622038382639e+31)
		tmp = Float64(Float64(-(Float64((t_1 ^ 0.25) * (Float64(F * Float64(2.0 * t_0)) ^ 0.25)) ^ 2.0)) / t_1);
	else
		tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(-0.5 * Float64(F / A)))));
	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[(A + N[(C - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, -8.618866089292812e+101], N[(N[(A * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(-8.0 * N[(C * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[A, -5.45911078926389e-135], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[A, 7.86622038382639e+31], N[((-N[Power[N[(N[Power[t$95$1, 0.25], $MachinePrecision] * N[Power[N[(F * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(-0.5 * N[(F / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $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 := A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\\
t_1 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
\mathbf{if}\;A \leq -8.618866089292812 \cdot 10^{+101}:\\
\;\;\;\;\frac{A \cdot \left(\sqrt{2} \cdot \sqrt{-8 \cdot \left(C \cdot F\right)}\right)}{t_1}\\

\mathbf{elif}\;A \leq -5.45911078926389 \cdot 10^{-135}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot t_0}}{t_1}\\

\mathbf{elif}\;A \leq 7.86622038382639 \cdot 10^{+31}:\\
\;\;\;\;\frac{-{\left({t_1}^{0.25} \cdot {\left(F \cdot \left(2 \cdot t_0\right)\right)}^{0.25}\right)}^{2}}{t_1}\\

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


\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 A < -8.61886608929281234e101

    1. Initial program 59.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. Simplified50.1

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

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

    if -8.61886608929281234e101 < A < -5.4591107892638901e-135

    1. Initial program 42.5

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

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

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

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

    if -5.4591107892638901e-135 < A < 7.86622038382639043e31

    1. Initial program 49.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. Simplified44.9

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

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

      \[\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)} \]

    if 7.86622038382639043e31 < A

    1. Initial program 62.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. Simplified60.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -8.618866089292812 \cdot 10^{+101}:\\ \;\;\;\;\frac{A \cdot \left(\sqrt{2} \cdot \sqrt{-8 \cdot \left(C \cdot F\right)}\right)}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\\ \mathbf{elif}\;A \leq -5.45911078926389 \cdot 10^{-135}:\\ \;\;\;\;\frac{-\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(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\\ \mathbf{elif}\;A \leq 7.86622038382639 \cdot 10^{+31}:\\ \;\;\;\;\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 \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)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \left(-\sqrt{-0.5 \cdot \frac{F}{A}}\right)\\ \end{array} \]

Reproduce

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