Average Error: 24.7 → 0.7
Time: 10.7s
Precision: 64
\[x \cdot \sqrt{y \cdot y - z \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;y \le -7.287557259675908303240197014885371553978 \cdot 10^{-253}:\\ \;\;\;\;x \cdot \left(-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 -7.287557259675908303240197014885371553978 \cdot 10^{-253}:\\
\;\;\;\;x \cdot \left(-y\right)\\

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

\end{array}
double f(double x, double y, double z) {
        double r530385 = x;
        double r530386 = y;
        double r530387 = r530386 * r530386;
        double r530388 = z;
        double r530389 = r530388 * r530388;
        double r530390 = r530387 - r530389;
        double r530391 = sqrt(r530390);
        double r530392 = r530385 * r530391;
        return r530392;
}

double f(double x, double y, double __attribute__((unused)) z) {
        double r530393 = y;
        double r530394 = -7.287557259675908e-253;
        bool r530395 = r530393 <= r530394;
        double r530396 = x;
        double r530397 = -r530393;
        double r530398 = r530396 * r530397;
        double r530399 = r530396 * r530393;
        double r530400 = r530395 ? r530398 : r530399;
        return r530400;
}

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

Original24.7
Target0.5
Herbie0.7
\[\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 < -7.287557259675908e-253

    1. Initial program 24.7

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

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

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

    if -7.287557259675908e-253 < y

    1. Initial program 24.8

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

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

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

Reproduce

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