Average Error: 25.2 → 1.1
Time: 11.9s
Precision: 64
\[x \cdot \sqrt{y \cdot y - z \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.340986277535991647306212898834677817035 \cdot 10^{-210}:\\ \;\;\;\;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 -2.340986277535991647306212898834677817035 \cdot 10^{-210}:\\
\;\;\;\;x \cdot \left(-y\right)\\

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

\end{array}
double f(double x, double y, double z) {
        double r448163 = x;
        double r448164 = y;
        double r448165 = r448164 * r448164;
        double r448166 = z;
        double r448167 = r448166 * r448166;
        double r448168 = r448165 - r448167;
        double r448169 = sqrt(r448168);
        double r448170 = r448163 * r448169;
        return r448170;
}

double f(double x, double y, double __attribute__((unused)) z) {
        double r448171 = y;
        double r448172 = -2.3409862775359916e-210;
        bool r448173 = r448171 <= r448172;
        double r448174 = x;
        double r448175 = -r448171;
        double r448176 = r448174 * r448175;
        double r448177 = r448174 * r448171;
        double r448178 = r448173 ? r448176 : r448177;
        return r448178;
}

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.2
Target0.6
Herbie1.1
\[\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.3409862775359916e-210

    1. Initial program 24.6

      \[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 -2.3409862775359916e-210 < y

    1. Initial program 25.7

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

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

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

Reproduce

herbie shell --seed 2019235 +o rules:numerics
(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)))))