ABCF->ab-angle a

Percentage Accurate: 18.5% → 52.6%
Time: 27.5s
Alternatives: 11
Speedup: 3.1×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\ \frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0} \end{array} \end{array} \]
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
   (/
    (-
     (sqrt
      (*
       (* 2.0 (* t_0 F))
       (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
    t_0)))
double code(double A, double B, double C, double F) {
	double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
	return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: t_0
    t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
    code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
	double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
	return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F):
	t_0 = math.pow(B, 2.0) - ((4.0 * A) * C)
	return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F)
	t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))
	return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0)
end
function tmp = code(A, B, C, F)
	t_0 = (B ^ 2.0) - ((4.0 * A) * C);
	tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0;
end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * 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]) / t$95$0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 18.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\ \frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0} \end{array} \end{array} \]
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
   (/
    (-
     (sqrt
      (*
       (* 2.0 (* t_0 F))
       (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
    t_0)))
double code(double A, double B, double C, double F) {
	double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
	return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: t_0
    t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
    code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
	double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
	return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F):
	t_0 = math.pow(B, 2.0) - ((4.0 * A) * C)
	return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F)
	t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))
	return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0)
end
function tmp = code(A, B, C, F)
	t_0 = (B ^ 2.0) - ((4.0 * A) * C);
	tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0;
end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * 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]) / t$95$0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}

