?

Average Error: 52.4 → 39.6
Time: 43.1s
Precision: binary64
Cost: 102600

?

\[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
\[\begin{array}{l} t_0 := \mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)\\ t_1 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ t_2 := A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\\ t_3 := {B}^{2} + C \cdot \left(A \cdot -4\right)\\ t_4 := -\frac{\sqrt{\left(2 \cdot \left(t_3 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_3}\\ \mathbf{if}\;t_4 \leq 0:\\ \;\;\;\;\frac{\sqrt{t_0} \cdot \left(-\sqrt{\left(2 \cdot F\right) \cdot t_2}\right)}{t_0}\\ \mathbf{elif}\;t_4 \leq \infty:\\ \;\;\;\;\frac{\sqrt{t_2} \cdot \left(-\sqrt{2 \cdot \left(F \cdot t_1\right)}\right)}{t_1}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{fma}\left(0.5, \frac{A}{\frac{B}{A}}, B\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \]
(FPCore (A B C F)
 :precision binary64
 (/
  (-
   (sqrt
    (*
     (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F))
     (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
  (- (pow B 2.0) (* (* 4.0 A) C))))
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (fma -4.0 (* A C) (* B B)))
        (t_1 (+ (* B B) (* -4.0 (* A C))))
        (t_2 (+ A (+ C (hypot B (- A C)))))
        (t_3 (+ (pow B 2.0) (* C (* A -4.0))))
        (t_4
         (-
          (/
           (sqrt
            (*
             (* 2.0 (* t_3 F))
             (+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0))))))
           t_3))))
   (if (<= t_4 0.0)
     (/ (* (sqrt t_0) (- (sqrt (* (* 2.0 F) t_2)))) t_0)
     (if (<= t_4 INFINITY)
       (/ (* (sqrt t_2) (- (sqrt (* 2.0 (* F t_1))))) t_1)
       (*
        (sqrt (* F (+ A (fma 0.5 (/ A (/ B A)) B))))
        (/ (- (sqrt 2.0)) B))))))
double code(double A, double B, double C, double F) {
	return -sqrt(((2.0 * ((pow(B, 2.0) - ((4.0 * A) * C)) * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / (pow(B, 2.0) - ((4.0 * A) * C));
}
double code(double A, double B, double C, double F) {
	double t_0 = fma(-4.0, (A * C), (B * B));
	double t_1 = (B * B) + (-4.0 * (A * C));
	double t_2 = A + (C + hypot(B, (A - C)));
	double t_3 = pow(B, 2.0) + (C * (A * -4.0));
	double t_4 = -(sqrt(((2.0 * (t_3 * F)) * ((A + C) + sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / t_3);
	double tmp;
	if (t_4 <= 0.0) {
		tmp = (sqrt(t_0) * -sqrt(((2.0 * F) * t_2))) / t_0;
	} else if (t_4 <= ((double) INFINITY)) {
		tmp = (sqrt(t_2) * -sqrt((2.0 * (F * t_1)))) / t_1;
	} else {
		tmp = sqrt((F * (A + fma(0.5, (A / (B / A)), B)))) * (-sqrt(2.0) / B);
	}
	return tmp;
}
function code(A, B, C, F)
	return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)))
end
function code(A, B, C, F)
	t_0 = fma(-4.0, Float64(A * C), Float64(B * B))
	t_1 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))
	t_2 = Float64(A + Float64(C + hypot(B, Float64(A - C))))
	t_3 = Float64((B ^ 2.0) + Float64(C * Float64(A * -4.0)))
	t_4 = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(t_3 * F)) * Float64(Float64(A + C) + sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / t_3))
	tmp = 0.0
	if (t_4 <= 0.0)
		tmp = Float64(Float64(sqrt(t_0) * Float64(-sqrt(Float64(Float64(2.0 * F) * t_2)))) / t_0);
	elseif (t_4 <= Inf)
		tmp = Float64(Float64(sqrt(t_2) * Float64(-sqrt(Float64(2.0 * Float64(F * t_1))))) / t_1);
	else
		tmp = Float64(sqrt(Float64(F * Float64(A + fma(0.5, Float64(A / Float64(B / A)), B)))) * Float64(Float64(-sqrt(2.0)) / B));
	end
	return tmp
