Average Error: 10.3 → 0.0
Time: 10.6s
Precision: 64
\[\frac{x + y \cdot \left(z - x\right)}{z}\]
\[\left(\left(\frac{x}{z} + y\right) - \frac{x}{z} \cdot y\right) + \left(\frac{x}{z} \cdot y\right) \cdot 0\]
\frac{x + y \cdot \left(z - x\right)}{z}
\left(\left(\frac{x}{z} + y\right) - \frac{x}{z} \cdot y\right) + \left(\frac{x}{z} \cdot y\right) \cdot 0
double f(double x, double y, double z) {
        double r1230389 = x;
        double r1230390 = y;
        double r1230391 = z;
        double r1230392 = r1230391 - r1230389;
        double r1230393 = r1230390 * r1230392;
        double r1230394 = r1230389 + r1230393;
        double r1230395 = r1230394 / r1230391;
        return r1230395;
}

double f(double x, double y, double z) {
        double r1230396 = x;
        double r1230397 = z;
        double r1230398 = r1230396 / r1230397;
        double r1230399 = y;
        double r1230400 = r1230398 + r1230399;
        double r1230401 = r1230398 * r1230399;
        double r1230402 = r1230400 - r1230401;
        double r1230403 = 0.0;
        double r1230404 = r1230401 * r1230403;
        double r1230405 = r1230402 + r1230404;
        return r1230405;
}

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

Original10.3
Target0.0
Herbie0.0
\[\left(y + \frac{x}{z}\right) - \frac{y}{\frac{z}{x}}\]

Derivation

  1. Initial program 10.3

    \[\frac{x + y \cdot \left(z - x\right)}{z}\]
  2. Taylor expanded around 0 3.5

    \[\leadsto \color{blue}{\left(\frac{x}{z} + y\right) - \frac{x \cdot y}{z}}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt3.6

    \[\leadsto \left(\frac{x}{z} + y\right) - \color{blue}{\left(\sqrt[3]{\frac{x \cdot y}{z}} \cdot \sqrt[3]{\frac{x \cdot y}{z}}\right) \cdot \sqrt[3]{\frac{x \cdot y}{z}}}\]
  5. Applied add-sqr-sqrt33.9

    \[\leadsto \color{blue}{\sqrt{\frac{x}{z} + y} \cdot \sqrt{\frac{x}{z} + y}} - \left(\sqrt[3]{\frac{x \cdot y}{z}} \cdot \sqrt[3]{\frac{x \cdot y}{z}}\right) \cdot \sqrt[3]{\frac{x \cdot y}{z}}\]
  6. Applied prod-diff33.9

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{\frac{x}{z} + y}, \sqrt{\frac{x}{z} + y}, -\sqrt[3]{\frac{x \cdot y}{z}} \cdot \left(\sqrt[3]{\frac{x \cdot y}{z}} \cdot \sqrt[3]{\frac{x \cdot y}{z}}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{\frac{x \cdot y}{z}}, \sqrt[3]{\frac{x \cdot y}{z}} \cdot \sqrt[3]{\frac{x \cdot y}{z}}, \sqrt[3]{\frac{x \cdot y}{z}} \cdot \left(\sqrt[3]{\frac{x \cdot y}{z}} \cdot \sqrt[3]{\frac{x \cdot y}{z}}\right)\right)}\]
  7. Simplified3.5

    \[\leadsto \color{blue}{\left(\left(\frac{x}{z} + y\right) - \frac{x}{z} \cdot y\right)} + \mathsf{fma}\left(-\sqrt[3]{\frac{x \cdot y}{z}}, \sqrt[3]{\frac{x \cdot y}{z}} \cdot \sqrt[3]{\frac{x \cdot y}{z}}, \sqrt[3]{\frac{x \cdot y}{z}} \cdot \left(\sqrt[3]{\frac{x \cdot y}{z}} \cdot \sqrt[3]{\frac{x \cdot y}{z}}\right)\right)\]
  8. Simplified0.0

    \[\leadsto \left(\left(\frac{x}{z} + y\right) - \frac{x}{z} \cdot y\right) + \color{blue}{\left(\frac{x}{z} \cdot y\right) \cdot 0}\]
  9. Final simplification0.0

    \[\leadsto \left(\left(\frac{x}{z} + y\right) - \frac{x}{z} \cdot y\right) + \left(\frac{x}{z} \cdot y\right) \cdot 0\]

Reproduce

herbie shell --seed 2019235 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
  :precision binary64

  :herbie-target
  (- (+ y (/ x z)) (/ y (/ z x)))

  (/ (+ x (* y (- z x))) z))