Alternative 1: 52.6% accurate, 1.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ \mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{+151}:\\ \;\;\;\;\frac{\sqrt{\mathsf{hypot}\left(A - C, B\_m\right) + \left(A + C\right)} \cdot \sqrt{t\_0 \cdot \left(2 \cdot F\right)}}{-t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
   (if (<= (pow B_m 2.0) 5e+151)
     (/
      (* (sqrt (+ (hypot (- A C) B_m) (+ A C))) (sqrt (* t_0 (* 2.0 F))))
      (- t_0))
     (* (/ (sqrt 2.0) B_m) (* (sqrt (+ C (hypot C B_m))) (- (sqrt F)))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
	double tmp;
	if (pow(B_m, 2.0) <= 5e+151) {
		tmp = (sqrt((hypot((A - C), B_m) + (A + C))) * sqrt((t_0 * (2.0 * F)))) / -t_0;
	} else {
		tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(C, B_m))) * -sqrt(F));
	}
	return tmp;
}
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 5e+151)
		tmp = Float64(Float64(sqrt(Float64(hypot(Float64(A - C), B_m) + Float64(A + C))) * sqrt(Float64(t_0 * Float64(2.0 * F)))) / Float64(-t_0));
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(C + hypot(C, B_m))) * Float64(-sqrt(F))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+151], N[(N[(N[Sqrt[N[(N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{+151}:\\
\;\;\;\;\frac{\sqrt{\mathsf{hypot}\left(A - C, B\_m\right) + \left(A + C\right)} \cdot \sqrt{t\_0 \cdot \left(2 \cdot F\right)}}{-t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (pow.f64 B 2) < 5.0000000000000002e151

    1. Initial program 31.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. Simplified35.8%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. pow1/235.8%

        \[\leadsto \frac{\color{blue}{{\left(\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)\right)}^{0.5}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      2. *-commutative35.8%

        \[\leadsto \frac{{\color{blue}{\left(\left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right)\right)}}^{0.5}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      3. unpow-prod-down43.6%

        \[\leadsto \frac{\color{blue}{{\left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}^{0.5} \cdot {\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right)}^{0.5}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      4. pow1/243.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000002e151 < (pow.f64 B 2)

    1. Initial program 5.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. Add Preprocessing
    3. Taylor expanded in A around 0 7.7%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg7.7%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    5. Simplified7.7%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    6. Step-by-step derivation
      1. pow1/27.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \color{blue}{{\left(F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)\right)}^{0.5}} \]
      2. *-commutative7.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\color{blue}{\left(\left(C + \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F\right)}}^{0.5} \]
      3. unpow27.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \sqrt{\color{blue}{B \cdot B} + {C}^{2}}\right) \cdot F\right)}^{0.5} \]
      4. unpow27.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \sqrt{B \cdot B + \color{blue}{C \cdot C}}\right) \cdot F\right)}^{0.5} \]
      5. hypot-undefine25.8%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \color{blue}{\mathsf{hypot}\left(B, C\right)}\right) \cdot F\right)}^{0.5} \]
      6. unpow-prod-down41.3%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \color{blue}{\left({\left(C + \mathsf{hypot}\left(B, C\right)\right)}^{0.5} \cdot {F}^{0.5}\right)} \]
      7. pow1/241.3%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\color{blue}{\sqrt{C + \mathsf{hypot}\left(B, C\right)}} \cdot {F}^{0.5}\right) \]
      8. hypot-undefine8.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \color{blue}{\sqrt{B \cdot B + C \cdot C}}} \cdot {F}^{0.5}\right) \]
      9. unpow28.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{{B}^{2}} + C \cdot C}} \cdot {F}^{0.5}\right) \]
      10. unpow28.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{{B}^{2} + \color{blue}{{C}^{2}}}} \cdot {F}^{0.5}\right) \]
      11. +-commutative8.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{{C}^{2} + {B}^{2}}}} \cdot {F}^{0.5}\right) \]
      12. unpow28.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{C \cdot C} + {B}^{2}}} \cdot {F}^{0.5}\right) \]
      13. unpow28.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{C \cdot C + \color{blue}{B \cdot B}}} \cdot {F}^{0.5}\right) \]
      14. hypot-define41.3%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \color{blue}{\mathsf{hypot}\left(C, B\right)}} \cdot {F}^{0.5}\right) \]
      15. pow1/241.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{+151}:\\ \;\;\;\;\frac{\sqrt{\mathsf{hypot}\left(A - C, B\right) + \left(A + C\right)} \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(2 \cdot F\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 48.3% accurate, 0.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := C \cdot \left(A \cdot 4\right)\\ \mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-68}:\\ \;\;\;\;\frac{\sqrt{2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_0 - {B\_m}^{2}}\\ \mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+172}:\\ \;\;\;\;\frac{\sqrt{\mathsf{hypot}\left(A - C, B\_m\right) + \left(A + C\right)} \cdot \left(\sqrt{F} \cdot \left(B\_m \cdot \left(-\sqrt{2}\right)\right)\right)}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (* C (* A 4.0))))
   (if (<= (pow B_m 2.0) 5e-68)
     (/
      (sqrt
       (* 2.0 (* (- (pow B_m 2.0) t_0) (* F (+ (+ A C) (hypot B_m (- A C)))))))
      (- t_0 (pow B_m 2.0)))
     (if (<= (pow B_m 2.0) 5e+172)
       (/
        (*
         (sqrt (+ (hypot (- A C) B_m) (+ A C)))
         (* (sqrt F) (* B_m (- (sqrt 2.0)))))
        (fma B_m B_m (* A (* C -4.0))))
       (* (/ (sqrt 2.0) B_m) (* (sqrt (+ C (hypot C B_m))) (- (sqrt F))))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = C * (A * 4.0);
	double tmp;
	if (pow(B_m, 2.0) <= 5e-68) {
		tmp = sqrt((2.0 * ((pow(B_m, 2.0) - t_0) * (F * ((A + C) + hypot(B_m, (A - C))))))) / (t_0 - pow(B_m, 2.0));
	} else if (pow(B_m, 2.0) <= 5e+172) {
		tmp = (sqrt((hypot((A - C), B_m) + (A + C))) * (sqrt(F) * (B_m * -sqrt(2.0)))) / fma(B_m, B_m, (A * (C * -4.0)));
	} else {
		tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(C, B_m))) * -sqrt(F));
	}
	return tmp;
}
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = Float64(C * Float64(A * 4.0))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 5e-68)
		tmp = Float64(sqrt(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * Float64(F * Float64(Float64(A + C) + hypot(B_m, Float64(A - C))))))) / Float64(t_0 - (B_m ^ 2.0)));
	elseif ((B_m ^ 2.0) <= 5e+172)
		tmp = Float64(Float64(sqrt(Float64(hypot(Float64(A - C), B_m) + Float64(A + C))) * Float64(sqrt(F) * Float64(B_m * Float64(-sqrt(2.0))))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0))));
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(C + hypot(C, B_m))) * Float64(-sqrt(F))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-68], N[(N[Sqrt[N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * N[(F * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+172], N[(N[(N[Sqrt[N[(N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[(B$95$m * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-68}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_0 - {B\_m}^{2}}\\

\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+172}:\\
\;\;\;\;\frac{\sqrt{\mathsf{hypot}\left(A - C, B\_m\right) + \left(A + C\right)} \cdot \left(\sqrt{F} \cdot \left(B\_m \cdot \left(-\sqrt{2}\right)\right)\right)}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (pow.f64 B 2) < 4.99999999999999971e-68

    1. Initial program 27.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity27.4%

        \[\leadsto \color{blue}{1 \cdot \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}} \]
    4. Applied egg-rr33.5%

      \[\leadsto \color{blue}{1 \cdot \frac{-\sqrt{2 \cdot \left(\left(\left({B}^{2} - C \cdot \left(A \cdot 4\right)\right) \cdot F\right) \cdot \left(\mathsf{hypot}\left(A - C, B\right) + \left(A + C\right)\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}} \]
    5. Step-by-step derivation
      1. *-lft-identity33.5%

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

        \[\leadsto \color{blue}{-\frac{\sqrt{2 \cdot \left(\left(\left({B}^{2} - C \cdot \left(A \cdot 4\right)\right) \cdot F\right) \cdot \left(\mathsf{hypot}\left(A - C, B\right) + \left(A + C\right)\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}} \]
      3. distribute-neg-frac233.5%

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

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

    if 4.99999999999999971e-68 < (pow.f64 B 2) < 5.0000000000000001e172

    1. Initial program 37.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. Simplified38.3%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. pow1/238.3%

        \[\leadsto \frac{\color{blue}{{\left(\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)\right)}^{0.5}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      2. *-commutative38.3%

        \[\leadsto \frac{{\color{blue}{\left(\left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right)\right)}}^{0.5}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      3. unpow-prod-down51.6%

        \[\leadsto \frac{\color{blue}{{\left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}^{0.5} \cdot {\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right)}^{0.5}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      4. pow1/251.6%

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\sqrt{\color{blue}{{\left(A - C\right)}^{2} + {B}^{2}}} + \left(A + C\right)} \cdot {\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right)}^{0.5}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      10. unpow246.3%

        \[\leadsto \frac{\sqrt{\sqrt{\color{blue}{\left(A - C\right) \cdot \left(A - C\right)} + {B}^{2}} + \left(A + C\right)} \cdot {\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right)}^{0.5}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      11. unpow246.3%

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

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

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

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

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

      \[\leadsto \frac{\sqrt{\mathsf{hypot}\left(A - C, B\right) + \left(A + C\right)} \cdot \color{blue}{\left(\left(B \cdot \sqrt{2}\right) \cdot \sqrt{F}\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative30.2%

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

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

    if 5.0000000000000001e172 < (pow.f64 B 2)

    1. Initial program 4.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. Add Preprocessing
    3. Taylor expanded in A around 0 7.0%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg7.0%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    5. Simplified7.0%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    6. Step-by-step derivation
      1. pow1/27.0%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \color{blue}{{\left(F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)\right)}^{0.5}} \]
      2. *-commutative7.0%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\color{blue}{\left(\left(C + \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F\right)}}^{0.5} \]
      3. unpow27.0%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \sqrt{\color{blue}{B \cdot B} + {C}^{2}}\right) \cdot F\right)}^{0.5} \]
      4. unpow27.0%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \sqrt{B \cdot B + \color{blue}{C \cdot C}}\right) \cdot F\right)}^{0.5} \]
      5. hypot-undefine26.2%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \color{blue}{\mathsf{hypot}\left(B, C\right)}\right) \cdot F\right)}^{0.5} \]
      6. unpow-prod-down42.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \color{blue}{\left({\left(C + \mathsf{hypot}\left(B, C\right)\right)}^{0.5} \cdot {F}^{0.5}\right)} \]
      7. pow1/242.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\color{blue}{\sqrt{C + \mathsf{hypot}\left(B, C\right)}} \cdot {F}^{0.5}\right) \]
      8. hypot-undefine8.1%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \color{blue}{\sqrt{B \cdot B + C \cdot C}}} \cdot {F}^{0.5}\right) \]
      9. unpow28.1%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{{B}^{2}} + C \cdot C}} \cdot {F}^{0.5}\right) \]
      10. unpow28.1%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{{B}^{2} + \color{blue}{{C}^{2}}}} \cdot {F}^{0.5}\right) \]
      11. +-commutative8.1%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{{C}^{2} + {B}^{2}}}} \cdot {F}^{0.5}\right) \]
      12. unpow28.1%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{C \cdot C} + {B}^{2}}} \cdot {F}^{0.5}\right) \]
      13. unpow28.1%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{C \cdot C + \color{blue}{B \cdot B}}} \cdot {F}^{0.5}\right) \]
      14. hypot-define42.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \color{blue}{\mathsf{hypot}\left(C, B\right)}} \cdot {F}^{0.5}\right) \]
      15. pow1/242.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{-68}:\\ \;\;\;\;\frac{\sqrt{2 \cdot \left(\left({B}^{2} - C \cdot \left(A \cdot 4\right)\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{C \cdot \left(A \cdot 4\right) - {B}^{2}}\\ \mathbf{elif}\;{B}^{2} \leq 5 \cdot 10^{+172}:\\ \;\;\;\;\frac{\sqrt{\mathsf{hypot}\left(A - C, B\right) + \left(A + C\right)} \cdot \left(\sqrt{F} \cdot \left(B \cdot \left(-\sqrt{2}\right)\right)\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 48.4% accurate, 1.2× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := C \cdot \left(A \cdot 4\right)\\ \mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{+39}:\\ \;\;\;\;\frac{\sqrt{2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_0 - {B\_m}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (* C (* A 4.0))))
   (if (<= (pow B_m 2.0) 5e+39)
     (/
      (sqrt
       (* 2.0 (* (- (pow B_m 2.0) t_0) (* F (+ (+ A C) (hypot B_m (- A C)))))))
      (- t_0 (pow B_m 2.0)))
     (* (/ (sqrt 2.0) B_m) (* (sqrt (+ C (hypot C B_m))) (- (sqrt F)))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = C * (A * 4.0);
	double tmp;
	if (pow(B_m, 2.0) <= 5e+39) {
		tmp = sqrt((2.0 * ((pow(B_m, 2.0) - t_0) * (F * ((A + C) + hypot(B_m, (A - C))))))) / (t_0 - pow(B_m, 2.0));
	} else {
		tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(C, B_m))) * -sqrt(F));
	}
	return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	double t_0 = C * (A * 4.0);
	double tmp;
	if (Math.pow(B_m, 2.0) <= 5e+39) {
		tmp = Math.sqrt((2.0 * ((Math.pow(B_m, 2.0) - t_0) * (F * ((A + C) + Math.hypot(B_m, (A - C))))))) / (t_0 - Math.pow(B_m, 2.0));
	} else {
		tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt((C + Math.hypot(C, B_m))) * -Math.sqrt(F));
	}
	return tmp;
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	t_0 = C * (A * 4.0)
	tmp = 0
	if math.pow(B_m, 2.0) <= 5e+39:
		tmp = math.sqrt((2.0 * ((math.pow(B_m, 2.0) - t_0) * (F * ((A + C) + math.hypot(B_m, (A - C))))))) / (t_0 - math.pow(B_m, 2.0))
	else:
		tmp = (math.sqrt(2.0) / B_m) * (math.sqrt((C + math.hypot(C, B_m))) * -math.sqrt(F))
	return tmp
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = Float64(C * Float64(A * 4.0))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 5e+39)
		tmp = Float64(sqrt(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * Float64(F * Float64(Float64(A + C) + hypot(B_m, Float64(A - C))))))) / Float64(t_0 - (B_m ^ 2.0)));
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(C + hypot(C, B_m))) * Float64(-sqrt(F))));
	end
	return tmp
