Average Error: 52.3 → 50.1
Time: 1.3min
Precision: binary64
\[\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:\\ \;\;\;\;\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(A - C\right)\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 3.8369966365531237 \cdot 10^{+272}:\\ \;\;\;\;\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]{\sqrt{{\left(A - C\right)}^{2} + B \cdot B}} \cdot \sqrt[3]{\sqrt{{\left(A - C\right)}^{2} + B \cdot B}}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{{B}^{2} - \left(4 \cdot A\right) \cdot 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}\;\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:\\
\;\;\;\;\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(A - C\right)\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 3.8369966365531237 \cdot 10^{+272}:\\
\;\;\;\;\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]{\sqrt{{\left(A - C\right)}^{2} + B \cdot B}} \cdot \sqrt[3]{\sqrt{{\left(A - C\right)}^{2} + B \cdot B}}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\

\mathbf{else}:\\
\;\;\;\;\frac{0}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\

\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 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (- (+ A C) (- A C)))))
    (- (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)))
        3.8369966365531237e+272)
     (/
      (-
       (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 (sqrt (+ (pow (- A C) 2.0) (* B B))))
             (cbrt (sqrt (+ (pow (- A C) 2.0) (* B B)))))))))))
      (- (pow B 2.0) (* (* 4.0 A) C)))
     (/ 0.0 (- (pow B 2.0) (* (* 4.0 A) C))))))
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 * ((pow(B, 2.0) - ((4.0 * A) * C)) * F)) * ((A + C) - (A - C))) / (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))) <= 3.8369966365531237e+272) {
		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(sqrt(pow((A - C), 2.0) + (B * B))) * cbrt(sqrt(pow((A - C), 2.0) + (B * B))))))) / (pow(B, 2.0) - ((4.0 * A) * C));
	} else {
		tmp = 0.0 / (pow(B, 2.0) - ((4.0 * A) * C));
	}
	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

    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 58.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 + C\right) - \color{blue}{\left(A - C\right)}\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))) < 3.83699663655312369e272

    1. Initial program 26.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 add-cube-cbrt_binary64_250026.9

      \[\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_248126.9

      \[\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. Simplified26.9

      \[\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. Simplified26.9

      \[\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}\]
    7. Using strategy rm
    8. Applied add-sqr-sqrt_binary64_248726.9

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

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

    if 3.83699663655312369e272 < (/.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 0 61.5

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

    \[\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:\\ \;\;\;\;\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(A - C\right)\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 3.8369966365531237 \cdot 10^{+272}:\\ \;\;\;\;\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]{\sqrt{{\left(A - C\right)}^{2} + B \cdot B}} \cdot \sqrt[3]{\sqrt{{\left(A - C\right)}^{2} + B \cdot B}}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\ \end{array}\]

Reproduce

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