Average Error: 52.2 → 44.5
Time: 16.8s
Precision: binary64
[A C]: =sort([A C])
\[\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}\;\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{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq -\infty:\\ \;\;\;\;\sqrt{2 \cdot \left(F \cdot \left(B \cdot B - \left(4 \cdot A\right) \cdot C\right)\right)} \cdot \frac{-\sqrt{\left(A + C\right) + \left(C - A\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}\\ \mathbf{elif}\;\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{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq 7.184546465676352 \cdot 10^{-195}:\\ \;\;\;\;\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) + \left|\sqrt[3]{{\left(A - C\right)}^{2} + B \cdot B}\right| \cdot \sqrt{\sqrt[3]{{\left(A - C\right)}^{2} + B \cdot B}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\ \mathbf{elif}\;\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{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq \infty:\\ \;\;\;\;\sqrt{2 \cdot \left(F \cdot \left(B \cdot B - \left(4 \cdot A\right) \cdot C\right)\right)} \cdot \frac{-\sqrt{\left(A + C\right) + \left(C - A\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}\\ \mathbf{else}:\\ \;\;\;\;0\\ \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}\;\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{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq -\infty:\\
\;\;\;\;\sqrt{2 \cdot \left(F \cdot \left(B \cdot B - \left(4 \cdot A\right) \cdot C\right)\right)} \cdot \frac{-\sqrt{\left(A + C\right) + \left(C - A\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}\\

\mathbf{elif}\;\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{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq 7.184546465676352 \cdot 10^{-195}:\\
\;\;\;\;\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) + \left|\sqrt[3]{{\left(A - C\right)}^{2} + B \cdot B}\right| \cdot \sqrt{\sqrt[3]{{\left(A - C\right)}^{2} + B \cdot B}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\

\mathbf{elif}\;\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{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq \infty:\\
\;\;\;\;\sqrt{2 \cdot \left(F \cdot \left(B \cdot B - \left(4 \cdot A\right) \cdot C\right)\right)} \cdot \frac{-\sqrt{\left(A + C\right) + \left(C - A\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}\\

\mathbf{else}:\\
\;\;\;\;0\\

\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 (<=
      (/
       (-
        (sqrt
         (*
          (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F))
          (+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
       (- (pow B 2.0) (* (* 4.0 A) C)))
      (- INFINITY))
   (*
    (sqrt (* 2.0 (* F (- (* B B) (* (* 4.0 A) C)))))
    (/ (- (sqrt (+ (+ A C) (- C A)))) (- (* B B) (* (* 4.0 A) C))))
   (if (<=
        (/
         (-
          (sqrt
           (*
            (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F))
            (+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
         (- (pow B 2.0) (* (* 4.0 A) C)))
        7.184546465676352e-195)
     (/
      (-
       (sqrt
        (*
         (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F))
         (+
          (+ A C)
          (*
           (fabs (cbrt (+ (pow (- A C) 2.0) (* B B))))
           (sqrt (cbrt (+ (pow (- A C) 2.0) (* B B)))))))))
      (- (pow B 2.0) (* (* 4.0 A) C)))
     (if (<=
          (/
           (-
            (sqrt
             (*
              (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F))
              (+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
           (- (pow B 2.0) (* (* 4.0 A) C)))
          INFINITY)
       (*
        (sqrt (* 2.0 (* F (- (* B B) (* (* 4.0 A) C)))))
        (/ (- (sqrt (+ (+ A C) (- C A)))) (- (* B B) (* (* 4.0 A) C))))
       0.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 ((-sqrt((2.0 * ((pow(B, 2.0) - ((4.0 * A) * C)) * F)) * ((A + C) + sqrt(pow(B, 2.0) + pow((A - C), 2.0)))) / (pow(B, 2.0) - ((4.0 * A) * C))) <= -((double) INFINITY)) {
		tmp = sqrt(2.0 * (F * ((B * B) - ((4.0 * A) * C)))) * (-sqrt((A + C) + (C - A)) / ((B * B) - ((4.0 * A) * C)));
	} else if ((-sqrt((2.0 * ((pow(B, 2.0) - ((4.0 * A) * C)) * F)) * ((A + C) + sqrt(pow(B, 2.0) + pow((A - C), 2.0)))) / (pow(B, 2.0) - ((4.0 * A) * C))) <= 7.184546465676352e-195) {
		tmp = -sqrt((2.0 * ((pow(B, 2.0) - ((4.0 * A) * C)) * F)) * ((A + C) + (fabs(cbrt(pow((A - C), 2.0) + (B * B))) * sqrt(cbrt(pow((A - C), 2.0) + (B * B)))))) / (pow(B, 2.0) - ((4.0 * A) * C));
	} else if ((-sqrt((2.0 * ((pow(B, 2.0) - ((4.0 * A) * C)) * F)) * ((A + C) + sqrt(pow(B, 2.0) + pow((A - C), 2.0)))) / (pow(B, 2.0) - ((4.0 * A) * C))) <= ((double) INFINITY)) {
		tmp = sqrt(2.0 * (F * ((B * B) - ((4.0 * A) * C)))) * (-sqrt((A + C) + (C - A)) / ((B * B) - ((4.0 * A) * C)));
	} else {
		tmp = 0.0;
	}
	return tmp;
}

Error

Bits error versus A

Bits error versus B

Bits error versus C

Bits error versus F

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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))) < -inf.0 or 7.1845464656763516e-195 < (/.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 56.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. Using strategy rm
    3. Applied *-un-lft-identity_binary64_314756.8

      \[\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 + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{\color{blue}{1 \cdot \left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)}}\]
    4. Applied sqrt-prod_binary64_316351.9

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

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

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

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

      \[\leadsto \sqrt{2 \cdot \left(\left(B \cdot B - C \cdot \left(A \cdot 4\right)\right) \cdot F\right)} \cdot \color{blue}{\frac{-\sqrt{\sqrt{{\left(A - C\right)}^{2} + B \cdot B} + \left(A + C\right)}}{B \cdot B - C \cdot \left(A \cdot 4\right)}}\]
    9. Taylor expanded around -inf 34.2

      \[\leadsto \sqrt{2 \cdot \left(\left(B \cdot B - C \cdot \left(A \cdot 4\right)\right) \cdot F\right)} \cdot \frac{-\sqrt{\color{blue}{\left(C - A\right)} + \left(A + C\right)}}{B \cdot B - C \cdot \left(A \cdot 4\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))) < 7.1845464656763516e-195

    1. Initial program 30.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. Using strategy rm
    3. Applied add-cube-cbrt_binary64_318230.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 + C\right) + \sqrt{\color{blue}{\left(\sqrt[3]{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \sqrt[3]{{\left(A - C\right)}^{2} + {B}^{2}}\right) \cdot \sqrt[3]{{\left(A - C\right)}^{2} + {B}^{2}}}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\]
    4. Applied sqrt-prod_binary64_316330.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 + C\right) + \color{blue}{\sqrt{\sqrt[3]{{\left(A - C\right)}^{2} + {B}^{2}} \cdot \sqrt[3]{{\left(A - C\right)}^{2} + {B}^{2}}} \cdot \sqrt{\sqrt[3]{{\left(A - C\right)}^{2} + {B}^{2}}}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\]
    5. Simplified30.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 + C\right) + \color{blue}{\left|\sqrt[3]{{\left(A - C\right)}^{2} + B \cdot B}\right|} \cdot \sqrt{\sqrt[3]{{\left(A - C\right)}^{2} + {B}^{2}}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\]
    6. Simplified30.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 + C\right) + \left|\sqrt[3]{{\left(A - C\right)}^{2} + B \cdot B}\right| \cdot \color{blue}{\sqrt{\sqrt[3]{{\left(A - C\right)}^{2} + B \cdot B}}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\]

    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. Taylor expanded around -inf 61.2

      \[\leadsto \color{blue}{0}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification44.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;\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{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq -\infty:\\ \;\;\;\;\sqrt{2 \cdot \left(F \cdot \left(B \cdot B - \left(4 \cdot A\right) \cdot C\right)\right)} \cdot \frac{-\sqrt{\left(A + C\right) + \left(C - A\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}\\ \mathbf{elif}\;\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{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq 7.184546465676352 \cdot 10^{-195}:\\ \;\;\;\;\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) + \left|\sqrt[3]{{\left(A - C\right)}^{2} + B \cdot B}\right| \cdot \sqrt{\sqrt[3]{{\left(A - C\right)}^{2} + B \cdot B}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\ \mathbf{elif}\;\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{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq \infty:\\ \;\;\;\;\sqrt{2 \cdot \left(F \cdot \left(B \cdot B - \left(4 \cdot A\right) \cdot C\right)\right)} \cdot \frac{-\sqrt{\left(A + C\right) + \left(C - A\right)}}{B \cdot B - \left(4 \cdot A\right) \cdot C}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]

Reproduce

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