end
B_m = abs(B);
function tmp_2 = code(A, B_m, C, F)
	t_0 = C * (A * 4.0);
	tmp = 0.0;
	if ((B_m ^ 2.0) <= 5e+39)
		tmp = sqrt((2.0 * (((B_m ^ 2.0) - t_0) * (F * ((A + C) + hypot(B_m, (A - C))))))) / (t_0 - (B_m ^ 2.0));
	else
		tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(C, B_m))) * -sqrt(F));
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+39], N[(N[Sqrt[N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * N[(F * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{+39}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_0 - {B\_m}^{2}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (pow.f64 B 2) < 5.00000000000000015e39

    1. Initial program 28.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity28.9%

        \[\leadsto \color{blue}{1 \cdot \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}} \]
    4. Applied egg-rr34.1%

      \[\leadsto \color{blue}{1 \cdot \frac{-\sqrt{2 \cdot \left(\left(\left({B}^{2} - C \cdot \left(A \cdot 4\right)\right) \cdot F\right) \cdot \left(\mathsf{hypot}\left(A - C, B\right) + \left(A + C\right)\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}} \]
    5. Step-by-step derivation
      1. *-lft-identity34.1%

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

        \[\leadsto \color{blue}{-\frac{\sqrt{2 \cdot \left(\left(\left({B}^{2} - C \cdot \left(A \cdot 4\right)\right) \cdot F\right) \cdot \left(\mathsf{hypot}\left(A - C, B\right) + \left(A + C\right)\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}} \]
      3. distribute-neg-frac234.1%

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

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

    if 5.00000000000000015e39 < (pow.f64 B 2)

    1. Initial program 13.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. Add Preprocessing
    3. Taylor expanded in A around 0 11.2%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg11.2%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    5. Simplified11.2%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    6. Step-by-step derivation
      1. pow1/211.2%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \color{blue}{{\left(F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)\right)}^{0.5}} \]
      2. *-commutative11.2%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\color{blue}{\left(\left(C + \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F\right)}}^{0.5} \]
      3. unpow211.2%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \sqrt{\color{blue}{B \cdot B} + {C}^{2}}\right) \cdot F\right)}^{0.5} \]
      4. unpow211.2%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \sqrt{B \cdot B + \color{blue}{C \cdot C}}\right) \cdot F\right)}^{0.5} \]
      5. hypot-undefine25.4%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \color{blue}{\mathsf{hypot}\left(B, C\right)}\right) \cdot F\right)}^{0.5} \]
      6. unpow-prod-down37.6%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \color{blue}{\left({\left(C + \mathsf{hypot}\left(B, C\right)\right)}^{0.5} \cdot {F}^{0.5}\right)} \]
      7. pow1/237.6%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\color{blue}{\sqrt{C + \mathsf{hypot}\left(B, C\right)}} \cdot {F}^{0.5}\right) \]
      8. hypot-undefine12.0%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \color{blue}{\sqrt{B \cdot B + C \cdot C}}} \cdot {F}^{0.5}\right) \]
      9. unpow212.0%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{{B}^{2}} + C \cdot C}} \cdot {F}^{0.5}\right) \]
      10. unpow212.0%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{{B}^{2} + \color{blue}{{C}^{2}}}} \cdot {F}^{0.5}\right) \]
      11. +-commutative12.0%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{{C}^{2} + {B}^{2}}}} \cdot {F}^{0.5}\right) \]
      12. unpow212.0%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{C \cdot C} + {B}^{2}}} \cdot {F}^{0.5}\right) \]
      13. unpow212.0%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{C \cdot C + \color{blue}{B \cdot B}}} \cdot {F}^{0.5}\right) \]
      14. hypot-define37.6%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \color{blue}{\mathsf{hypot}\left(C, B\right)}} \cdot {F}^{0.5}\right) \]
      15. pow1/237.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{+39}:\\ \;\;\;\;\frac{\sqrt{2 \cdot \left(\left({B}^{2} - C \cdot \left(A \cdot 4\right)\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{C \cdot \left(A \cdot 4\right) - {B}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 48.1% accurate, 1.2× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ \mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{+34}:\\ \;\;\;\;\frac{\sqrt{\left(t\_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right)}}{-t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
   (if (<= (pow B_m 2.0) 5e+34)
     (/ (sqrt (* (* t_0 (* 2.0 F)) (+ (+ A C) (hypot B_m (- A C))))) (- t_0))
     (* (/ (sqrt 2.0) B_m) (* (sqrt (+ C (hypot C B_m))) (- (sqrt F)))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
	double tmp;
	if (pow(B_m, 2.0) <= 5e+34) {
		tmp = sqrt(((t_0 * (2.0 * F)) * ((A + C) + hypot(B_m, (A - C))))) / -t_0;
	} else {
		tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(C, B_m))) * -sqrt(F));
	}
	return tmp;
}
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 5e+34)
		tmp = Float64(sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(Float64(A + C) + hypot(B_m, Float64(A - C))))) / Float64(-t_0));
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(C + hypot(C, B_m))) * Float64(-sqrt(F))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+34], N[(N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{+34}:\\
\;\;\;\;\frac{\sqrt{\left(t\_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right)}}{-t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (pow.f64 B 2) < 4.9999999999999998e34

    1. Initial program 28.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. Simplified33.8%

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

    if 4.9999999999999998e34 < (pow.f64 B 2)

    1. Initial program 14.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. Add Preprocessing
    3. Taylor expanded in A around 0 11.8%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg11.8%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    5. Simplified11.8%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    6. Step-by-step derivation
      1. pow1/211.8%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \color{blue}{{\left(F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)\right)}^{0.5}} \]
      2. *-commutative11.8%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\color{blue}{\left(\left(C + \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F\right)}}^{0.5} \]
      3. unpow211.8%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \sqrt{\color{blue}{B \cdot B} + {C}^{2}}\right) \cdot F\right)}^{0.5} \]
      4. unpow211.8%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \sqrt{B \cdot B + \color{blue}{C \cdot C}}\right) \cdot F\right)}^{0.5} \]
      5. hypot-undefine25.8%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \color{blue}{\mathsf{hypot}\left(B, C\right)}\right) \cdot F\right)}^{0.5} \]
      6. unpow-prod-down37.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \color{blue}{\left({\left(C + \mathsf{hypot}\left(B, C\right)\right)}^{0.5} \cdot {F}^{0.5}\right)} \]
      7. pow1/237.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\color{blue}{\sqrt{C + \mathsf{hypot}\left(B, C\right)}} \cdot {F}^{0.5}\right) \]
      8. hypot-undefine12.6%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \color{blue}{\sqrt{B \cdot B + C \cdot C}}} \cdot {F}^{0.5}\right) \]
      9. unpow212.6%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{{B}^{2}} + C \cdot C}} \cdot {F}^{0.5}\right) \]
      10. unpow212.6%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{{B}^{2} + \color{blue}{{C}^{2}}}} \cdot {F}^{0.5}\right) \]
      11. +-commutative12.6%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{{C}^{2} + {B}^{2}}}} \cdot {F}^{0.5}\right) \]
      12. unpow212.6%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{C \cdot C} + {B}^{2}}} \cdot {F}^{0.5}\right) \]
      13. unpow212.6%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{C \cdot C + \color{blue}{B \cdot B}}} \cdot {F}^{0.5}\right) \]
      14. hypot-define37.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \color{blue}{\mathsf{hypot}\left(C, B\right)}} \cdot {F}^{0.5}\right) \]
      15. pow1/237.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{+34}:\\ \;\;\;\;\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(2 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 45.1% accurate, 1.2× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := C \cdot \left(A \cdot 4\right)\\ \mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-108}:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot \left(F \cdot \left({B\_m}^{2} - t\_0\right)\right)\right) \cdot \left(2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (* C (* A 4.0))))
   (if (<= (pow B_m 2.0) 5e-108)
     (/
      (sqrt (* (* 2.0 (* F (- (pow B_m 2.0) t_0))) (* 2.0 A)))
      (- t_0 (pow B_m 2.0)))
     (* (/ (sqrt 2.0) B_m) (* (sqrt (+ C (hypot C B_m))) (- (sqrt F)))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = C * (A * 4.0);
	double tmp;
	if (pow(B_m, 2.0) <= 5e-108) {
		tmp = sqrt(((2.0 * (F * (pow(B_m, 2.0) - t_0))) * (2.0 * A))) / (t_0 - pow(B_m, 2.0));
	} else {
		tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(C, B_m))) * -sqrt(F));
	}
	return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	double t_0 = C * (A * 4.0);
	double tmp;
	if (Math.pow(B_m, 2.0) <= 5e-108) {
		tmp = Math.sqrt(((2.0 * (F * (Math.pow(B_m, 2.0) - t_0))) * (2.0 * A))) / (t_0 - Math.pow(B_m, 2.0));
	} else {
		tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt((C + Math.hypot(C, B_m))) * -Math.sqrt(F));
	}
	return tmp;
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	t_0 = C * (A * 4.0)
	tmp = 0
	if math.pow(B_m, 2.0) <= 5e-108:
		tmp = math.sqrt(((2.0 * (F * (math.pow(B_m, 2.0) - t_0))) * (2.0 * A))) / (t_0 - math.pow(B_m, 2.0))
	else:
		tmp = (math.sqrt(2.0) / B_m) * (math.sqrt((C + math.hypot(C, B_m))) * -math.sqrt(F))
	return tmp
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = Float64(C * Float64(A * 4.0))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 5e-108)
		tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(F * Float64((B_m ^ 2.0) - t_0))) * Float64(2.0 * A))) / Float64(t_0 - (B_m ^ 2.0)));
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(C + hypot(C, B_m))) * Float64(-sqrt(F))));
	end
	return tmp
