Average Error: 52.6 → 35.8
Time: 56.9s
Precision: binary64
Cost: 26632
\[ \begin{array}{c}[A, C] = \mathsf{sort}([A, C])\\ \end{array} \]
\[\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} \mathbf{if}\;B \leq -3.05 \cdot 10^{-18}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}\\ \mathbf{elif}\;B \leq 4.7 \cdot 10^{-110}:\\ \;\;\;\;\frac{-\sqrt{A \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot -16\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)} \cdot \left(-{\left(\frac{B}{\sqrt{2}}\right)}^{-1}\right)\\ \end{array} \]
(FPCore (A B C F)
 :precision binary64
 (/
  (-
   (sqrt
    (*
     (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F))
     (- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
  (- (pow B 2.0) (* (* 4.0 A) C))))
(FPCore (A B C F)
 :precision binary64
 (if (<= B -3.05e-18)
   (* (/ (sqrt 2.0) B) (sqrt (* F (- A (hypot A B)))))
   (if (<= B 4.7e-110)
     (/ (- (sqrt (* A (* (* A C) (* F -16.0))))) (fma A (* C -4.0) (* B B)))
     (* (sqrt (* F (- A (hypot B A)))) (- (pow (/ B (sqrt 2.0)) -1.0))))))
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 tmp;
	if (B <= -3.05e-18) {
		tmp = (sqrt(2.0) / B) * sqrt((F * (A - hypot(A, B))));
	} else if (B <= 4.7e-110) {
		tmp = -sqrt((A * ((A * C) * (F * -16.0)))) / fma(A, (C * -4.0), (B * B));
	} else {
		tmp = sqrt((F * (A - hypot(B, A)))) * -pow((B / sqrt(2.0)), -1.0);
	}
	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)
	tmp = 0.0
	if (B <= -3.05e-18)
		tmp = Float64(Float64(sqrt(2.0) / B) * sqrt(Float64(F * Float64(A - hypot(A, B)))));
	elseif (B <= 4.7e-110)
		tmp = Float64(Float64(-sqrt(Float64(A * Float64(Float64(A * C) * Float64(F * -16.0))))) / fma(A, Float64(C * -4.0), Float64(B * B)));
	else
		tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B, A)))) * Float64(-(Float64(B / sqrt(2.0)) ^ -1.0)));
	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_] := If[LessEqual[B, -3.05e-18], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 4.7e-110], N[((-N[Sqrt[N[(A * N[(N[(A * C), $MachinePrecision] * N[(F * -16.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Power[N[(B / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], -1.0], $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}
\mathbf{if}\;B \leq -3.05 \cdot 10^{-18}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}\\

\mathbf{elif}\;B \leq 4.7 \cdot 10^{-110}:\\
\;\;\;\;\frac{-\sqrt{A \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot -16\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\\

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


\end{array}

Error

Derivation

  1. Split input into 3 regimes
  2. if B < -3.0499999999999999e-18

    1. Initial program 54.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. Taylor expanded in C around 0 63.5

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

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)} \]
      Proof
      (*.f64 (/.f64 (sqrt.f64 2) B) (neg.f64 (sqrt.f64 (*.f64 F (-.f64 A (hypot.f64 B A)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (sqrt.f64 2) B) (neg.f64 (sqrt.f64 (*.f64 F (-.f64 A (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 B B) (*.f64 A A))))))))): 64 points increase in error, 4 points decrease in error
      (*.f64 (/.f64 (sqrt.f64 2) B) (neg.f64 (sqrt.f64 (*.f64 F (-.f64 A (sqrt.f64 (+.f64 (Rewrite<= unpow2_binary64 (pow.f64 B 2)) (*.f64 A A)))))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (sqrt.f64 2) B) (neg.f64 (sqrt.f64 (*.f64 F (-.f64 A (sqrt.f64 (+.f64 (pow.f64 B 2) (Rewrite<= unpow2_binary64 (pow.f64 A 2))))))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (sqrt.f64 2) B) (neg.f64 (sqrt.f64 (Rewrite<= *-commutative_binary64 (*.f64 (-.f64 A (sqrt.f64 (+.f64 (pow.f64 B 2) (pow.f64 A 2)))) F))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 (/.f64 (sqrt.f64 2) B) (sqrt.f64 (*.f64 (-.f64 A (sqrt.f64 (+.f64 (pow.f64 B 2) (pow.f64 A 2)))) F))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (*.f64 (/.f64 (sqrt.f64 2) B) (sqrt.f64 (*.f64 (-.f64 A (sqrt.f64 (+.f64 (pow.f64 B 2) (pow.f64 A 2)))) F))))): 0 points increase in error, 0 points decrease in error
    4. Applied egg-rr33.4

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

    if -3.0499999999999999e-18 < B < 4.69999999999999992e-110

    1. Initial program 51.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. Simplified47.6

      \[\leadsto \color{blue}{\frac{-\sqrt{F \cdot \left(2 \cdot \left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
      Proof
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (fma.f64 B B (*.f64 A (*.f64 C -4))) (+.f64 A (-.f64 C (hypot.f64 B (-.f64 A C))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (fma.f64 B B (*.f64 A (*.f64 C (Rewrite<= metadata-eval (neg.f64 4))))) (+.f64 A (-.f64 C (hypot.f64 B (-.f64 A C))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (fma.f64 B B (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 A C) (neg.f64 4)))) (+.f64 A (-.f64 C (hypot.f64 B (-.f64 A C))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (fma.f64 B B (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 (*.f64 A C) 4)))) (+.f64 A (-.f64 C (hypot.f64 B (-.f64 A C))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (fma.f64 B B (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 4 (*.f64 A C))))) (+.f64 A (-.f64 C (hypot.f64 B (-.f64 A C))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (fma.f64 B B (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 4 A) C)))) (+.f64 A (-.f64 C (hypot.f64 B (-.f64 A C))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 B B) (*.f64 (*.f64 4 A) C))) (+.f64 A (-.f64 C (hypot.f64 B (-.f64 A C))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (-.f64 (Rewrite<= unpow2_binary64 (pow.f64 B 2)) (*.f64 (*.f64 4 A) C)) (+.f64 A (-.f64 C (hypot.f64 B (-.f64 A C))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) (+.f64 A (-.f64 C (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 B B) (*.f64 (-.f64 A C) (-.f64 A C)))))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 27 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) (+.f64 A (-.f64 C (sqrt.f64 (+.f64 (Rewrite<= unpow2_binary64 (pow.f64 B 2)) (*.f64 (-.f64 A C) (-.f64 A C))))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) (+.f64 A (-.f64 C (sqrt.f64 (+.f64 (pow.f64 B 2) (Rewrite<= unpow2_binary64 (pow.f64 (-.f64 A C) 2))))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) (+.f64 A (-.f64 C (sqrt.f64 (Rewrite<= +-commutative_binary64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) (+.f64 A (Rewrite=> sub-neg_binary64 (+.f64 C (neg.f64 (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2)))))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 A C) (neg.f64 (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 19 points increase in error, 5 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) (Rewrite<= sub-neg_binary64 (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2)))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 F (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 2 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 F (*.f64 2 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)))) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2)))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 14 points increase in error, 10 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 2 (-.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))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (sqrt.f64 (*.f64 (Rewrite<= associate-*r*_binary64 (*.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))))))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 1 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (Rewrite<= --rgt-identity_binary64 (-.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)))))) 0))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.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)))))) 0))) (fma.f64 B B (*.f64 A (*.f64 C -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 0 (-.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)))))) 0)) (fma.f64 B B (*.f64 A (*.f64 C (Rewrite<= metadata-eval (neg.f64 4)))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 0 (-.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)))))) 0)) (fma.f64 B B (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 A C) (neg.f64 4))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 0 (-.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)))))) 0)) (fma.f64 B B (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 (*.f64 A C) 4))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 0 (-.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)))))) 0)) (fma.f64 B B (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 4 (*.f64 A C)))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 0 (-.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)))))) 0)) (fma.f64 B B (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 4 A) C))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 0 (-.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)))))) 0)) (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 B B) (*.f64 (*.f64 4 A) C)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 0 (-.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)))))) 0)) (-.f64 (Rewrite<= unpow2_binary64 (pow.f64 B 2)) (*.f64 (*.f64 4 A) C))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> div-sub_binary64 (-.f64 (/.f64 0 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) (/.f64 (-.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)))))) 0) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 0 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) (/.f64 (Rewrite=> --rgt-identity_binary64 (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 points increase in error, 0 points decrease in error
      (Rewrite<= div-sub_binary64 (/.f64 (-.f64 0 (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 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= neg-sub0_binary64 (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 points increase in error, 0 points decrease in error
    3. Taylor expanded in A around -inf 41.4

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

      \[\leadsto \frac{-\sqrt{F \cdot \left(2 \cdot \left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(A + \color{blue}{\mathsf{fma}\left(0.5, \frac{B}{\frac{A}{B}}, A\right)}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      Proof
      (fma.f64 1/2 (/.f64 B (/.f64 A B)) A): 0 points increase in error, 0 points decrease in error
      (fma.f64 1/2 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 B B) A)) A): 25 points increase in error, 10 points decrease in error
      (fma.f64 1/2 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 B 2)) A) A): 0 points increase in error, 0 points decrease in error
      (Rewrite<= fma-def_binary64 (+.f64 (*.f64 1/2 (/.f64 (pow.f64 B 2) A)) A)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 A (*.f64 1/2 (/.f64 (pow.f64 B 2) A)))): 0 points increase in error, 0 points decrease in error
    5. Taylor expanded in B around 0 46.2

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

      \[\leadsto \frac{-\sqrt{\color{blue}{\left(A \cdot \left(C \cdot A\right)\right) \cdot \left(F \cdot -16\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      Proof
      (*.f64 (*.f64 A (*.f64 C A)) (*.f64 F -16)): 0 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 A (Rewrite<= *-commutative_binary64 (*.f64 A C))) (*.f64 F -16)): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 A A) C)) (*.f64 F -16)): 23 points increase in error, 17 points decrease in error
      (*.f64 (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 A 2)) C) (*.f64 F -16)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 (*.f64 (pow.f64 A 2) C) F) -16)): 2 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= associate-*r*_binary64 (*.f64 (pow.f64 A 2) (*.f64 C F))) -16): 32 points increase in error, 30 points decrease in error
      (Rewrite<= *-commutative_binary64 (*.f64 -16 (*.f64 (pow.f64 A 2) (*.f64 C F)))): 0 points increase in error, 0 points decrease in error
    7. Applied egg-rr36.6

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

    if 4.69999999999999992e-110 < B

    1. Initial program 52.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. Taylor expanded in C around 0 50.4

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

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)} \]
      Proof
      (*.f64 (/.f64 (sqrt.f64 2) B) (neg.f64 (sqrt.f64 (*.f64 F (-.f64 A (hypot.f64 B A)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (sqrt.f64 2) B) (neg.f64 (sqrt.f64 (*.f64 F (-.f64 A (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 B B) (*.f64 A A))))))))): 64 points increase in error, 4 points decrease in error
      (*.f64 (/.f64 (sqrt.f64 2) B) (neg.f64 (sqrt.f64 (*.f64 F (-.f64 A (sqrt.f64 (+.f64 (Rewrite<= unpow2_binary64 (pow.f64 B 2)) (*.f64 A A)))))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (sqrt.f64 2) B) (neg.f64 (sqrt.f64 (*.f64 F (-.f64 A (sqrt.f64 (+.f64 (pow.f64 B 2) (Rewrite<= unpow2_binary64 (pow.f64 A 2))))))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (sqrt.f64 2) B) (neg.f64 (sqrt.f64 (Rewrite<= *-commutative_binary64 (*.f64 (-.f64 A (sqrt.f64 (+.f64 (pow.f64 B 2) (pow.f64 A 2)))) F))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 (/.f64 (sqrt.f64 2) B) (sqrt.f64 (*.f64 (-.f64 A (sqrt.f64 (+.f64 (pow.f64 B 2) (pow.f64 A 2)))) F))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (*.f64 (/.f64 (sqrt.f64 2) B) (sqrt.f64 (*.f64 (-.f64 A (sqrt.f64 (+.f64 (pow.f64 B 2) (pow.f64 A 2)))) F))))): 0 points increase in error, 0 points decrease in error
    4. Applied egg-rr36.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq -3.05 \cdot 10^{-18}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}\\ \mathbf{elif}\;B \leq 4.7 \cdot 10^{-110}:\\ \;\;\;\;\frac{-\sqrt{A \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot -16\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)} \cdot \left(-{\left(\frac{B}{\sqrt{2}}\right)}^{-1}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error35.8
Cost20168
\[\begin{array}{l} t_0 := \sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}\\ \mathbf{if}\;B \leq -3.05 \cdot 10^{-18}:\\ \;\;\;\;\frac{t_0}{\frac{B}{\sqrt{2}}}\\ \mathbf{elif}\;B \leq 4.7 \cdot 10^{-110}:\\ \;\;\;\;\frac{-\sqrt{A \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot -16\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2} \cdot t_0}{-B}\\ \end{array} \]
Alternative 2
Error35.8
Cost20168
\[\begin{array}{l} \mathbf{if}\;B \leq -3.05 \cdot 10^{-18}:\\ \;\;\;\;\frac{\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}}{\frac{B}{\sqrt{2}}}\\ \mathbf{elif}\;B \leq 4.7 \cdot 10^{-110}:\\ \;\;\;\;\frac{-\sqrt{A \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot -16\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\\ \end{array} \]
Alternative 3
Error35.8
Cost20168
\[\begin{array}{l} t_0 := \frac{\sqrt{2}}{B}\\ \mathbf{if}\;B \leq -3.05 \cdot 10^{-18}:\\ \;\;\;\;t_0 \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}\\ \mathbf{elif}\;B \leq 4.7 \cdot 10^{-110}:\\ \;\;\;\;\frac{-\sqrt{A \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot -16\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\\ \end{array} \]
Alternative 4
Error35.6
Cost19972
\[\begin{array}{l} \mathbf{if}\;B \leq -9 \cdot 10^{-12}:\\ \;\;\;\;\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}}{B}\\ \mathbf{elif}\;B \leq 1750:\\ \;\;\;\;\frac{-\sqrt{4 \cdot \left(\left(F \cdot A\right) \cdot \left(B \cdot B + C \cdot \left(A \cdot -4\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - B\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)\\ \end{array} \]
Alternative 5
Error35.6
Cost19972
\[\begin{array}{l} \mathbf{if}\;B \leq -9 \cdot 10^{-12}:\\ \;\;\;\;\frac{\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}}{\frac{B}{\sqrt{2}}}\\ \mathbf{elif}\;B \leq 1750:\\ \;\;\;\;\frac{-\sqrt{4 \cdot \left(\left(F \cdot A\right) \cdot \left(B \cdot B + C \cdot \left(A \cdot -4\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - B\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)\\ \end{array} \]
Alternative 6
Error42.1
Cost14732
\[\begin{array}{l} \mathbf{if}\;B \leq -3.05 \cdot 10^{-18}:\\ \;\;\;\;2 \cdot \frac{\sqrt{F \cdot A}}{B}\\ \mathbf{elif}\;B \leq -1.9 \cdot 10^{-229}:\\ \;\;\;\;\frac{-\sqrt{A \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot -16\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\\ \mathbf{elif}\;B \leq 1750:\\ \;\;\;\;\frac{-\sqrt{4 \cdot \left(\left(F \cdot A\right) \cdot \left(B \cdot B + C \cdot \left(A \cdot -4\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - B\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)\\ \end{array} \]
Alternative 7
Error43.0
Cost14420
\[\begin{array}{l} t_0 := A \cdot \left(C \cdot -4\right)\\ t_1 := \sqrt{F \cdot \left(A - B\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)\\ t_2 := \sqrt{F \cdot A}\\ \mathbf{if}\;B \leq -3.05 \cdot 10^{-18}:\\ \;\;\;\;2 \cdot \frac{t_2}{B}\\ \mathbf{elif}\;B \leq 1.25 \cdot 10^{-59}:\\ \;\;\;\;\frac{-\sqrt{A \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot -16\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\\ \mathbf{elif}\;B \leq 7.3 \cdot 10^{+24}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq 1.12 \cdot 10^{+43}:\\ \;\;\;\;-\frac{\sqrt{\left(F \cdot -16\right) \cdot \left(A \cdot \left(A \cdot C\right)\right)}}{t_0}\\ \mathbf{elif}\;B \leq 4.3 \cdot 10^{+59}:\\ \;\;\;\;\frac{t_2 \cdot \left(B \cdot -2\right)}{\mathsf{fma}\left(B, B, t_0\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error44.3
Cost13704
\[\begin{array}{l} \mathbf{if}\;B \leq -2.7 \cdot 10^{+25}:\\ \;\;\;\;2 \cdot \frac{\sqrt{F \cdot A}}{B}\\ \mathbf{elif}\;B \leq 1.25 \cdot 10^{-59}:\\ \;\;\;\;-\frac{\sqrt{\left(F \cdot -16\right) \cdot \left(A \cdot \left(A \cdot C\right)\right)}}{A \cdot \left(C \cdot -4\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - B\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)\\ \end{array} \]
Alternative 9
Error44.5
Cost13640
\[\begin{array}{l} \mathbf{if}\;B \leq -2.7 \cdot 10^{+25}:\\ \;\;\;\;2 \cdot \frac{\sqrt{F \cdot A}}{B}\\ \mathbf{elif}\;B \leq 1.25 \cdot 10^{-59}:\\ \;\;\;\;-\frac{\sqrt{\left(F \cdot -16\right) \cdot \left(A \cdot \left(A \cdot C\right)\right)}}{A \cdot \left(C \cdot -4\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{B \cdot \left(-F\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)\\ \end{array} \]
Alternative 10
Error49.6
Cost7556
\[\begin{array}{l} \mathbf{if}\;B \leq -2.7 \cdot 10^{+25}:\\ \;\;\;\;2 \cdot \frac{\sqrt{F \cdot A}}{B}\\ \mathbf{else}:\\ \;\;\;\;-\frac{\sqrt{\left(F \cdot -16\right) \cdot \left(A \cdot \left(A \cdot C\right)\right)}}{A \cdot \left(C \cdot -4\right)}\\ \end{array} \]
Alternative 11
Error58.5
Cost6980
\[\begin{array}{l} t_0 := \sqrt{F \cdot A}\\ \mathbf{if}\;B \leq -2.25 \cdot 10^{-278}:\\ \;\;\;\;t_0 \cdot \frac{2}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0 \cdot -2}{B}\\ \end{array} \]
Alternative 12
Error58.5
Cost6980
\[\begin{array}{l} t_0 := \sqrt{F \cdot A}\\ \mathbf{if}\;B \leq -2.25 \cdot 10^{-278}:\\ \;\;\;\;\frac{2}{\frac{B}{t_0}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0 \cdot -2}{B}\\ \end{array} \]
Alternative 13
Error58.5
Cost6980
\[\begin{array}{l} t_0 := \sqrt{F \cdot A}\\ \mathbf{if}\;B \leq -2.25 \cdot 10^{-278}:\\ \;\;\;\;2 \cdot \frac{t_0}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0 \cdot -2}{B}\\ \end{array} \]
Alternative 14
Error60.6
Cost6848
\[\frac{\sqrt{F \cdot A} \cdot -2}{B} \]

Error

Reproduce

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