ABCF->ab-angle b

Percentage Accurate: 18.7% → 45.7%
Time: 14.2s
Alternatives: 12
Speedup: N/A×

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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b, c, f)
use fmin_fmax_functions
    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 12 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.7% 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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b, c, f)
use fmin_fmax_functions
    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: 45.7% accurate, N/A× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 3.6 \cdot 10^{-13}:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + -0.5 \cdot \frac{B\_m \cdot B\_m}{C}\right) + A\right)}}{-1 \cdot {B\_m}^{2} - \left(\left(-1 \cdot 4\right) \cdot A\right) \cdot C}\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 3.6e-13)
   (/
    (sqrt
     (*
      (* 2.0 (* (- (pow B_m 2.0) (* (* 4.0 A) C)) F))
      (+ (+ A (* -0.5 (/ (* B_m B_m) C))) A)))
    (- (* -1.0 (pow B_m 2.0)) (* (* (* -1.0 4.0) A) C)))
   (* (* -1.0 (/ (pow 2.0 0.5) B_m)) (pow (* F (- A (hypot A B_m))) 0.5))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 3.6e-13) {
		tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - ((4.0 * A) * C)) * F)) * ((A + (-0.5 * ((B_m * B_m) / C))) + A))) / ((-1.0 * pow(B_m, 2.0)) - (((-1.0 * 4.0) * A) * C));
	} else {
		tmp = (-1.0 * (pow(2.0, 0.5) / B_m)) * pow((F * (A - hypot(A, B_m))), 0.5);
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 3.6e-13) {
		tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - ((4.0 * A) * C)) * F)) * ((A + (-0.5 * ((B_m * B_m) / C))) + A))) / ((-1.0 * Math.pow(B_m, 2.0)) - (((-1.0 * 4.0) * A) * C));
	} else {
		tmp = (-1.0 * (Math.pow(2.0, 0.5) / B_m)) * Math.pow((F * (A - Math.hypot(A, B_m))), 0.5);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if B_m <= 3.6e-13:
		tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - ((4.0 * A) * C)) * F)) * ((A + (-0.5 * ((B_m * B_m) / C))) + A))) / ((-1.0 * math.pow(B_m, 2.0)) - (((-1.0 * 4.0) * A) * C))
	else:
		tmp = (-1.0 * (math.pow(2.0, 0.5) / B_m)) * math.pow((F * (A - math.hypot(A, B_m))), 0.5)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 3.6e-13)
		tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) * F)) * Float64(Float64(A + Float64(-0.5 * Float64(Float64(B_m * B_m) / C))) + A))) / Float64(Float64(-1.0 * (B_m ^ 2.0)) - Float64(Float64(Float64(-1.0 * 4.0) * A) * C)));
	else
		tmp = Float64(Float64(-1.0 * Float64((2.0 ^ 0.5) / B_m)) * (Float64(F * Float64(A - hypot(A, B_m))) ^ 0.5));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (B_m <= 3.6e-13)
		tmp = sqrt(((2.0 * (((B_m ^ 2.0) - ((4.0 * A) * C)) * F)) * ((A + (-0.5 * ((B_m * B_m) / C))) + A))) / ((-1.0 * (B_m ^ 2.0)) - (((-1.0 * 4.0) * A) * C));
	else
		tmp = (-1.0 * ((2.0 ^ 0.5) / B_m)) * ((F * (A - hypot(A, B_m))) ^ 0.5);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 3.6e-13], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + N[(-0.5 * N[(N[(B$95$m * B$95$m), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(-1.0 * N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(-1.0 * 4.0), $MachinePrecision] * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * N[(N[Power[2.0, 0.5], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 3.6 \cdot 10^{-13}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + -0.5 \cdot \frac{B\_m \cdot B\_m}{C}\right) + A\right)}}{-1 \cdot {B\_m}^{2} - \left(\left(-1 \cdot 4\right) \cdot A\right) \cdot C}\\

\mathbf{else}:\\
\;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 3.5999999999999998e-13

    1. Initial program 17.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 inf

      \[\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(\left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1 \cdot A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-+.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1} \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-/.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. unpow2N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. lower-*.f6419.5

        \[\leadsto \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 + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot \color{blue}{A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Applied rewrites19.5%

      \[\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(\left(A + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]

    if 3.5999999999999998e-13 < B

    1. Initial program 9.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 C around inf

      \[\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(\left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1 \cdot A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-+.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1} \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-/.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. unpow2N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. lower-*.f647.3

        \[\leadsto \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 + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot \color{blue}{A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Applied rewrites7.3%

      \[\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(\left(A + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Taylor expanded in C around 0

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

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\frac{-1}{2} \cdot {B}^{2} + C \cdot \left(A - -1 \cdot A\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lift-pow.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lift--.f647.3

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification24.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 3.6 \cdot 10^{-13}:\\ \;\;\;\;\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 + -0.5 \cdot \frac{B \cdot B}{C}\right) + A\right)}}{-1 \cdot {B}^{2} - \left(\left(-1 \cdot 4\right) \cdot A\right) \cdot C}\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 45.7% accurate, N/A× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 3.6 \cdot 10^{-13}:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(-0.5, {B\_m}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{-1 \cdot {B\_m}^{2} - \left(\left(-1 \cdot 4\right) \cdot A\right) \cdot C}\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 3.6e-13)
   (/
    (sqrt
     (*
      (* 2.0 (* (- (pow B_m 2.0) (* (* 4.0 A) C)) F))
      (/ (fma -0.5 (pow B_m 2.0) (* C (- A (* -1.0 A)))) C)))
    (- (* -1.0 (pow B_m 2.0)) (* (* (* -1.0 4.0) A) C)))
   (* (* -1.0 (/ (pow 2.0 0.5) B_m)) (pow (* F (- A (hypot A B_m))) 0.5))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 3.6e-13) {
		tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - ((4.0 * A) * C)) * F)) * (fma(-0.5, pow(B_m, 2.0), (C * (A - (-1.0 * A)))) / C))) / ((-1.0 * pow(B_m, 2.0)) - (((-1.0 * 4.0) * A) * C));
	} else {
		tmp = (-1.0 * (pow(2.0, 0.5) / B_m)) * pow((F * (A - hypot(A, B_m))), 0.5);
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 3.6e-13)
		tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) * F)) * Float64(fma(-0.5, (B_m ^ 2.0), Float64(C * Float64(A - Float64(-1.0 * A)))) / C))) / Float64(Float64(-1.0 * (B_m ^ 2.0)) - Float64(Float64(Float64(-1.0 * 4.0) * A) * C)));
	else
		tmp = Float64(Float64(-1.0 * Float64((2.0 ^ 0.5) / B_m)) * (Float64(F * Float64(A - hypot(A, B_m))) ^ 0.5));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 3.6e-13], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.5 * N[Power[B$95$m, 2.0], $MachinePrecision] + N[(C * N[(A - N[(-1.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(-1.0 * N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(-1.0 * 4.0), $MachinePrecision] * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * N[(N[Power[2.0, 0.5], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 3.6 \cdot 10^{-13}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(-0.5, {B\_m}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{-1 \cdot {B\_m}^{2} - \left(\left(-1 \cdot 4\right) \cdot A\right) \cdot C}\\

\mathbf{else}:\\
\;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 3.5999999999999998e-13

    1. Initial program 17.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 inf

      \[\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(\left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1 \cdot A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-+.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1} \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-/.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. unpow2N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. lower-*.f6419.5

        \[\leadsto \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 + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot \color{blue}{A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Applied rewrites19.5%

      \[\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(\left(A + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Taylor expanded in C around 0

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

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\frac{-1}{2} \cdot {B}^{2} + C \cdot \left(A - -1 \cdot A\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lift-pow.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lift--.f6419.5

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(-0.5, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    8. Applied rewrites19.5%

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

    if 3.5999999999999998e-13 < B

    1. Initial program 9.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 C around inf

      \[\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(\left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1 \cdot A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-+.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1} \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-/.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. unpow2N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. lower-*.f647.3

        \[\leadsto \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 + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot \color{blue}{A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Applied rewrites7.3%

      \[\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(\left(A + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Taylor expanded in C around 0

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

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\frac{-1}{2} \cdot {B}^{2} + C \cdot \left(A - -1 \cdot A\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lift-pow.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lift--.f647.3

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification24.3%

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

Alternative 3: 44.0% accurate, N/A× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 3.4 \cdot 10^{-13}:\\ \;\;\;\;\frac{\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}{-1 \cdot {B\_m}^{2} - \left(\left(-1 \cdot 4\right) \cdot A\right) \cdot C}\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 3.4e-13)
   (/
    (sqrt (* -8.0 (* A (* C (* F (- A (* -1.0 A)))))))
    (- (* -1.0 (pow B_m 2.0)) (* (* (* -1.0 4.0) A) C)))
   (* (* -1.0 (/ (pow 2.0 0.5) B_m)) (pow (* F (- A (hypot A B_m))) 0.5))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 3.4e-13) {
		tmp = sqrt((-8.0 * (A * (C * (F * (A - (-1.0 * A))))))) / ((-1.0 * pow(B_m, 2.0)) - (((-1.0 * 4.0) * A) * C));
	} else {
		tmp = (-1.0 * (pow(2.0, 0.5) / B_m)) * pow((F * (A - hypot(A, B_m))), 0.5);
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 3.4e-13) {
		tmp = Math.sqrt((-8.0 * (A * (C * (F * (A - (-1.0 * A))))))) / ((-1.0 * Math.pow(B_m, 2.0)) - (((-1.0 * 4.0) * A) * C));
	} else {
		tmp = (-1.0 * (Math.pow(2.0, 0.5) / B_m)) * Math.pow((F * (A - Math.hypot(A, B_m))), 0.5);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if B_m <= 3.4e-13:
		tmp = math.sqrt((-8.0 * (A * (C * (F * (A - (-1.0 * A))))))) / ((-1.0 * math.pow(B_m, 2.0)) - (((-1.0 * 4.0) * A) * C))
	else:
		tmp = (-1.0 * (math.pow(2.0, 0.5) / B_m)) * math.pow((F * (A - math.hypot(A, B_m))), 0.5)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 3.4e-13)
		tmp = Float64(sqrt(Float64(-8.0 * Float64(A * Float64(C * Float64(F * Float64(A - Float64(-1.0 * A))))))) / Float64(Float64(-1.0 * (B_m ^ 2.0)) - Float64(Float64(Float64(-1.0 * 4.0) * A) * C)));
	else
		tmp = Float64(Float64(-1.0 * Float64((2.0 ^ 0.5) / B_m)) * (Float64(F * Float64(A - hypot(A, B_m))) ^ 0.5));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (B_m <= 3.4e-13)
		tmp = sqrt((-8.0 * (A * (C * (F * (A - (-1.0 * A))))))) / ((-1.0 * (B_m ^ 2.0)) - (((-1.0 * 4.0) * A) * C));
	else
		tmp = (-1.0 * ((2.0 ^ 0.5) / B_m)) * ((F * (A - hypot(A, B_m))) ^ 0.5);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 3.4e-13], N[(N[Sqrt[N[(-8.0 * N[(A * N[(C * N[(F * N[(A - N[(-1.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(-1.0 * N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(-1.0 * 4.0), $MachinePrecision] * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * N[(N[Power[2.0, 0.5], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 3.4 \cdot 10^{-13}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}{-1 \cdot {B\_m}^{2} - \left(\left(-1 \cdot 4\right) \cdot A\right) \cdot C}\\

\mathbf{else}:\\
\;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 3.40000000000000015e-13

    1. Initial program 17.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 inf

      \[\leadsto \frac{-\sqrt{\color{blue}{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{-8 \cdot \color{blue}{\left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \color{blue}{\left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \color{blue}{\left(F \cdot \left(A - -1 \cdot A\right)\right)}\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. lower--.f64N/A

        \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - \color{blue}{-1 \cdot A}\right)\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lower-*.f6417.8

        \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot \color{blue}{A}\right)\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Applied rewrites17.8%

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

    if 3.40000000000000015e-13 < B

    1. Initial program 9.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 C around inf

      \[\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(\left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1 \cdot A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-+.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1} \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-/.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. unpow2N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. lower-*.f647.3

        \[\leadsto \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 + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot \color{blue}{A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Applied rewrites7.3%

      \[\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(\left(A + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Taylor expanded in C around 0

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

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\frac{-1}{2} \cdot {B}^{2} + C \cdot \left(A - -1 \cdot A\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lift-pow.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lift--.f647.3

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification23.0%

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

Alternative 4: 41.7% accurate, N/A× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 1.4 \cdot 10^{-247}:\\ \;\;\;\;{\left(-0.5 \cdot \frac{F}{C}\right)}^{0.5} \cdot {2}^{0.5}\\ \mathbf{elif}\;B\_m \leq 3 \cdot 10^{-15}:\\ \;\;\;\;\frac{\sqrt{\left(--8\right) \cdot \left(\left(-1 \cdot A\right) \cdot \left(2 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{-1 \cdot {B\_m}^{2} - \left(\left(-1 \cdot 4\right) \cdot A\right) \cdot C}\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 1.4e-247)
   (* (pow (* -0.5 (/ F C)) 0.5) (pow 2.0 0.5))
   (if (<= B_m 3e-15)
     (/
      (sqrt (* (- -8.0) (* (* -1.0 A) (* 2.0 (* A (* C F))))))
      (- (* -1.0 (pow B_m 2.0)) (* (* (* -1.0 4.0) A) C)))
     (* (* -1.0 (/ (pow 2.0 0.5) B_m)) (pow (* F (- A (hypot A B_m))) 0.5)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.4e-247) {
		tmp = pow((-0.5 * (F / C)), 0.5) * pow(2.0, 0.5);
	} else if (B_m <= 3e-15) {
		tmp = sqrt((-(-8.0) * ((-1.0 * A) * (2.0 * (A * (C * F)))))) / ((-1.0 * pow(B_m, 2.0)) - (((-1.0 * 4.0) * A) * C));
	} else {
		tmp = (-1.0 * (pow(2.0, 0.5) / B_m)) * pow((F * (A - hypot(A, B_m))), 0.5);
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.4e-247) {
		tmp = Math.pow((-0.5 * (F / C)), 0.5) * Math.pow(2.0, 0.5);
	} else if (B_m <= 3e-15) {
		tmp = Math.sqrt((-(-8.0) * ((-1.0 * A) * (2.0 * (A * (C * F)))))) / ((-1.0 * Math.pow(B_m, 2.0)) - (((-1.0 * 4.0) * A) * C));
	} else {
		tmp = (-1.0 * (Math.pow(2.0, 0.5) / B_m)) * Math.pow((F * (A - Math.hypot(A, B_m))), 0.5);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if B_m <= 1.4e-247:
		tmp = math.pow((-0.5 * (F / C)), 0.5) * math.pow(2.0, 0.5)
	elif B_m <= 3e-15:
		tmp = math.sqrt((-(-8.0) * ((-1.0 * A) * (2.0 * (A * (C * F)))))) / ((-1.0 * math.pow(B_m, 2.0)) - (((-1.0 * 4.0) * A) * C))
	else:
		tmp = (-1.0 * (math.pow(2.0, 0.5) / B_m)) * math.pow((F * (A - math.hypot(A, B_m))), 0.5)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 1.4e-247)
		tmp = Float64((Float64(-0.5 * Float64(F / C)) ^ 0.5) * (2.0 ^ 0.5));
	elseif (B_m <= 3e-15)
		tmp = Float64(sqrt(Float64(Float64(-(-8.0)) * Float64(Float64(-1.0 * A) * Float64(2.0 * Float64(A * Float64(C * F)))))) / Float64(Float64(-1.0 * (B_m ^ 2.0)) - Float64(Float64(Float64(-1.0 * 4.0) * A) * C)));
	else
		tmp = Float64(Float64(-1.0 * Float64((2.0 ^ 0.5) / B_m)) * (Float64(F * Float64(A - hypot(A, B_m))) ^ 0.5));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (B_m <= 1.4e-247)
		tmp = ((-0.5 * (F / C)) ^ 0.5) * (2.0 ^ 0.5);
	elseif (B_m <= 3e-15)
		tmp = sqrt((-(-8.0) * ((-1.0 * A) * (2.0 * (A * (C * F)))))) / ((-1.0 * (B_m ^ 2.0)) - (((-1.0 * 4.0) * A) * C));
	else
		tmp = (-1.0 * ((2.0 ^ 0.5) / B_m)) * ((F * (A - hypot(A, B_m))) ^ 0.5);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.4e-247], N[(N[Power[N[(-0.5 * N[(F / C), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 3e-15], N[(N[Sqrt[N[((--8.0) * N[(N[(-1.0 * A), $MachinePrecision] * N[(2.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(-1.0 * N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(-1.0 * 4.0), $MachinePrecision] * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * N[(N[Power[2.0, 0.5], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.4 \cdot 10^{-247}:\\
\;\;\;\;{\left(-0.5 \cdot \frac{F}{C}\right)}^{0.5} \cdot {2}^{0.5}\\

\mathbf{elif}\;B\_m \leq 3 \cdot 10^{-15}:\\
\;\;\;\;\frac{\sqrt{\left(--8\right) \cdot \left(\left(-1 \cdot A\right) \cdot \left(2 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{-1 \cdot {B\_m}^{2} - \left(\left(-1 \cdot 4\right) \cdot A\right) \cdot C}\\

\mathbf{else}:\\
\;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if B < 1.39999999999999993e-247

    1. Initial program 14.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 F around -inf

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

        \[\leadsto \sqrt{\frac{F \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{-2 \cdot -1} \]
      2. metadata-evalN/A

        \[\leadsto \sqrt{\frac{F \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2} \]
      3. lower-*.f64N/A

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

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

      \[\leadsto {\left(\frac{-1}{2} \cdot \frac{F}{C}\right)}^{\frac{1}{2}} \cdot {2}^{\frac{1}{2}} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {\left(\frac{-1}{2} \cdot \frac{F}{C}\right)}^{\frac{1}{2}} \cdot {2}^{\frac{1}{2}} \]
      2. lower-/.f6413.0

        \[\leadsto {\left(-0.5 \cdot \frac{F}{C}\right)}^{0.5} \cdot {2}^{0.5} \]
    8. Applied rewrites13.0%

      \[\leadsto {\left(-0.5 \cdot \frac{F}{C}\right)}^{0.5} \cdot {2}^{0.5} \]

    if 1.39999999999999993e-247 < B < 3e-15

    1. Initial program 27.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 C around inf

      \[\leadsto \frac{-\sqrt{\color{blue}{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{-8 \cdot \color{blue}{\left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \color{blue}{\left(C \cdot \left(F \cdot \left(A - -1 \cdot A\right)\right)\right)}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \color{blue}{\left(F \cdot \left(A - -1 \cdot A\right)\right)}\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. lower--.f64N/A

        \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - \color{blue}{-1 \cdot A}\right)\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lower-*.f6436.0

        \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A - -1 \cdot \color{blue}{A}\right)\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Applied rewrites36.0%

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

      \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(2 \cdot \color{blue}{\left(A \cdot \left(C \cdot F\right)\right)}\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(2 \cdot \left(A \cdot \color{blue}{\left(C \cdot F\right)}\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(2 \cdot \left(A \cdot \left(C \cdot \color{blue}{F}\right)\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lower-*.f6428.6

        \[\leadsto \frac{-\sqrt{-8 \cdot \left(A \cdot \left(2 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    8. Applied rewrites28.6%

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

    if 3e-15 < B

    1. Initial program 9.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 C around inf

      \[\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(\left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1 \cdot A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-+.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1} \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-/.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. unpow2N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. lower-*.f647.3

        \[\leadsto \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 + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot \color{blue}{A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Applied rewrites7.3%

      \[\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(\left(A + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Taylor expanded in C around 0

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

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\frac{-1}{2} \cdot {B}^{2} + C \cdot \left(A - -1 \cdot A\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lift-pow.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lift--.f647.3

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification21.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.4 \cdot 10^{-247}:\\ \;\;\;\;{\left(-0.5 \cdot \frac{F}{C}\right)}^{0.5} \cdot {2}^{0.5}\\ \mathbf{elif}\;B \leq 3 \cdot 10^{-15}:\\ \;\;\;\;\frac{\sqrt{\left(--8\right) \cdot \left(\left(-1 \cdot A\right) \cdot \left(2 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{-1 \cdot {B}^{2} - \left(\left(-1 \cdot 4\right) \cdot A\right) \cdot C}\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 41.0% accurate, N/A× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;{B\_m}^{2} \leq 10^{-275}:\\ \;\;\;\;{\left(-0.5 \cdot \frac{F}{C}\right)}^{0.5} \cdot {2}^{0.5}\\ \mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-30}:\\ \;\;\;\;\frac{\sqrt{-16 \cdot \left(\left(\left(-1 \cdot A\right) \cdot A\right) \cdot \left(\left(-1 \cdot C\right) \cdot F\right)\right)}}{-1 \cdot {B\_m}^{2} - \left(\left(-1 \cdot 4\right) \cdot A\right) \cdot C}\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= (pow B_m 2.0) 1e-275)
   (* (pow (* -0.5 (/ F C)) 0.5) (pow 2.0 0.5))
   (if (<= (pow B_m 2.0) 2e-30)
     (/
      (sqrt (* -16.0 (* (* (* -1.0 A) A) (* (* -1.0 C) F))))
      (- (* -1.0 (pow B_m 2.0)) (* (* (* -1.0 4.0) A) C)))
     (* (* -1.0 (/ (pow 2.0 0.5) B_m)) (pow (* F (- A (hypot A B_m))) 0.5)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (pow(B_m, 2.0) <= 1e-275) {
		tmp = pow((-0.5 * (F / C)), 0.5) * pow(2.0, 0.5);
	} else if (pow(B_m, 2.0) <= 2e-30) {
		tmp = sqrt((-16.0 * (((-1.0 * A) * A) * ((-1.0 * C) * F)))) / ((-1.0 * pow(B_m, 2.0)) - (((-1.0 * 4.0) * A) * C));
	} else {
		tmp = (-1.0 * (pow(2.0, 0.5) / B_m)) * pow((F * (A - hypot(A, B_m))), 0.5);
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (Math.pow(B_m, 2.0) <= 1e-275) {
		tmp = Math.pow((-0.5 * (F / C)), 0.5) * Math.pow(2.0, 0.5);
	} else if (Math.pow(B_m, 2.0) <= 2e-30) {
		tmp = Math.sqrt((-16.0 * (((-1.0 * A) * A) * ((-1.0 * C) * F)))) / ((-1.0 * Math.pow(B_m, 2.0)) - (((-1.0 * 4.0) * A) * C));
	} else {
		tmp = (-1.0 * (Math.pow(2.0, 0.5) / B_m)) * Math.pow((F * (A - Math.hypot(A, B_m))), 0.5);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if math.pow(B_m, 2.0) <= 1e-275:
		tmp = math.pow((-0.5 * (F / C)), 0.5) * math.pow(2.0, 0.5)
	elif math.pow(B_m, 2.0) <= 2e-30:
		tmp = math.sqrt((-16.0 * (((-1.0 * A) * A) * ((-1.0 * C) * F)))) / ((-1.0 * math.pow(B_m, 2.0)) - (((-1.0 * 4.0) * A) * C))
	else:
		tmp = (-1.0 * (math.pow(2.0, 0.5) / B_m)) * math.pow((F * (A - math.hypot(A, B_m))), 0.5)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if ((B_m ^ 2.0) <= 1e-275)
		tmp = Float64((Float64(-0.5 * Float64(F / C)) ^ 0.5) * (2.0 ^ 0.5));
	elseif ((B_m ^ 2.0) <= 2e-30)
		tmp = Float64(sqrt(Float64(-16.0 * Float64(Float64(Float64(-1.0 * A) * A) * Float64(Float64(-1.0 * C) * F)))) / Float64(Float64(-1.0 * (B_m ^ 2.0)) - Float64(Float64(Float64(-1.0 * 4.0) * A) * C)));
	else
		tmp = Float64(Float64(-1.0 * Float64((2.0 ^ 0.5) / B_m)) * (Float64(F * Float64(A - hypot(A, B_m))) ^ 0.5));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if ((B_m ^ 2.0) <= 1e-275)
		tmp = ((-0.5 * (F / C)) ^ 0.5) * (2.0 ^ 0.5);
	elseif ((B_m ^ 2.0) <= 2e-30)
		tmp = sqrt((-16.0 * (((-1.0 * A) * A) * ((-1.0 * C) * F)))) / ((-1.0 * (B_m ^ 2.0)) - (((-1.0 * 4.0) * A) * C));
	else
		tmp = (-1.0 * ((2.0 ^ 0.5) / B_m)) * ((F * (A - hypot(A, B_m))) ^ 0.5);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-275], N[(N[Power[N[(-0.5 * N[(F / C), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-30], N[(N[Sqrt[N[(-16.0 * N[(N[(N[(-1.0 * A), $MachinePrecision] * A), $MachinePrecision] * N[(N[(-1.0 * C), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(-1.0 * N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(-1.0 * 4.0), $MachinePrecision] * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * N[(N[Power[2.0, 0.5], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 10^{-275}:\\
\;\;\;\;{\left(-0.5 \cdot \frac{F}{C}\right)}^{0.5} \cdot {2}^{0.5}\\

\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-30}:\\
\;\;\;\;\frac{\sqrt{-16 \cdot \left(\left(\left(-1 \cdot A\right) \cdot A\right) \cdot \left(\left(-1 \cdot C\right) \cdot F\right)\right)}}{-1 \cdot {B\_m}^{2} - \left(\left(-1 \cdot 4\right) \cdot A\right) \cdot C}\\

\mathbf{else}:\\
\;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (pow.f64 B #s(literal 2 binary64)) < 9.99999999999999934e-276

    1. Initial program 13.1%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf

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

        \[\leadsto \sqrt{\frac{F \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{-2 \cdot -1} \]
      2. metadata-evalN/A

        \[\leadsto \sqrt{\frac{F \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2} \]
      3. lower-*.f64N/A

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

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

      \[\leadsto {\left(\frac{-1}{2} \cdot \frac{F}{C}\right)}^{\frac{1}{2}} \cdot {2}^{\frac{1}{2}} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {\left(\frac{-1}{2} \cdot \frac{F}{C}\right)}^{\frac{1}{2}} \cdot {2}^{\frac{1}{2}} \]
      2. lower-/.f6418.0

        \[\leadsto {\left(-0.5 \cdot \frac{F}{C}\right)}^{0.5} \cdot {2}^{0.5} \]
    8. Applied rewrites18.0%

      \[\leadsto {\left(-0.5 \cdot \frac{F}{C}\right)}^{0.5} \cdot {2}^{0.5} \]

    if 9.99999999999999934e-276 < (pow.f64 B #s(literal 2 binary64)) < 2e-30

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

      \[\leadsto \frac{-\sqrt{\color{blue}{-16 \cdot \left({A}^{2} \cdot \left(C \cdot F\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

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

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

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

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

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

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

    if 2e-30 < (pow.f64 B #s(literal 2 binary64))

    1. Initial program 13.1%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in C around inf

      \[\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(\left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1 \cdot A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-+.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1} \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-/.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. unpow2N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. lower-*.f647.1

        \[\leadsto \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 + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot \color{blue}{A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Applied rewrites7.1%

      \[\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(\left(A + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Taylor expanded in C around 0

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

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\frac{-1}{2} \cdot {B}^{2} + C \cdot \left(A - -1 \cdot A\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lift-pow.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lift--.f647.1

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification21.2%

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

Alternative 6: 40.3% accurate, N/A× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-74}:\\ \;\;\;\;{\left(-0.5 \cdot \frac{F}{C}\right)}^{0.5} \cdot {2}^{0.5}\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= (pow B_m 2.0) 5e-74)
   (* (pow (* -0.5 (/ F C)) 0.5) (pow 2.0 0.5))
   (* (* -1.0 (/ (pow 2.0 0.5) B_m)) (pow (* F (- A (hypot A B_m))) 0.5))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (pow(B_m, 2.0) <= 5e-74) {
		tmp = pow((-0.5 * (F / C)), 0.5) * pow(2.0, 0.5);
	} else {
		tmp = (-1.0 * (pow(2.0, 0.5) / B_m)) * pow((F * (A - hypot(A, B_m))), 0.5);
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (Math.pow(B_m, 2.0) <= 5e-74) {
		tmp = Math.pow((-0.5 * (F / C)), 0.5) * Math.pow(2.0, 0.5);
	} else {
		tmp = (-1.0 * (Math.pow(2.0, 0.5) / B_m)) * Math.pow((F * (A - Math.hypot(A, B_m))), 0.5);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if math.pow(B_m, 2.0) <= 5e-74:
		tmp = math.pow((-0.5 * (F / C)), 0.5) * math.pow(2.0, 0.5)
	else:
		tmp = (-1.0 * (math.pow(2.0, 0.5) / B_m)) * math.pow((F * (A - math.hypot(A, B_m))), 0.5)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if ((B_m ^ 2.0) <= 5e-74)
		tmp = Float64((Float64(-0.5 * Float64(F / C)) ^ 0.5) * (2.0 ^ 0.5));
	else
		tmp = Float64(Float64(-1.0 * Float64((2.0 ^ 0.5) / B_m)) * (Float64(F * Float64(A - hypot(A, B_m))) ^ 0.5));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if ((B_m ^ 2.0) <= 5e-74)
		tmp = ((-0.5 * (F / C)) ^ 0.5) * (2.0 ^ 0.5);
	else
		tmp = (-1.0 * ((2.0 ^ 0.5) / B_m)) * ((F * (A - hypot(A, B_m))) ^ 0.5);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-74], N[(N[Power[N[(-0.5 * N[(F / C), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * N[(N[Power[2.0, 0.5], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-74}:\\
\;\;\;\;{\left(-0.5 \cdot \frac{F}{C}\right)}^{0.5} \cdot {2}^{0.5}\\

\mathbf{else}:\\
\;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (pow.f64 B #s(literal 2 binary64)) < 4.99999999999999998e-74

    1. Initial program 18.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 F around -inf

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

        \[\leadsto \sqrt{\frac{F \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{-2 \cdot -1} \]
      2. metadata-evalN/A

        \[\leadsto \sqrt{\frac{F \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2} \]
      3. lower-*.f64N/A

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

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

      \[\leadsto {\left(\frac{-1}{2} \cdot \frac{F}{C}\right)}^{\frac{1}{2}} \cdot {2}^{\frac{1}{2}} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {\left(\frac{-1}{2} \cdot \frac{F}{C}\right)}^{\frac{1}{2}} \cdot {2}^{\frac{1}{2}} \]
      2. lower-/.f6420.8

        \[\leadsto {\left(-0.5 \cdot \frac{F}{C}\right)}^{0.5} \cdot {2}^{0.5} \]
    8. Applied rewrites20.8%

      \[\leadsto {\left(-0.5 \cdot \frac{F}{C}\right)}^{0.5} \cdot {2}^{0.5} \]

    if 4.99999999999999998e-74 < (pow.f64 B #s(literal 2 binary64))

    1. Initial program 12.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 C around inf

      \[\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(\left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1 \cdot A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-+.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1} \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-/.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. unpow2N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. lower-*.f648.5

        \[\leadsto \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 + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot \color{blue}{A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Applied rewrites8.5%

      \[\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(\left(A + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Taylor expanded in C around 0

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

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\frac{-1}{2} \cdot {B}^{2} + C \cdot \left(A - -1 \cdot A\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lift-pow.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lift--.f648.5

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(-0.5, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    8. Applied rewrites8.5%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification20.4%

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

Alternative 7: 32.9% accurate, N/A× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 1.35 \cdot 10^{-16}:\\ \;\;\;\;{\left(\frac{F \cdot \left(\left(A + C\right) - {\left(\mathsf{fma}\left(B\_m, B\_m, {\left(A - C\right)}^{2}\right)\right)}^{0.5}\right)}{B\_m \cdot B\_m - 4 \cdot \left(A \cdot C\right)}\right)}^{0.5} \cdot \left(-1 \cdot {2}^{0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 1.35e-16)
   (*
    (pow
     (/
      (* F (- (+ A C) (pow (fma B_m B_m (pow (- A C) 2.0)) 0.5)))
      (- (* B_m B_m) (* 4.0 (* A C))))
     0.5)
    (* -1.0 (pow 2.0 0.5)))
   (* (* -1.0 (/ (pow 2.0 0.5) B_m)) (pow (* F (- A (hypot A B_m))) 0.5))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.35e-16) {
		tmp = pow(((F * ((A + C) - pow(fma(B_m, B_m, pow((A - C), 2.0)), 0.5))) / ((B_m * B_m) - (4.0 * (A * C)))), 0.5) * (-1.0 * pow(2.0, 0.5));
	} else {
		tmp = (-1.0 * (pow(2.0, 0.5) / B_m)) * pow((F * (A - hypot(A, B_m))), 0.5);
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 1.35e-16)
		tmp = Float64((Float64(Float64(F * Float64(Float64(A + C) - (fma(B_m, B_m, (Float64(A - C) ^ 2.0)) ^ 0.5))) / Float64(Float64(B_m * B_m) - Float64(4.0 * Float64(A * C)))) ^ 0.5) * Float64(-1.0 * (2.0 ^ 0.5)));
	else
		tmp = Float64(Float64(-1.0 * Float64((2.0 ^ 0.5) / B_m)) * (Float64(F * Float64(A - hypot(A, B_m))) ^ 0.5));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.35e-16], N[(N[Power[N[(N[(F * N[(N[(A + C), $MachinePrecision] - N[Power[N[(B$95$m * B$95$m + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(B$95$m * B$95$m), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] * N[(-1.0 * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * N[(N[Power[2.0, 0.5], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.35 \cdot 10^{-16}:\\
\;\;\;\;{\left(\frac{F \cdot \left(\left(A + C\right) - {\left(\mathsf{fma}\left(B\_m, B\_m, {\left(A - C\right)}^{2}\right)\right)}^{0.5}\right)}{B\_m \cdot B\_m - 4 \cdot \left(A \cdot C\right)}\right)}^{0.5} \cdot \left(-1 \cdot {2}^{0.5}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 1.35e-16

    1. Initial program 17.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 F around 0

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\left(\sqrt{\frac{F \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
      2. lower-*.f64N/A

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

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

    if 1.35e-16 < B

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

      \[\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(\left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1 \cdot A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-+.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1} \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-/.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. unpow2N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lower-*.f64N/A

        \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. lower-*.f647.2

        \[\leadsto \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 + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot \color{blue}{A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Applied rewrites7.2%

      \[\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(\left(A + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Taylor expanded in C around 0

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

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\frac{-1}{2} \cdot {B}^{2} + C \cdot \left(A - -1 \cdot A\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. lift-pow.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. lift--.f647.2

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification22.0%

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

Alternative 8: 30.8% accurate, N/A× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (* (* -1.0 (/ (pow 2.0 0.5) B_m)) (pow (* F (- A (hypot A B_m))) 0.5)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return (-1.0 * (pow(2.0, 0.5) / B_m)) * pow((F * (A - hypot(A, B_m))), 0.5);
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return (-1.0 * (Math.pow(2.0, 0.5) / B_m)) * Math.pow((F * (A - Math.hypot(A, B_m))), 0.5);
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return (-1.0 * (math.pow(2.0, 0.5) / B_m)) * math.pow((F * (A - math.hypot(A, B_m))), 0.5)
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(Float64(-1.0 * Float64((2.0 ^ 0.5) / B_m)) * (Float64(F * Float64(A - hypot(A, B_m))) ^ 0.5))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = (-1.0 * ((2.0 ^ 0.5) / B_m)) * ((F * (A - hypot(A, B_m))) ^ 0.5);
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(N[(-1.0 * N[(N[Power[2.0, 0.5], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\left(-1 \cdot \frac{{2}^{0.5}}{B\_m}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}
\end{array}
Derivation
  1. Initial program 15.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. Add Preprocessing
  3. Taylor expanded in C around inf

    \[\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(\left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  4. Step-by-step derivation
    1. lower--.f64N/A

      \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1 \cdot A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. lower-+.f64N/A

      \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1} \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. lower-*.f64N/A

      \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. lower-/.f64N/A

      \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. unpow2N/A

      \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. lower-*.f64N/A

      \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    7. lower-*.f6416.7

      \[\leadsto \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 + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot \color{blue}{A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  5. Applied rewrites16.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(\left(A + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  6. Taylor expanded in C around 0

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

      \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\frac{-1}{2} \cdot {B}^{2} + C \cdot \left(A - -1 \cdot A\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. lower-fma.f64N/A

      \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. lift-pow.f64N/A

      \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. lower-*.f64N/A

      \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. lift--.f6416.7

      \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(-0.5, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  8. Applied rewrites16.7%

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

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

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}\right)} \]
  11. Final simplification12.2%

    \[\leadsto \left(-1 \cdot \frac{{2}^{0.5}}{B}\right) \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5} \]
  12. Add Preprocessing

Alternative 9: 30.7% accurate, N/A× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \frac{e^{\log 2 \cdot 0.5}}{-1 \cdot B\_m} \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (*
  (/ (exp (* (log 2.0) 0.5)) (* -1.0 B_m))
  (pow (* F (- A (hypot A B_m))) 0.5)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return (exp((log(2.0) * 0.5)) / (-1.0 * B_m)) * pow((F * (A - hypot(A, B_m))), 0.5);
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return (Math.exp((Math.log(2.0) * 0.5)) / (-1.0 * B_m)) * Math.pow((F * (A - Math.hypot(A, B_m))), 0.5);
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return (math.exp((math.log(2.0) * 0.5)) / (-1.0 * B_m)) * math.pow((F * (A - math.hypot(A, B_m))), 0.5)
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(Float64(exp(Float64(log(2.0) * 0.5)) / Float64(-1.0 * B_m)) * (Float64(F * Float64(A - hypot(A, B_m))) ^ 0.5))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = (exp((log(2.0) * 0.5)) / (-1.0 * B_m)) * ((F * (A - hypot(A, B_m))) ^ 0.5);
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(N[(N[Exp[N[(N[Log[2.0], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] / N[(-1.0 * B$95$m), $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{e^{\log 2 \cdot 0.5}}{-1 \cdot B\_m} \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}^{0.5}
\end{array}
Derivation
  1. Initial program 15.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. Add Preprocessing
  3. Taylor expanded in C around inf

    \[\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(\left(A + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  4. Step-by-step derivation
    1. lower--.f64N/A

      \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1 \cdot A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. lower-+.f64N/A

      \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - \color{blue}{-1} \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. lower-*.f64N/A

      \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. lower-/.f64N/A

      \[\leadsto \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 + \frac{-1}{2} \cdot \frac{{B}^{2}}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. unpow2N/A

      \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. lower-*.f64N/A

      \[\leadsto \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 + \frac{-1}{2} \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    7. lower-*.f6416.7

      \[\leadsto \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 + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot \color{blue}{A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  5. Applied rewrites16.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(\left(A + -0.5 \cdot \frac{B \cdot B}{C}\right) - -1 \cdot A\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  6. Taylor expanded in C around 0

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

      \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\frac{-1}{2} \cdot {B}^{2} + C \cdot \left(A - -1 \cdot A\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. lower-fma.f64N/A

      \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. lift-pow.f64N/A

      \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. lower-*.f64N/A

      \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. lift--.f6416.7

      \[\leadsto \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \frac{\mathsf{fma}\left(-0.5, {B}^{2}, C \cdot \left(A - -1 \cdot A\right)\right)}{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  8. Applied rewrites16.7%

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

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

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}\right)} \]
  11. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot {\left(\color{blue}{F} \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{\frac{1}{2}}\right) \]
    2. pow-to-expN/A

      \[\leadsto -1 \cdot \left(\frac{e^{\log 2 \cdot \frac{1}{2}}}{B} \cdot {\left(\color{blue}{F} \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{\frac{1}{2}}\right) \]
    3. lower-exp.f64N/A

      \[\leadsto -1 \cdot \left(\frac{e^{\log 2 \cdot \frac{1}{2}}}{B} \cdot {\left(\color{blue}{F} \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{\frac{1}{2}}\right) \]
    4. lower-*.f64N/A

      \[\leadsto -1 \cdot \left(\frac{e^{\log 2 \cdot \frac{1}{2}}}{B} \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{\frac{1}{2}}\right) \]
    5. lower-log.f6412.2

      \[\leadsto -1 \cdot \left(\frac{e^{\log 2 \cdot 0.5}}{B} \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}\right) \]
  12. Applied rewrites12.2%

    \[\leadsto -1 \cdot \left(\frac{e^{\log 2 \cdot 0.5}}{B} \cdot {\left(\color{blue}{F} \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}\right) \]
  13. Final simplification12.2%

    \[\leadsto \frac{e^{\log 2 \cdot 0.5}}{-1 \cdot B} \cdot {\left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5} \]
  14. Add Preprocessing

Alternative 10: 26.5% accurate, N/A× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;A \leq -1.15 \cdot 10^{+146}:\\ \;\;\;\;-1 \cdot \left(\left(-1 \cdot {\left(A \cdot F\right)}^{0.5}\right) \cdot \frac{-2}{B\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\log 2 \cdot 0.5}}{-1 \cdot B\_m} \cdot {\left(F \cdot \left(-1 \cdot B\_m\right)\right)}^{0.5}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= A -1.15e+146)
   (* -1.0 (* (* -1.0 (pow (* A F) 0.5)) (/ -2.0 B_m)))
   (* (/ (exp (* (log 2.0) 0.5)) (* -1.0 B_m)) (pow (* F (* -1.0 B_m)) 0.5))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (A <= -1.15e+146) {
		tmp = -1.0 * ((-1.0 * pow((A * F), 0.5)) * (-2.0 / B_m));
	} else {
		tmp = (exp((log(2.0) * 0.5)) / (-1.0 * B_m)) * pow((F * (-1.0 * B_m)), 0.5);
	}
	return tmp;
}
B_m =     private
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b_m, c, f)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if (a <= (-1.15d+146)) then
        tmp = (-1.0d0) * (((-1.0d0) * ((a * f) ** 0.5d0)) * ((-2.0d0) / b_m))
    else
        tmp = (exp((log(2.0d0) * 0.5d0)) / ((-1.0d0) * b_m)) * ((f * ((-1.0d0) * b_m)) ** 0.5d0)
    end if
    code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (A <= -1.15e+146) {
		tmp = -1.0 * ((-1.0 * Math.pow((A * F), 0.5)) * (-2.0 / B_m));
	} else {
		tmp = (Math.exp((Math.log(2.0) * 0.5)) / (-1.0 * B_m)) * Math.pow((F * (-1.0 * B_m)), 0.5);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if A <= -1.15e+146:
		tmp = -1.0 * ((-1.0 * math.pow((A * F), 0.5)) * (-2.0 / B_m))
	else:
		tmp = (math.exp((math.log(2.0) * 0.5)) / (-1.0 * B_m)) * math.pow((F * (-1.0 * B_m)), 0.5)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (A <= -1.15e+146)
		tmp = Float64(-1.0 * Float64(Float64(-1.0 * (Float64(A * F) ^ 0.5)) * Float64(-2.0 / B_m)));
	else
		tmp = Float64(Float64(exp(Float64(log(2.0) * 0.5)) / Float64(-1.0 * B_m)) * (Float64(F * Float64(-1.0 * B_m)) ^ 0.5));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (A <= -1.15e+146)
		tmp = -1.0 * ((-1.0 * ((A * F) ^ 0.5)) * (-2.0 / B_m));
	else
		tmp = (exp((log(2.0) * 0.5)) / (-1.0 * B_m)) * ((F * (-1.0 * B_m)) ^ 0.5);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[A, -1.15e+146], N[(-1.0 * N[(N[(-1.0 * N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(-2.0 / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[(N[Log[2.0], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] / N[(-1.0 * B$95$m), $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * N[(-1.0 * B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq -1.15 \cdot 10^{+146}:\\
\;\;\;\;-1 \cdot \left(\left(-1 \cdot {\left(A \cdot F\right)}^{0.5}\right) \cdot \frac{-2}{B\_m}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{e^{\log 2 \cdot 0.5}}{-1 \cdot B\_m} \cdot {\left(F \cdot \left(-1 \cdot B\_m\right)\right)}^{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if A < -1.15e146

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

      \[\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. lower-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
      2. lower-*.f64N/A

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

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

        \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot \sqrt{\color{blue}{F} \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right) \]
      5. lower-pow.f64N/A

        \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot \sqrt{\color{blue}{F} \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right) \]
      6. pow1/2N/A

        \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot {\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)}^{\color{blue}{\frac{1}{2}}}\right) \]
      7. lower-pow.f64N/A

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(A - {\left(\mathsf{fma}\left(A, A, B \cdot B\right)\right)}^{0.5}\right)\right)}^{0.5}\right)} \]
    6. Taylor expanded in A around 0

      \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{\frac{1}{2}}\right) \]
    7. Step-by-step derivation
      1. lower-*.f644.1

        \[\leadsto -1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{0.5}\right) \]
    8. Applied rewrites4.1%

      \[\leadsto -1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{0.5}\right) \]
    9. Taylor expanded in A around -inf

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{A \cdot F} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)}\right) \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(\sqrt{A \cdot F} \cdot \color{blue}{\frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}}\right)\right) \]
      2. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(\sqrt{A \cdot F} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{\color{blue}{B}}\right)\right) \]
      3. pow1/2N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right) \]
      4. lower-pow.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right) \]
      6. sqrt-pow2N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{{-1}^{\left(\frac{2}{2}\right)} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{{-1}^{1} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{-1 \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right) \]
      9. sqrt-pow2N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{-1 \cdot {2}^{\left(\frac{2}{2}\right)}}{B}\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{-1 \cdot {2}^{1}}{B}\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{-1 \cdot 2}{B}\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{-2}{B}\right)\right) \]
      13. lower-/.f6412.2

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{0.5} \cdot \frac{-2}{B}\right)\right) \]
    11. Applied rewrites12.2%

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

    if -1.15e146 < A

    1. Initial program 17.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 C around 0

      \[\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. lower-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
      2. lower-*.f64N/A

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

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

        \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot \sqrt{\color{blue}{F} \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right) \]
      5. lower-pow.f64N/A

        \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot \sqrt{\color{blue}{F} \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right) \]
      6. pow1/2N/A

        \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot {\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)}^{\color{blue}{\frac{1}{2}}}\right) \]
      7. lower-pow.f64N/A

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(A - {\left(\mathsf{fma}\left(A, A, B \cdot B\right)\right)}^{0.5}\right)\right)}^{0.5}\right)} \]
    6. Taylor expanded in A around 0

      \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{\frac{1}{2}}\right) \]
    7. Step-by-step derivation
      1. lower-*.f6411.0

        \[\leadsto -1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{0.5}\right) \]
    8. Applied rewrites11.0%

      \[\leadsto -1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{0.5}\right) \]
    9. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot {\left(\color{blue}{F} \cdot \left(-1 \cdot B\right)\right)}^{\frac{1}{2}}\right) \]
      2. pow-to-expN/A

        \[\leadsto -1 \cdot \left(\frac{e^{\log 2 \cdot \frac{1}{2}}}{B} \cdot {\left(\color{blue}{F} \cdot \left(-1 \cdot B\right)\right)}^{\frac{1}{2}}\right) \]
      3. lower-exp.f64N/A

        \[\leadsto -1 \cdot \left(\frac{e^{\log 2 \cdot \frac{1}{2}}}{B} \cdot {\left(\color{blue}{F} \cdot \left(-1 \cdot B\right)\right)}^{\frac{1}{2}}\right) \]
      4. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(\frac{e^{\log 2 \cdot \frac{1}{2}}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{\frac{1}{2}}\right) \]
      5. lower-log.f6411.0

        \[\leadsto -1 \cdot \left(\frac{e^{\log 2 \cdot 0.5}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{0.5}\right) \]
    10. Applied rewrites11.0%

      \[\leadsto -1 \cdot \left(\frac{e^{\log 2 \cdot 0.5}}{B} \cdot {\left(\color{blue}{F} \cdot \left(-1 \cdot B\right)\right)}^{0.5}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification11.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -1.15 \cdot 10^{+146}:\\ \;\;\;\;-1 \cdot \left(\left(-1 \cdot {\left(A \cdot F\right)}^{0.5}\right) \cdot \frac{-2}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\log 2 \cdot 0.5}}{-1 \cdot B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 10.8% accurate, N/A× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;F \leq -3.2 \cdot 10^{+68}:\\ \;\;\;\;-1 \cdot \left(\left(-1 \cdot A\right) \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{0.5} \cdot \frac{-1}{B\_m}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left(\left(-1 \cdot {\left(A \cdot F\right)}^{0.5}\right) \cdot \frac{-2}{B\_m}\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= F -3.2e+68)
   (* -1.0 (* (* -1.0 A) (* -2.0 (* (pow (/ F A) 0.5) (/ -1.0 B_m)))))
   (* -1.0 (* (* -1.0 (pow (* A F) 0.5)) (/ -2.0 B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (F <= -3.2e+68) {
		tmp = -1.0 * ((-1.0 * A) * (-2.0 * (pow((F / A), 0.5) * (-1.0 / B_m))));
	} else {
		tmp = -1.0 * ((-1.0 * pow((A * F), 0.5)) * (-2.0 / B_m));
	}
	return tmp;
}
B_m =     private
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b_m, c, f)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if (f <= (-3.2d+68)) then
        tmp = (-1.0d0) * (((-1.0d0) * a) * ((-2.0d0) * (((f / a) ** 0.5d0) * ((-1.0d0) / b_m))))
    else
        tmp = (-1.0d0) * (((-1.0d0) * ((a * f) ** 0.5d0)) * ((-2.0d0) / b_m))
    end if
    code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (F <= -3.2e+68) {
		tmp = -1.0 * ((-1.0 * A) * (-2.0 * (Math.pow((F / A), 0.5) * (-1.0 / B_m))));
	} else {
		tmp = -1.0 * ((-1.0 * Math.pow((A * F), 0.5)) * (-2.0 / B_m));
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if F <= -3.2e+68:
		tmp = -1.0 * ((-1.0 * A) * (-2.0 * (math.pow((F / A), 0.5) * (-1.0 / B_m))))
	else:
		tmp = -1.0 * ((-1.0 * math.pow((A * F), 0.5)) * (-2.0 / B_m))
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (F <= -3.2e+68)
		tmp = Float64(-1.0 * Float64(Float64(-1.0 * A) * Float64(-2.0 * Float64((Float64(F / A) ^ 0.5) * Float64(-1.0 / B_m)))));
	else
		tmp = Float64(-1.0 * Float64(Float64(-1.0 * (Float64(A * F) ^ 0.5)) * Float64(-2.0 / B_m)));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (F <= -3.2e+68)
		tmp = -1.0 * ((-1.0 * A) * (-2.0 * (((F / A) ^ 0.5) * (-1.0 / B_m))));
	else
		tmp = -1.0 * ((-1.0 * ((A * F) ^ 0.5)) * (-2.0 / B_m));
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -3.2e+68], N[(-1.0 * N[(N[(-1.0 * A), $MachinePrecision] * N[(-2.0 * N[(N[Power[N[(F / A), $MachinePrecision], 0.5], $MachinePrecision] * N[(-1.0 / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(-1.0 * N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(-2.0 / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.2 \cdot 10^{+68}:\\
\;\;\;\;-1 \cdot \left(\left(-1 \cdot A\right) \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{0.5} \cdot \frac{-1}{B\_m}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(\left(-1 \cdot {\left(A \cdot F\right)}^{0.5}\right) \cdot \frac{-2}{B\_m}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < -3.19999999999999994e68

    1. Initial program 11.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 C around 0

      \[\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. lower-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
      2. lower-*.f64N/A

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

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

        \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot \sqrt{\color{blue}{F} \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right) \]
      5. lower-pow.f64N/A

        \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot \sqrt{\color{blue}{F} \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right) \]
      6. pow1/2N/A

        \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot {\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)}^{\color{blue}{\frac{1}{2}}}\right) \]
      7. lower-pow.f64N/A

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(A - {\left(\mathsf{fma}\left(A, A, B \cdot B\right)\right)}^{0.5}\right)\right)}^{0.5}\right)} \]
    6. Taylor expanded in A around 0

      \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{\frac{1}{2}}\right) \]
    7. Step-by-step derivation
      1. lower-*.f648.2

        \[\leadsto -1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{0.5}\right) \]
    8. Applied rewrites8.2%

      \[\leadsto -1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{0.5}\right) \]
    9. Taylor expanded in A around -inf

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{\left(A \cdot \left(\frac{-1}{4} \cdot \left(\sqrt{\frac{F}{{A}^{5}}} \cdot \left(B \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) + \sqrt{\frac{F}{A}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right)}\right) \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \color{blue}{\left(\frac{-1}{4} \cdot \left(\sqrt{\frac{F}{{A}^{5}}} \cdot \left(B \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) + \sqrt{\frac{F}{A}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)}\right)\right) \]
      2. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(\frac{-1}{4} \cdot \left(\sqrt{\frac{F}{{A}^{5}}} \cdot \left(B \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) + \color{blue}{\sqrt{\frac{F}{A}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}}\right)\right)\right) \]
      3. lower-fma.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \mathsf{fma}\left(\frac{-1}{4}, \sqrt{\frac{F}{{A}^{5}}} \cdot \color{blue}{\left(B \cdot {\left(\sqrt{-1}\right)}^{2}\right)}, \sqrt{\frac{F}{A}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right)\right) \]
    11. Applied rewrites2.8%

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{\left(A \cdot \mathsf{fma}\left(-0.25, {\left(\frac{F}{{A}^{5}}\right)}^{0.5} \cdot \left(B \cdot -1\right), {\left(\frac{F}{A}\right)}^{0.5} \cdot \frac{-2}{B}\right)\right)}\right) \]
    12. Taylor expanded in A around -inf

      \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left(\sqrt{\frac{F}{A}} \cdot \color{blue}{\frac{{\left(\sqrt{-1}\right)}^{2}}{B}}\right)\right)\right)\right) \]
    13. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left(\sqrt{\frac{F}{A}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2}}{\color{blue}{B}}\right)\right)\right)\right) \]
      2. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left(\sqrt{\frac{F}{A}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2}}{B}\right)\right)\right)\right) \]
      3. pow1/2N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{\frac{1}{2}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2}}{B}\right)\right)\right)\right) \]
      4. lift-pow.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{\frac{1}{2}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2}}{B}\right)\right)\right)\right) \]
      5. lift-/.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{\frac{1}{2}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2}}{B}\right)\right)\right)\right) \]
      6. sqrt-pow2N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{\frac{1}{2}} \cdot \frac{{-1}^{\left(\frac{2}{2}\right)}}{B}\right)\right)\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{\frac{1}{2}} \cdot \frac{{-1}^{1}}{B}\right)\right)\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{\frac{1}{2}} \cdot \frac{-1}{B}\right)\right)\right)\right) \]
      9. lower-/.f642.8

        \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{0.5} \cdot \frac{-1}{B}\right)\right)\right)\right) \]
    14. Applied rewrites2.8%

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

    if -3.19999999999999994e68 < 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 C around 0

      \[\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. lower-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
      2. lower-*.f64N/A

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

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

        \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot \sqrt{\color{blue}{F} \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right) \]
      5. lower-pow.f64N/A

        \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot \sqrt{\color{blue}{F} \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right) \]
      6. pow1/2N/A

        \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot {\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)}^{\color{blue}{\frac{1}{2}}}\right) \]
      7. lower-pow.f64N/A

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(A - {\left(\mathsf{fma}\left(A, A, B \cdot B\right)\right)}^{0.5}\right)\right)}^{0.5}\right)} \]
    6. Taylor expanded in A around 0

      \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{\frac{1}{2}}\right) \]
    7. Step-by-step derivation
      1. lower-*.f6411.3

        \[\leadsto -1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{0.5}\right) \]
    8. Applied rewrites11.3%

      \[\leadsto -1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{0.5}\right) \]
    9. Taylor expanded in A around -inf

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{A \cdot F} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)}\right) \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(\sqrt{A \cdot F} \cdot \color{blue}{\frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}}\right)\right) \]
      2. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(\sqrt{A \cdot F} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{\color{blue}{B}}\right)\right) \]
      3. pow1/2N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right) \]
      4. lower-pow.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right) \]
      6. sqrt-pow2N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{{-1}^{\left(\frac{2}{2}\right)} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{{-1}^{1} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{-1 \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right) \]
      9. sqrt-pow2N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{-1 \cdot {2}^{\left(\frac{2}{2}\right)}}{B}\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{-1 \cdot {2}^{1}}{B}\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{-1 \cdot 2}{B}\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{\frac{1}{2}} \cdot \frac{-2}{B}\right)\right) \]
      13. lower-/.f643.7

        \[\leadsto -1 \cdot \left(-1 \cdot \left({\left(A \cdot F\right)}^{0.5} \cdot \frac{-2}{B}\right)\right) \]
    11. Applied rewrites3.7%

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{\left({\left(A \cdot F\right)}^{0.5} \cdot \frac{-2}{B}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.2 \cdot 10^{+68}:\\ \;\;\;\;-1 \cdot \left(\left(-1 \cdot A\right) \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{0.5} \cdot \frac{-1}{B}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left(\left(-1 \cdot {\left(A \cdot F\right)}^{0.5}\right) \cdot \frac{-2}{B}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 8.8% accurate, N/A× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ -1 \cdot \left(\left(-1 \cdot A\right) \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{0.5} \cdot \frac{-1}{B\_m}\right)\right)\right) \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (* -1.0 (* (* -1.0 A) (* -2.0 (* (pow (/ F A) 0.5) (/ -1.0 B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return -1.0 * ((-1.0 * A) * (-2.0 * (pow((F / A), 0.5) * (-1.0 / B_m))));
}
B_m =     private
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b_m, c, f)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = (-1.0d0) * (((-1.0d0) * a) * ((-2.0d0) * (((f / a) ** 0.5d0) * ((-1.0d0) / b_m))))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return -1.0 * ((-1.0 * A) * (-2.0 * (Math.pow((F / A), 0.5) * (-1.0 / B_m))));
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return -1.0 * ((-1.0 * A) * (-2.0 * (math.pow((F / A), 0.5) * (-1.0 / B_m))))
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(-1.0 * Float64(Float64(-1.0 * A) * Float64(-2.0 * Float64((Float64(F / A) ^ 0.5) * Float64(-1.0 / B_m)))))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = -1.0 * ((-1.0 * A) * (-2.0 * (((F / A) ^ 0.5) * (-1.0 / B_m))));
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(-1.0 * N[(N[(-1.0 * A), $MachinePrecision] * N[(-2.0 * N[(N[Power[N[(F / A), $MachinePrecision], 0.5], $MachinePrecision] * N[(-1.0 / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-1 \cdot \left(\left(-1 \cdot A\right) \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{0.5} \cdot \frac{-1}{B\_m}\right)\right)\right)
\end{array}
Derivation
  1. Initial program 15.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. Add Preprocessing
  3. Taylor expanded in C around 0

    \[\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. lower-*.f64N/A

      \[\leadsto -1 \cdot \color{blue}{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    2. lower-*.f64N/A

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

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

      \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot \sqrt{\color{blue}{F} \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right) \]
    5. lower-pow.f64N/A

      \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot \sqrt{\color{blue}{F} \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right) \]
    6. pow1/2N/A

      \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot {\left(F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)\right)}^{\color{blue}{\frac{1}{2}}}\right) \]
    7. lower-pow.f64N/A

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

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(A - {\left(\mathsf{fma}\left(A, A, B \cdot B\right)\right)}^{0.5}\right)\right)}^{0.5}\right)} \]
  6. Taylor expanded in A around 0

    \[\leadsto -1 \cdot \left(\frac{{2}^{\frac{1}{2}}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{\frac{1}{2}}\right) \]
  7. Step-by-step derivation
    1. lower-*.f6410.1

      \[\leadsto -1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{0.5}\right) \]
  8. Applied rewrites10.1%

    \[\leadsto -1 \cdot \left(\frac{{2}^{0.5}}{B} \cdot {\left(F \cdot \left(-1 \cdot B\right)\right)}^{0.5}\right) \]
  9. Taylor expanded in A around -inf

    \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{\left(A \cdot \left(\frac{-1}{4} \cdot \left(\sqrt{\frac{F}{{A}^{5}}} \cdot \left(B \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) + \sqrt{\frac{F}{A}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right)}\right) \]
  10. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \color{blue}{\left(\frac{-1}{4} \cdot \left(\sqrt{\frac{F}{{A}^{5}}} \cdot \left(B \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) + \sqrt{\frac{F}{A}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)}\right)\right) \]
    2. lower-*.f64N/A

      \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(\frac{-1}{4} \cdot \left(\sqrt{\frac{F}{{A}^{5}}} \cdot \left(B \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) + \color{blue}{\sqrt{\frac{F}{A}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}}\right)\right)\right) \]
    3. lower-fma.f64N/A

      \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \mathsf{fma}\left(\frac{-1}{4}, \sqrt{\frac{F}{{A}^{5}}} \cdot \color{blue}{\left(B \cdot {\left(\sqrt{-1}\right)}^{2}\right)}, \sqrt{\frac{F}{A}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2} \cdot {\left(\sqrt{2}\right)}^{2}}{B}\right)\right)\right) \]
  11. Applied rewrites2.4%

    \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{\left(A \cdot \mathsf{fma}\left(-0.25, {\left(\frac{F}{{A}^{5}}\right)}^{0.5} \cdot \left(B \cdot -1\right), {\left(\frac{F}{A}\right)}^{0.5} \cdot \frac{-2}{B}\right)\right)}\right) \]
  12. Taylor expanded in A around -inf

    \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left(\sqrt{\frac{F}{A}} \cdot \color{blue}{\frac{{\left(\sqrt{-1}\right)}^{2}}{B}}\right)\right)\right)\right) \]
  13. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left(\sqrt{\frac{F}{A}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2}}{\color{blue}{B}}\right)\right)\right)\right) \]
    2. lower-*.f64N/A

      \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left(\sqrt{\frac{F}{A}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2}}{B}\right)\right)\right)\right) \]
    3. pow1/2N/A

      \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{\frac{1}{2}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2}}{B}\right)\right)\right)\right) \]
    4. lift-pow.f64N/A

      \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{\frac{1}{2}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2}}{B}\right)\right)\right)\right) \]
    5. lift-/.f64N/A

      \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{\frac{1}{2}} \cdot \frac{{\left(\sqrt{-1}\right)}^{2}}{B}\right)\right)\right)\right) \]
    6. sqrt-pow2N/A

      \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{\frac{1}{2}} \cdot \frac{{-1}^{\left(\frac{2}{2}\right)}}{B}\right)\right)\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{\frac{1}{2}} \cdot \frac{{-1}^{1}}{B}\right)\right)\right)\right) \]
    8. metadata-evalN/A

      \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{\frac{1}{2}} \cdot \frac{-1}{B}\right)\right)\right)\right) \]
    9. lower-/.f642.6

      \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{0.5} \cdot \frac{-1}{B}\right)\right)\right)\right) \]
  14. Applied rewrites2.6%

    \[\leadsto -1 \cdot \left(-1 \cdot \left(A \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{0.5} \cdot \color{blue}{\frac{-1}{B}}\right)\right)\right)\right) \]
  15. Final simplification2.6%

    \[\leadsto -1 \cdot \left(\left(-1 \cdot A\right) \cdot \left(-2 \cdot \left({\left(\frac{F}{A}\right)}^{0.5} \cdot \frac{-1}{B}\right)\right)\right) \]
  16. Add Preprocessing

Reproduce

?
herbie shell --seed 2025064 
(FPCore (A B C F)
  :name "ABCF->ab-angle b"
  :precision binary64
  (/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))