end
B_m = abs(B);
function tmp_2 = code(A, B_m, C, F)
	t_0 = C * (A * 4.0);
	tmp = 0.0;
	if ((B_m ^ 2.0) <= 5e-108)
		tmp = sqrt(((2.0 * (F * ((B_m ^ 2.0) - t_0))) * (2.0 * A))) / (t_0 - (B_m ^ 2.0));
	else
		tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(C, B_m))) * -sqrt(F));
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-108], N[(N[Sqrt[N[(N[(2.0 * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-108}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(F \cdot \left({B\_m}^{2} - t\_0\right)\right)\right) \cdot \left(2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (pow.f64 B 2) < 5e-108

    1. Initial program 24.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. Add Preprocessing
    3. Taylor expanded in A around inf 29.7%

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

    if 5e-108 < (pow.f64 B 2)

    1. Initial program 19.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. Add Preprocessing
    3. Taylor expanded in A around 0 13.1%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg13.1%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    5. Simplified13.1%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    6. Step-by-step derivation
      1. pow1/213.2%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \color{blue}{{\left(F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)\right)}^{0.5}} \]
      2. *-commutative13.2%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\color{blue}{\left(\left(C + \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F\right)}}^{0.5} \]
      3. unpow213.2%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \sqrt{\color{blue}{B \cdot B} + {C}^{2}}\right) \cdot F\right)}^{0.5} \]
      4. unpow213.2%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \sqrt{B \cdot B + \color{blue}{C \cdot C}}\right) \cdot F\right)}^{0.5} \]
      5. hypot-undefine24.7%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot {\left(\left(C + \color{blue}{\mathsf{hypot}\left(B, C\right)}\right) \cdot F\right)}^{0.5} \]
      6. unpow-prod-down34.3%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \color{blue}{\left({\left(C + \mathsf{hypot}\left(B, C\right)\right)}^{0.5} \cdot {F}^{0.5}\right)} \]
      7. pow1/234.3%

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

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \color{blue}{\sqrt{B \cdot B + C \cdot C}}} \cdot {F}^{0.5}\right) \]
      9. unpow213.8%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{{B}^{2}} + C \cdot C}} \cdot {F}^{0.5}\right) \]
      10. unpow213.8%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{{B}^{2} + \color{blue}{{C}^{2}}}} \cdot {F}^{0.5}\right) \]
      11. +-commutative13.8%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{{C}^{2} + {B}^{2}}}} \cdot {F}^{0.5}\right) \]
      12. unpow213.8%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{\color{blue}{C \cdot C} + {B}^{2}}} \cdot {F}^{0.5}\right) \]
      13. unpow213.8%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \sqrt{C \cdot C + \color{blue}{B \cdot B}}} \cdot {F}^{0.5}\right) \]
      14. hypot-define34.3%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \color{blue}{\mathsf{hypot}\left(C, B\right)}} \cdot {F}^{0.5}\right) \]
      15. pow1/234.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{-108}:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot \left(F \cdot \left({B}^{2} - C \cdot \left(A \cdot 4\right)\right)\right)\right) \cdot \left(2 \cdot A\right)}}{C \cdot \left(A \cdot 4\right) - {B}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 41.7% accurate, 1.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := -\sqrt{2}\\ \mathbf{if}\;F \leq 6.5 \cdot 10^{-307}:\\ \;\;\;\;\frac{\sqrt{\left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right) \cdot \left(\left(A \cdot -8\right) \cdot \left(C \cdot F\right)\right)}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;F \leq 5.45 \cdot 10^{+17}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{t\_0}{B\_m}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot t\_0\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (- (sqrt 2.0))))
   (if (<= F 6.5e-307)
     (/
      (sqrt (* (+ (+ A C) (hypot B_m (- A C))) (* (* A -8.0) (* C F))))
      (- (fma B_m B_m (* A (* C -4.0)))))
     (if (<= F 5.45e+17)
       (* (sqrt (* F (+ A (hypot B_m A)))) (/ t_0 B_m))
       (* (sqrt (/ F B_m)) t_0)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = -sqrt(2.0);
	double tmp;
	if (F <= 6.5e-307) {
		tmp = sqrt((((A + C) + hypot(B_m, (A - C))) * ((A * -8.0) * (C * F)))) / -fma(B_m, B_m, (A * (C * -4.0)));
	} else if (F <= 5.45e+17) {
		tmp = sqrt((F * (A + hypot(B_m, A)))) * (t_0 / B_m);
	} else {
		tmp = sqrt((F / B_m)) * t_0;
	}
	return tmp;
}
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = Float64(-sqrt(2.0))
	tmp = 0.0
	if (F <= 6.5e-307)
		tmp = Float64(sqrt(Float64(Float64(Float64(A + C) + hypot(B_m, Float64(A - C))) * Float64(Float64(A * -8.0) * Float64(C * F)))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0)))));
	elseif (F <= 5.45e+17)
		tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(t_0 / B_m));
	else
		tmp = Float64(sqrt(Float64(F / B_m)) * t_0);
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, 6.5e-307], N[(N[Sqrt[N[(N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(A * -8.0), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 5.45e+17], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq 6.5 \cdot 10^{-307}:\\
\;\;\;\;\frac{\sqrt{\left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right) \cdot \left(\left(A \cdot -8\right) \cdot \left(C \cdot F\right)\right)}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\

\mathbf{elif}\;F \leq 5.45 \cdot 10^{+17}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{t\_0}{B\_m}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < 6.5000000000000001e-307

    1. Initial program 33.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. Simplified43.4%

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

      \[\leadsto \frac{\sqrt{\color{blue}{\left(-8 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)} \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*30.3%

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

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

    if 6.5000000000000001e-307 < F < 5.45e17

    1. Initial program 23.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. Add Preprocessing
    3. Taylor expanded in C around 0 13.9%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg13.9%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. +-commutative13.9%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}\right)} \]
      3. unpow213.9%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right)} \]
      4. unpow213.9%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right)} \]
      5. hypot-define28.2%

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

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

    if 5.45e17 < F

    1. Initial program 16.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. Add Preprocessing
    3. Taylor expanded in A around 0 9.6%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg9.6%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    5. Simplified9.6%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    6. Taylor expanded in C around 0 23.8%

      \[\leadsto -\color{blue}{\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification26.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 6.5 \cdot 10^{-307}:\\ \;\;\;\;\frac{\sqrt{\left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(\left(A \cdot -8\right) \cdot \left(C \cdot F\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;F \leq 5.45 \cdot 10^{+17}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 38.7% accurate, 2.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := -\sqrt{2}\\ \mathbf{if}\;F \leq 6.5 \cdot 10^{-307}:\\ \;\;\;\;\frac{\sqrt{\left(A \cdot -16\right) \cdot \left(F \cdot {C}^{2}\right)}}{4 \cdot \left(A \cdot C\right) - {B\_m}^{2}}\\ \mathbf{elif}\;F \leq 5.45 \cdot 10^{+17}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{t\_0}{B\_m}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot t\_0\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (- (sqrt 2.0))))
   (if (<= F 6.5e-307)
     (/
      (sqrt (* (* A -16.0) (* F (pow C 2.0))))
      (- (* 4.0 (* A C)) (pow B_m 2.0)))
     (if (<= F 5.45e+17)
       (* (sqrt (* F (+ A (hypot B_m A)))) (/ t_0 B_m))
       (* (sqrt (/ F B_m)) t_0)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = -sqrt(2.0);
	double tmp;
	if (F <= 6.5e-307) {
		tmp = sqrt(((A * -16.0) * (F * pow(C, 2.0)))) / ((4.0 * (A * C)) - pow(B_m, 2.0));
	} else if (F <= 5.45e+17) {
		tmp = sqrt((F * (A + hypot(B_m, A)))) * (t_0 / B_m);
	} else {
		tmp = sqrt((F / B_m)) * t_0;
	}
	return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	double t_0 = -Math.sqrt(2.0);
	double tmp;
	if (F <= 6.5e-307) {
		tmp = Math.sqrt(((A * -16.0) * (F * Math.pow(C, 2.0)))) / ((4.0 * (A * C)) - Math.pow(B_m, 2.0));
	} else if (F <= 5.45e+17) {
		tmp = Math.sqrt((F * (A + Math.hypot(B_m, A)))) * (t_0 / B_m);
	} else {
		tmp = Math.sqrt((F / B_m)) * t_0;
	}
	return tmp;
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	t_0 = -math.sqrt(2.0)
	tmp = 0
	if F <= 6.5e-307:
		tmp = math.sqrt(((A * -16.0) * (F * math.pow(C, 2.0)))) / ((4.0 * (A * C)) - math.pow(B_m, 2.0))
	elif F <= 5.45e+17:
		tmp = math.sqrt((F * (A + math.hypot(B_m, A)))) * (t_0 / B_m)
	else:
		tmp = math.sqrt((F / B_m)) * t_0
	return tmp
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = Float64(-sqrt(2.0))
	tmp = 0.0
	if (F <= 6.5e-307)
		tmp = Float64(sqrt(Float64(Float64(A * -16.0) * Float64(F * (C ^ 2.0)))) / Float64(Float64(4.0 * Float64(A * C)) - (B_m ^ 2.0)));
	elseif (F <= 5.45e+17)
		tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(t_0 / B_m));
	else
		tmp = Float64(sqrt(Float64(F / B_m)) * t_0);
	end
	return tmp
end
B_m = abs(B);
function tmp_2 = code(A, B_m, C, F)
	t_0 = -sqrt(2.0);
	tmp = 0.0;
	if (F <= 6.5e-307)
		tmp = sqrt(((A * -16.0) * (F * (C ^ 2.0)))) / ((4.0 * (A * C)) - (B_m ^ 2.0));
	elseif (F <= 5.45e+17)
		tmp = sqrt((F * (A + hypot(B_m, A)))) * (t_0 / B_m);
	else
		tmp = sqrt((F / B_m)) * t_0;
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, 6.5e-307], N[(N[Sqrt[N[(N[(A * -16.0), $MachinePrecision] * N[(F * N[Power[C, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5.45e+17], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq 6.5 \cdot 10^{-307}:\\
\;\;\;\;\frac{\sqrt{\left(A \cdot -16\right) \cdot \left(F \cdot {C}^{2}\right)}}{4 \cdot \left(A \cdot C\right) - {B\_m}^{2}}\\

\mathbf{elif}\;F \leq 5.45 \cdot 10^{+17}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{t\_0}{B\_m}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < 6.5000000000000001e-307

    1. Initial program 33.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.5%

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

      \[\leadsto \frac{\sqrt{\color{blue}{-16 \cdot \left(A \cdot \left({C}^{2} \cdot F\right)\right)}}}{4 \cdot \left(A \cdot C\right) - {B}^{2}} \]
    5. Step-by-step derivation
      1. associate-*r*17.9%

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

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

    if 6.5000000000000001e-307 < F < 5.45e17

    1. Initial program 23.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. Add Preprocessing
    3. Taylor expanded in C around 0 13.9%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg13.9%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. +-commutative13.9%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}\right)} \]
      3. unpow213.9%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right)} \]
      4. unpow213.9%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right)} \]
      5. hypot-define28.2%

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

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

    if 5.45e17 < F

    1. Initial program 16.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. Add Preprocessing
    3. Taylor expanded in A around 0 9.6%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg9.6%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    5. Simplified9.6%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    6. Taylor expanded in C around 0 23.8%

      \[\leadsto -\color{blue}{\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification25.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 6.5 \cdot 10^{-307}:\\ \;\;\;\;\frac{\sqrt{\left(A \cdot -16\right) \cdot \left(F \cdot {C}^{2}\right)}}{4 \cdot \left(A \cdot C\right) - {B}^{2}}\\ \mathbf{elif}\;F \leq 5.45 \cdot 10^{+17}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 37.1% accurate, 2.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := -\sqrt{2}\\ \mathbf{if}\;F \leq 5.45 \cdot 10^{+17}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{t\_0}{B\_m}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot t\_0\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (- (sqrt 2.0))))
   (if (<= F 5.45e+17)
     (* (sqrt (* F (+ A (hypot B_m A)))) (/ t_0 B_m))
     (* (sqrt (/ F B_m)) t_0))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = -sqrt(2.0);
	double tmp;
	if (F <= 5.45e+17) {
		tmp = sqrt((F * (A + hypot(B_m, A)))) * (t_0 / B_m);
	} else {
		tmp = sqrt((F / B_m)) * t_0;
	}
	return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	double t_0 = -Math.sqrt(2.0);
	double tmp;
	if (F <= 5.45e+17) {
		tmp = Math.sqrt((F * (A + Math.hypot(B_m, A)))) * (t_0 / B_m);
	} else {
		tmp = Math.sqrt((F / B_m)) * t_0;
	}
	return tmp;
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	t_0 = -math.sqrt(2.0)
	tmp = 0
	if F <= 5.45e+17:
		tmp = math.sqrt((F * (A + math.hypot(B_m, A)))) * (t_0 / B_m)
	else:
		tmp = math.sqrt((F / B_m)) * t_0
	return tmp
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = Float64(-sqrt(2.0))
	tmp = 0.0
	if (F <= 5.45e+17)
		tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(t_0 / B_m));
	else
		tmp = Float64(sqrt(Float64(F / B_m)) * t_0);
	end
	return tmp
end
B_m = abs(B);
function tmp_2 = code(A, B_m, C, F)
	t_0 = -sqrt(2.0);
	tmp = 0.0;
	if (F <= 5.45e+17)
		tmp = sqrt((F * (A + hypot(B_m, A)))) * (t_0 / B_m);
	else
		tmp = sqrt((F / B_m)) * t_0;
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, 5.45e+17], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq 5.45 \cdot 10^{+17}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{t\_0}{B\_m}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 5.45e17

    1. Initial program 25.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. Add Preprocessing
    3. Taylor expanded in C around 0 11.2%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg11.2%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. +-commutative11.2%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}\right)} \]
      3. unpow211.2%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right)} \]
      4. unpow211.2%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right)} \]
      5. hypot-define22.6%

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)} \]
    5. Simplified22.6%

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

    if 5.45e17 < F

    1. Initial program 16.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. Add Preprocessing
    3. Taylor expanded in A around 0 9.6%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg9.6%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    5. Simplified9.6%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    6. Taylor expanded in C around 0 23.8%

      \[\leadsto -\color{blue}{\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification23.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 5.45 \cdot 10^{+17}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 36.3% accurate, 2.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} \mathbf{if}\;F \leq 3.4 \cdot 10^{-58}:\\ \;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (if (<= F 3.4e-58)
   (/ (sqrt (* 2.0 (* F (+ C (hypot B_m C))))) (- B_m))
   (* (sqrt (/ F B_m)) (- (sqrt 2.0)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (F <= 3.4e-58) {
		tmp = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
	} else {
		tmp = sqrt((F / B_m)) * -sqrt(2.0);
	}
	return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (F <= 3.4e-58) {
		tmp = Math.sqrt((2.0 * (F * (C + Math.hypot(B_m, C))))) / -B_m;
	} else {
		tmp = Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
	}
	return tmp;
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	tmp = 0
	if F <= 3.4e-58:
		tmp = math.sqrt((2.0 * (F * (C + math.hypot(B_m, C))))) / -B_m
	else:
		tmp = math.sqrt((F / B_m)) * -math.sqrt(2.0)
	return tmp
B_m = abs(B)
function code(A, B_m, C, F)
	tmp = 0.0
	if (F <= 3.4e-58)
		tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(B_m, C))))) / Float64(-B_m));
	else
		tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0)));
	end
	return tmp
