Average Error: 52.5 → 48.2
Time: 24.9s
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{2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)}}{\frac{B \cdot B - \left(4 \cdot A\right) \cdot C}{-\sqrt{\left(A + C\right) + \left(C - A\right)}}}\\ \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 6.449662284749354 \cdot 10^{+150}:\\ \;\;\;\;\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{\sqrt{{\left(A - C\right)}^{2} + B \cdot B}} \cdot \sqrt{\sqrt{{\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:\\ \;\;\;\;\left(-\sqrt{\left(A + C\right) + \left(C - A\right)}\right) \cdot \frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B - \left(4 \cdot A\right) \cdot C\right)\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:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)}}{\frac{B \cdot B - \left(4 \cdot A\right) \cdot C}{-\sqrt{\left(A + C\right) + \left(C - A\right)}}}\\

\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 6.449662284749354 \cdot 10^{+150}:\\
\;\;\;\;\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{\sqrt{{\left(A - C\right)}^{2} + B \cdot B}} \cdot \sqrt{\sqrt{{\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:\\
\;\;\;\;\left(-\sqrt{\left(A + C\right) + \left(C - A\right)}\right) \cdot \frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B - \left(4 \cdot A\right) \cdot C\right)\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 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)))
    (/ (- (* B B) (* (* 4.0 A) C)) (- (sqrt (+ (+ A C) (- C A))))))
   (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)))
        6.449662284749354e+150)
     (/
      (-
       (sqrt
        (*
         (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F))
         (+
          (+ A C)
          (*
           (sqrt (sqrt (+ (pow (- A C) 2.0) (* B B))))
           (sqrt (sqrt (+ (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 (+ (+ A C) (- C A))))
        (/
         (sqrt (* 2.0 (* F (- (* B B) (* (* 4.0 A) C)))))
         (- (* 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 * ((pow(B, 2.0) - ((4.0 * A) * C)) * F)) / (((B * B) - ((4.0 * A) * C)) / -sqrt((A + C) + (C - A)));
	} 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))) <= 6.449662284749354e+150) {
		tmp = -sqrt((2.0 * ((pow(B, 2.0) - ((4.0 * A) * C)) * F)) * ((A + C) + (sqrt(sqrt(pow((A - C), 2.0) + (B * B))) * sqrt(sqrt(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((A + C) + (C - A)) * (sqrt(2.0 * (F * ((B * B) - ((4.0 * A) * C)))) / ((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 4 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. Using strategy rm
    3. Applied sqrt-prod_binary64_316357.6

      \[\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}}}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\]
    4. Applied distribute-rgt-neg-in_binary64_310557.6

      \[\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)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\]
    5. Applied associate-/l*_binary64_309257.6

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

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

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

    1. Initial program 28.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. Using strategy rm
    3. Applied add-sqr-sqrt_binary64_316928.6

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

      \[\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{{\left(A - C\right)}^{2} + B \cdot B}}} \cdot \sqrt{\sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\]
    5. Simplified28.6

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

    if 6.4496622847493542e150 < (/.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.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. Using strategy rm
    3. Applied sqrt-prod_binary64_316353.3

      \[\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}}}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\]
    4. Applied distribute-rgt-neg-in_binary64_310553.3

      \[\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)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\]
    5. Applied associate-/l*_binary64_309253.3

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

      \[\leadsto \frac{\sqrt{2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)}}{\color{blue}{\frac{B \cdot B - C \cdot \left(A \cdot 4\right)}{-\sqrt{\sqrt{{\left(A - C\right)}^{2} + B \cdot B} + \left(A + C\right)}}}}\]
    7. Using strategy rm
    8. Applied associate-/r/_binary64_309353.3

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

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

      \[\leadsto \frac{\sqrt{2 \cdot \left(\left(B \cdot B - C \cdot \left(A \cdot 4\right)\right) \cdot F\right)}}{B \cdot B - C \cdot \left(A \cdot 4\right)} \cdot \left(-\sqrt{\color{blue}{\left(C - A\right)} + \left(A + C\right)}\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. Taylor expanded around -inf 61.2

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

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

Reproduce

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