Average Error: 25.8 → 0.9
Time: 9.9s
Precision: 64
\[x \cdot \sqrt{y \cdot y - z \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.576758446294661598578923068565248078396 \cdot 10^{-248}:\\ \;\;\;\;-1 \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]
x \cdot \sqrt{y \cdot y - z \cdot z}
\begin{array}{l}
\mathbf{if}\;y \le -2.576758446294661598578923068565248078396 \cdot 10^{-248}:\\
\;\;\;\;-1 \cdot \left(x \cdot y\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot y\\

\end{array}
double f(double x, double y, double z) {
        double r566615 = x;
        double r566616 = y;
        double r566617 = r566616 * r566616;
        double r566618 = z;
        double r566619 = r566618 * r566618;
        double r566620 = r566617 - r566619;
        double r566621 = sqrt(r566620);
        double r566622 = r566615 * r566621;
        return r566622;
}

double f(double x, double y, double __attribute__((unused)) z) {
        double r566623 = y;
        double r566624 = -2.5767584462946616e-248;
        bool r566625 = r566623 <= r566624;
        double r566626 = -1.0;
        double r566627 = x;
        double r566628 = r566627 * r566623;
        double r566629 = r566626 * r566628;
        double r566630 = r566625 ? r566629 : r566628;
        return r566630;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original25.8
Target0.6
Herbie0.9
\[\begin{array}{l} \mathbf{if}\;y \lt 2.581609648825169508994985860317034908583 \cdot 10^{-278}:\\ \;\;\;\;-x \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\sqrt{y + z} \cdot \sqrt{y - z}\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -2.5767584462946616e-248

    1. Initial program 25.9

      \[x \cdot \sqrt{y \cdot y - z \cdot z}\]
    2. Taylor expanded around -inf 0.6

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot y\right)}\]

    if -2.5767584462946616e-248 < y

    1. Initial program 25.7

      \[x \cdot \sqrt{y \cdot y - z \cdot z}\]
    2. Taylor expanded around inf 1.1

      \[\leadsto x \cdot \color{blue}{y}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.576758446294661598578923068565248078396 \cdot 10^{-248}:\\ \;\;\;\;-1 \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

herbie shell --seed 2019297 
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, B"
  :precision binary64

  :herbie-target
  (if (< y 2.58160964882516951e-278) (- (* x y)) (* x (* (sqrt (+ y z)) (sqrt (- y z)))))

  (* x (sqrt (- (* y y) (* z z)))))