end
B_m = abs(B);
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (F <= 3.4e-58)
		tmp = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
	else
		tmp = sqrt((F / B_m)) * -sqrt(2.0);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 3.4e-58], N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
\mathbf{if}\;F \leq 3.4 \cdot 10^{-58}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 3.39999999999999973e-58

    1. Initial program 25.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. Add Preprocessing
    3. Taylor expanded in A around 0 8.6%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg8.6%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    5. Simplified8.6%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    6. Step-by-step derivation
      1. associate-*l/8.6%

        \[\leadsto -\color{blue}{\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}}{B}} \]
    7. Applied egg-rr20.0%

      \[\leadsto -\color{blue}{\frac{{\left(2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)\right)\right)}^{0.5}}{B}} \]
    8. Step-by-step derivation
      1. unpow1/220.0%

        \[\leadsto -\frac{\color{blue}{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)\right)}}}{B} \]
      2. distribute-rgt-in20.0%

        \[\leadsto -\frac{\sqrt{2 \cdot \color{blue}{\left(C \cdot F + \mathsf{hypot}\left(C, B\right) \cdot F\right)}}}{B} \]
      3. hypot-undefine8.7%

        \[\leadsto -\frac{\sqrt{2 \cdot \left(C \cdot F + \color{blue}{\sqrt{C \cdot C + B \cdot B}} \cdot F\right)}}{B} \]
      4. unpow28.7%

        \[\leadsto -\frac{\sqrt{2 \cdot \left(C \cdot F + \sqrt{\color{blue}{{C}^{2}} + B \cdot B} \cdot F\right)}}{B} \]
      5. unpow28.7%

        \[\leadsto -\frac{\sqrt{2 \cdot \left(C \cdot F + \sqrt{{C}^{2} + \color{blue}{{B}^{2}}} \cdot F\right)}}{B} \]
      6. +-commutative8.7%

        \[\leadsto -\frac{\sqrt{2 \cdot \left(C \cdot F + \sqrt{\color{blue}{{B}^{2} + {C}^{2}}} \cdot F\right)}}{B} \]
      7. distribute-rgt-in8.7%

        \[\leadsto -\frac{\sqrt{2 \cdot \color{blue}{\left(F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)\right)}}}{B} \]
      8. unpow28.7%

        \[\leadsto -\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \sqrt{\color{blue}{B \cdot B} + {C}^{2}}\right)\right)}}{B} \]
      9. unpow28.7%

        \[\leadsto -\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \sqrt{B \cdot B + \color{blue}{C \cdot C}}\right)\right)}}{B} \]
      10. hypot-undefine20.0%

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

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

    if 3.39999999999999973e-58 < F

    1. Initial program 17.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. Add Preprocessing
    3. Taylor expanded in A around 0 10.8%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg10.8%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    5. Simplified10.8%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    6. Taylor expanded in C around 0 24.1%

      \[\leadsto -\color{blue}{\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification22.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 3.4 \cdot 10^{-58}:\\ \;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)\right)}}{-B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 34.9% accurate, 3.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := -\sqrt{2}\\ \mathbf{if}\;F \leq 2.35 \cdot 10^{-57}:\\ \;\;\;\;\sqrt{B\_m \cdot F} \cdot \frac{t\_0}{B\_m}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot t\_0\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (- (sqrt 2.0))))
   (if (<= F 2.35e-57)
     (* (sqrt (* B_m F)) (/ t_0 B_m))
     (* (sqrt (/ F B_m)) t_0))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = -sqrt(2.0);
	double tmp;
	if (F <= 2.35e-57) {
		tmp = sqrt((B_m * F)) * (t_0 / B_m);
	} else {
		tmp = sqrt((F / B_m)) * t_0;
	}
	return tmp;
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -sqrt(2.0d0)
    if (f <= 2.35d-57) then
        tmp = sqrt((b_m * f)) * (t_0 / b_m)
    else
        tmp = sqrt((f / b_m)) * t_0
    end if
    code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	double t_0 = -Math.sqrt(2.0);
	double tmp;
	if (F <= 2.35e-57) {
		tmp = Math.sqrt((B_m * F)) * (t_0 / B_m);
	} else {
		tmp = Math.sqrt((F / B_m)) * t_0;
	}
	return tmp;
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	t_0 = -math.sqrt(2.0)
	tmp = 0
	if F <= 2.35e-57:
		tmp = math.sqrt((B_m * F)) * (t_0 / B_m)
	else:
		tmp = math.sqrt((F / B_m)) * t_0
	return tmp
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = Float64(-sqrt(2.0))
	tmp = 0.0
	if (F <= 2.35e-57)
		tmp = Float64(sqrt(Float64(B_m * F)) * Float64(t_0 / B_m));
	else
		tmp = Float64(sqrt(Float64(F / B_m)) * t_0);
	end
	return tmp