end
code[A_, B_, C_, F_] := N[((-N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(-4.0 * N[(A * C), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[B, 2.0], $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = (-N[(N[Sqrt[N[(N[(2.0 * N[(t$95$3 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision])}, If[LessEqual[t$95$4, 0.0], N[(N[(N[Sqrt[t$95$0], $MachinePrecision] * (-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * t$95$2), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(N[(N[Sqrt[t$95$2], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A + N[(0.5 * N[(A / N[(B / A), $MachinePrecision]), $MachinePrecision] + B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]]]]]]
\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}
\begin{array}{l}
t_0 := \mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)\\
t_1 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
t_2 := A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\\
t_3 := {B}^{2} + C \cdot \left(A \cdot -4\right)\\
t_4 := -\frac{\sqrt{\left(2 \cdot \left(t_3 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_3}\\
\mathbf{if}\;t_4 \leq 0:\\
\;\;\;\;\frac{\sqrt{t_0} \cdot \left(-\sqrt{\left(2 \cdot F\right) \cdot t_2}\right)}{t_0}\\

\mathbf{elif}\;t_4 \leq \infty:\\
\;\;\;\;\frac{\sqrt{t_2} \cdot \left(-\sqrt{2 \cdot \left(F \cdot t_1\right)}\right)}{t_1}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{fma}\left(0.5, \frac{A}{\frac{B}{A}}, B\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\


\end{array}

Error?

Derivation?

  1. Split input into 3 regimes
  2. if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -0.0

    1. Initial program 44.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. Simplified40.3

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

      [Start]44.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} \]
    3. Applied egg-rr32.2

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

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

      [Start]32.2

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

      *-commutative [=>]32.2

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

      *-commutative [=>]32.2

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

      +-commutative [=>]32.2

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

      associate-+r+ [<=]31.4

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

    if -0.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0

    1. Initial program 37.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. Simplified37.6

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

      [Start]37.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} \]
    3. Applied egg-rr13.6

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

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

      [Start]13.6

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

      *-commutative [=>]13.6

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

      *-commutative [=>]13.6

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

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

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

      [Start]13.6

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

      *-commutative [=>]13.6

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

      unpow2 [=>]13.6

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

      *-commutative [=>]13.6

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

    if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)))

    1. Initial program 64.0

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified63.2

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

      [Start]64.0

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

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

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

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

      [Start]55.6

      \[ -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{\left(A + \left(0.5 \cdot \frac{{A}^{2}}{B} + B\right)\right) \cdot F}\right) \]

      associate-*r* [=>]55.6

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

      *-commutative [=>]55.6

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

      fma-def [=>]55.6

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

      unpow2 [=>]55.6

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

      associate-/l* [=>]54.1

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

      associate-*r/ [=>]54.1

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

      mul-1-neg [=>]54.1

      \[ \sqrt{\left(A + \mathsf{fma}\left(0.5, \frac{A}{\frac{B}{A}}, B\right)\right) \cdot F} \cdot \frac{\color{blue}{-\sqrt{2}}}{B} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification39.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;-\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} + C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} + C \cdot \left(A \cdot -4\right)} \leq 0:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)} \cdot \left(-\sqrt{\left(2 \cdot F\right) \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)}\right)}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}\\ \mathbf{elif}\;-\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} + C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} + C \cdot \left(A \cdot -4\right)} \leq \infty:\\ \;\;\;\;\frac{\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \left(-\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)}\right)}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{fma}\left(0.5, \frac{A}{\frac{B}{A}}, B\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \]

Alternatives

