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

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

\end{array}
double f(double x, double y, double z) {
        double r430281 = x;
        double r430282 = y;
        double r430283 = r430282 * r430282;
        double r430284 = z;
        double r430285 = r430284 * r430284;
        double r430286 = r430283 - r430285;
        double r430287 = sqrt(r430286);
        double r430288 = r430281 * r430287;
        return r430288;
}

double f(double x, double y, double __attribute__((unused)) z) {
        double r430289 = y;
        double r430290 = -1.8143615634920972e-270;
        bool r430291 = r430289 <= r430290;
        double r430292 = x;
        double r430293 = -r430289;
        double r430294 = r430292 * r430293;
        double r430295 = r430292 * r430289;
        double r430296 = r430291 ? r430294 : r430295;
        return r430296;
}

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.0
Target0.6
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 < -1.8143615634920972e-270

    1. Initial program 24.9

      \[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 -1.8143615634920972e-270 < y

    1. Initial program 25.0

      \[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 -1.814361563492097218084667841876457735263 \cdot 10^{-270}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

herbie shell --seed 2019326 +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.5816096488251695e-278) (- (* x y)) (* x (* (sqrt (+ y z)) (sqrt (- y z)))))

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