end
B_m = abs(B);
function tmp_2 = code(A, B_m, C, F)
	t_0 = -sqrt(2.0);
	tmp = 0.0;
	if (F <= 2.35e-57)
		tmp = sqrt((B_m * F)) * (t_0 / B_m);
	else
		tmp = sqrt((F / B_m)) * t_0;
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, 2.35e-57], N[(N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq 2.35 \cdot 10^{-57}:\\
\;\;\;\;\sqrt{B\_m \cdot F} \cdot \frac{t\_0}{B\_m}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 2.3499999999999999e-57

    1. Initial program 25.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. Add Preprocessing
    3. Taylor expanded in A around 0 8.6%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg8.6%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    5. Simplified8.6%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    6. Taylor expanded in C around 0 17.8%

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

    if 2.3499999999999999e-57 < F

    1. Initial program 17.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. Add Preprocessing
    3. Taylor expanded in A around 0 10.8%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg10.8%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    5. Simplified10.8%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    6. Taylor expanded in C around 0 24.1%

      \[\leadsto -\color{blue}{\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification21.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 2.35 \cdot 10^{-57}:\\ \;\;\;\;\sqrt{B \cdot F} \cdot \frac{-\sqrt{2}}{B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 27.4% accurate, 3.1× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right) \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F) :precision binary64 (* (sqrt (/ F B_m)) (- (sqrt 2.0))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	return sqrt((F / B_m)) * -sqrt(2.0);
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = sqrt((f / b_m)) * -sqrt(2.0d0)
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	return Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	return math.sqrt((F / B_m)) * -math.sqrt(2.0)
B_m = abs(B)
function code(A, B_m, C, F)
	return Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0)))
end
B_m = abs(B);
function tmp = code(A, B_m, C, F)
	tmp = sqrt((F / B_m)) * -sqrt(2.0);
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|

\\
\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)
\end{array}
Derivation
  1. Initial program 21.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. Add Preprocessing
  3. Taylor expanded in A around 0 9.8%

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
  4. Step-by-step derivation
    1. mul-1-neg9.8%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
  5. Simplified9.8%

    \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
  6. Taylor expanded in C around 0 18.0%

    \[\leadsto -\color{blue}{\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  7. Final simplification18.0%

    \[\leadsto \sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right) \]
  8. Add Preprocessing

Reproduce

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