Average Error: 24.4 → 0.8
Time: 18.6s
Precision: 64
\[x \cdot \sqrt{y \cdot y - z \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;y \le -5.361090024927945737200223454493579227102 \cdot 10^{-259}:\\ \;\;\;\;\left(-x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]
x \cdot \sqrt{y \cdot y - z \cdot z}
\begin{array}{l}
\mathbf{if}\;y \le -5.361090024927945737200223454493579227102 \cdot 10^{-259}:\\
\;\;\;\;\left(-x\right) \cdot y\\

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

\end{array}
double f(double x, double y, double z) {
        double r27518754 = x;
        double r27518755 = y;
        double r27518756 = r27518755 * r27518755;
        double r27518757 = z;
        double r27518758 = r27518757 * r27518757;
        double r27518759 = r27518756 - r27518758;
        double r27518760 = sqrt(r27518759);
        double r27518761 = r27518754 * r27518760;
        return r27518761;
}

double f(double x, double y, double __attribute__((unused)) z) {
        double r27518762 = y;
        double r27518763 = -5.361090024927946e-259;
        bool r27518764 = r27518762 <= r27518763;
        double r27518765 = x;
        double r27518766 = -r27518765;
        double r27518767 = r27518766 * r27518762;
        double r27518768 = r27518765 * r27518762;
        double r27518769 = r27518764 ? r27518767 : r27518768;
        return r27518769;
}

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.4
Target0.6
Herbie0.8
\[\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 < -5.361090024927946e-259

    1. Initial program 24.2

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

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

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

    if -5.361090024927946e-259 < y

    1. Initial program 24.6

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

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

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

Reproduce

herbie shell --seed 2019169 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, B"

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

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