Alternative 1
Error41.2
Cost34252
\[\begin{array}{l} t_0 := \mathsf{hypot}\left(B, A - C\right)\\ t_1 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\ t_2 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\ \mathbf{if}\;A \leq -6.2 \cdot 10^{+38}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_2 \cdot \left(F \cdot \mathsf{fma}\left(2, C, \frac{\left(B \cdot B\right) \cdot -0.5}{A}\right)\right)\right)}}{t_2}\\ \mathbf{elif}\;A \leq -200000000:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(2, A, -0.5 \cdot \left(B \cdot \frac{B}{C}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot t_1\right)} \cdot \frac{1}{-t_1}\\ \mathbf{elif}\;A \leq -1 \cdot 10^{-86}:\\ \;\;\;\;\frac{\sqrt{F \cdot \left(C + \left(A + t_0\right)\right)} \cdot \left(-\sqrt{2 \cdot t_2}\right)}{t_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2 \cdot \mathsf{fma}\left(-4, F \cdot \left(A \cdot C\right), B \cdot \left(B \cdot F\right)\right)} \cdot \left(-\sqrt{A + \left(C + t_0\right)}\right)}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\ \end{array} \]
Alternative 2
Error40.5
Cost27268
\[\begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ t_1 := \sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}\\ \mathbf{if}\;B \leq -3.2 \cdot 10^{-30}:\\ \;\;\;\;\frac{t_1 \cdot \left(\sqrt{2} \cdot \left(B \cdot \sqrt{F}\right)\right)}{t_0}\\ \mathbf{elif}\;B \leq 1.95 \cdot 10^{+74}:\\ \;\;\;\;\frac{t_1 \cdot \left(-\sqrt{2 \cdot \left(F \cdot t_0\right)}\right)}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{fma}\left(0.5, \frac{A}{\frac{B}{A}}, B\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \]
Alternative 3
Error40.8
Cost21444
\[\begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ \mathbf{if}\;B \leq 5.7 \cdot 10^{+72}:\\ \;\;\;\;\frac{\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \left(-\sqrt{2 \cdot \left(F \cdot t_0\right)}\right)}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{fma}\left(0.5, \frac{A}{\frac{B}{A}}, B\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \]
Alternative 4
Error43.7
Cost21320
\[\begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ t_1 := \sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}\\ \mathbf{if}\;B \leq -2.1 \cdot 10^{-73}:\\ \;\;\;\;\frac{t_1 \cdot \left(-\sqrt{2 \cdot \left(F \cdot \left(B \cdot B\right)\right)}\right)}{t_0}\\ \mathbf{elif}\;B \leq 4.4 \cdot 10^{-50}:\\ \;\;\;\;\frac{\sqrt{2 \cdot \left(-4 \cdot \left(F \cdot \left(A \cdot C\right)\right)\right)} \cdot \left(-t_1\right)}{t_0}\\ \mathbf{elif}\;B \leq 8.2 \cdot 10^{+108}:\\ \;\;\;\;\frac{-\sqrt{-2 \cdot \left(\left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(F \cdot \left(4 \cdot \left(A \cdot C\right) - B \cdot B\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{fma}\left(0.5, \frac{A}{\frac{B}{A}}, B\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \]
Alternative 5
Error44.7
Cost20356
\[\begin{array}{l} \mathbf{if}\;B \leq 1.45 \cdot 10^{+72}:\\ \;\;\;\;\frac{-\sqrt{-2 \cdot \left(\left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(F \cdot \left(4 \cdot \left(A \cdot C\right) - B \cdot B\right)\right)\right)}}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \mathsf{fma}\left(0.5, \frac{C}{\frac{B}{C}}, B\right)\right)}\\ \end{array} \]
Alternative 6
Error44.9
Cost20356
\[\begin{array}{l} \mathbf{if}\;B \leq 7.2 \cdot 10^{+108}:\\ \;\;\;\;\frac{-\sqrt{-2 \cdot \left(\left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(F \cdot \left(4 \cdot \left(A \cdot C\right) - B \cdot B\right)\right)\right)}}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{fma}\left(0.5, \frac{A}{\frac{B}{A}}, B\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \]
Alternative 7
Error46.1
Cost15176
\[\begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ \mathbf{if}\;C \leq -20000000:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;C \leq 110000000:\\ \;\;\;\;\frac{-\sqrt{-2 \cdot \left(\left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)\right) \cdot \left(F \cdot \left(4 \cdot \left(A \cdot C\right) - B \cdot B\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t_0\right)} \cdot \left(-\sqrt{2 \cdot C}\right)}{t_0}\\ \end{array} \]
Alternative 8
Error50.1
Cost15120
\[\begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ t_1 := \sqrt{2 \cdot \left(F \cdot t_0\right)}\\ t_2 := \frac{t_1 \cdot \left(-\sqrt{2 \cdot A}\right)}{t_0}\\ \mathbf{if}\;C \leq -2.05 \cdot 10^{+55}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;C \leq -3.1 \cdot 10^{-289}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;C \leq 5.1 \cdot 10^{-182}:\\ \;\;\;\;-\frac{t_1 \cdot \sqrt{-B}}{t_0}\\ \mathbf{elif}\;C \leq 8.5 \cdot 10^{-13}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1 \cdot \left(-\sqrt{2 \cdot C}\right)}{t_0}\\ \end{array} \]
Alternative 9
Error53.7
Cost15056
\[\begin{array}{l} t_0 := A + \left(A + C\right)\\ t_1 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ t_2 := F \cdot t_1\\ \mathbf{if}\;C \leq -2.7 \cdot 10^{+50}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)\right)}}{t_1}\\ \mathbf{elif}\;C \leq -1.78 \cdot 10^{-152}:\\ \;\;\;\;-\frac{\sqrt{\left(A \cdot -16\right) \cdot \left(F \cdot \left(C \cdot C\right)\right)}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}\\ \mathbf{elif}\;C \leq -1.1 \cdot 10^{-246}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(-4 \cdot \left(F \cdot \left(A \cdot C\right)\right)\right) \cdot t_0\right)}}{t_1}\\ \mathbf{elif}\;C \leq 3.6 \cdot 10^{-273}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot t_2} \cdot \sqrt{-B}}{t_1}\\ \mathbf{elif}\;C \leq 4.8 \cdot 10^{-11}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(t_2 \cdot t_0\right)}}{t_1}\\ \mathbf{else}:\\ \;\;\;\;-\frac{\sqrt{-2 \cdot \left(\left(C + \left(A + C\right)\right) \cdot \left(F \cdot \left(4 \cdot \left(A \cdot C\right) - B \cdot B\right)\right)\right)}}{t_1}\\ \end{array} \]
Alternative 10
Error51.8
Cost14988
\[\begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ t_1 := \sqrt{2 \cdot \left(F \cdot t_0\right)}\\ \mathbf{if}\;A \leq -4.8 \cdot 10^{-84}:\\ \;\;\;\;-\frac{\sqrt{\left(A \cdot -16\right) \cdot \left(F \cdot \left(C \cdot C\right)\right)}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}\\ \mathbf{elif}\;A \leq -3.7 \cdot 10^{-300}:\\ \;\;\;\;-\frac{t_1 \cdot \sqrt{-B}}{t_0}\\ \mathbf{elif}\;A \leq 4.2 \cdot 10^{-23}:\\ \;\;\;\;-\frac{\sqrt{-2 \cdot \left(\left(C + \left(A + C\right)\right) \cdot \left(F \cdot \left(4 \cdot \left(A \cdot C\right) - B \cdot B\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1 \cdot \left(-\sqrt{2 \cdot A}\right)}{t_0}\\ \end{array} \]
Alternative 11
Error53.7
Cost14216
\[\begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ t_1 := F \cdot \left(4 \cdot \left(A \cdot C\right) - B \cdot B\right)\\ t_2 := F \cdot t_0\\ \mathbf{if}\;C \leq -3.3 \cdot 10^{+50}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;C \leq -2.7 \cdot 10^{-154}:\\ \;\;\;\;-\frac{\sqrt{\left(A \cdot -16\right) \cdot \left(F \cdot \left(C \cdot C\right)\right)}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}\\ \mathbf{elif}\;C \leq -5.8 \cdot 10^{-270}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_2 \cdot \left(\left(A + C\right) + \left(A - C\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;C \leq 2.6 \cdot 10^{-182}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(t_1 \cdot \left(B - \left(A + C\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;C \leq 2.6 \cdot 10^{-9}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(t_2 \cdot \left(A + \left(A + C\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;-\frac{\sqrt{-2 \cdot \left(\left(C + \left(A + C\right)\right) \cdot t_1\right)}}{t_0}\\ \end{array} \]
Alternative 12
Error57.0
Cost8716
\[\begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ t_1 := F \cdot t_0\\ t_2 := -\frac{\sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)\right)}}{t_0}\\ \mathbf{if}\;A \leq -6.3 \cdot 10^{-307}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;A \leq 4.3 \cdot 10^{-23}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(t_1 \cdot \left(B + \left(A + C\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;A \leq 3.1 \cdot 10^{-15}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(t_1 \cdot \left(A + \left(A + C\right)\right)\right)}}{t_0}\\ \end{array} \]
Alternative 13
Error53.7
Cost8712
\[\begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ \mathbf{if}\;C \leq -26000000:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;C \leq 1.8 \cdot 10^{-6}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(\left(A + C\right) + \left(A - C\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;-\frac{\sqrt{-2 \cdot \left(\left(C + \left(A + C\right)\right) \cdot \left(F \cdot \left(4 \cdot \left(A \cdot C\right) - B \cdot B\right)\right)\right)}}{t_0}\\ \end{array} \]
Alternative 14
Error53.7
Cost8584
\[\begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ \mathbf{if}\;C \leq -112000:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;C \leq 3.3 \cdot 10^{-12}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(A + \left(A + C\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;-\frac{\sqrt{-2 \cdot \left(\left(C + \left(A + C\right)\right) \cdot \left(F \cdot \left(4 \cdot \left(A \cdot C\right) - B \cdot B\right)\right)\right)}}{t_0}\\ \end{array} \]
Alternative 15
Error56.3
Cost8452
\[\begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ \mathbf{if}\;C \leq -102000:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(A + \left(A + C\right)\right)\right)}}{t_0}\\ \end{array} \]
Alternative 16
Error57.5
Cost8196
\[\begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ \mathbf{if}\;C \leq -160000:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(A + \left(A + C\right)\right) \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{t_0}\\ \end{array} \]
Alternative 17
Error56.9
Cost8196
\[\begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ \mathbf{if}\;C \leq -200000:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(-4 \cdot \left(F \cdot \left(A \cdot C\right)\right)\right) \cdot \left(A + \left(A + C\right)\right)\right)}}{t_0}\\ \end{array} \]
Alternative 18
Error58.3
Cost7940
\[\begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ \mathbf{if}\;A \leq 1.8 \cdot 10^{+130}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(2 \cdot \left(A \cdot \left(F \cdot \left(B \cdot B\right)\right)\right)\right)}}{t_0}\\ \end{array} \]
Alternative 19
Error58.5
Cost7808
\[-\frac{\sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)\right)}}{B \cdot B + -4 \cdot \left(A \cdot C\right)} \]
Alternative 20
Error62.6
Cost7680
\[\frac{-\sqrt{2 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B\right)\right)\right)}}{B \cdot B + -4 \cdot \left(A \cdot C\right)} \]
Alternative 21
Error63.1
Cost6976
\[\sqrt{\frac{F}{A}} \cdot \frac{0.5}{\frac{C}{B}} \]

Error

Reproduce?

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