Average Error: 9.9 → 0.0
Time: 15.3s
Precision: 64
\[\frac{x + y \cdot \left(z - x\right)}{z}\]
\[\left(\left(-y\right) + 1\right) \cdot \frac{x}{z} + y\]
\frac{x + y \cdot \left(z - x\right)}{z}
\left(\left(-y\right) + 1\right) \cdot \frac{x}{z} + y
double f(double x, double y, double z) {
        double r982095 = x;
        double r982096 = y;
        double r982097 = z;
        double r982098 = r982097 - r982095;
        double r982099 = r982096 * r982098;
        double r982100 = r982095 + r982099;
        double r982101 = r982100 / r982097;
        return r982101;
}

double f(double x, double y, double z) {
        double r982102 = y;
        double r982103 = -r982102;
        double r982104 = 1.0;
        double r982105 = r982103 + r982104;
        double r982106 = x;
        double r982107 = z;
        double r982108 = r982106 / r982107;
        double r982109 = r982105 * r982108;
        double r982110 = r982109 + r982102;
        return r982110;
}

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

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

Derivation

  1. Initial program 9.9

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

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

    \[\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.4

    \[\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.4

    \[\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.1

    \[\leadsto \color{blue}{\left(\left(\left(-y\right) + 1\right) \cdot \frac{x}{z} + 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(\left(-y\right) + 1\right) \cdot \frac{x}{z} + y\right) + \color{blue}{0}\]
  9. Final simplification0.0

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

Reproduce

herbie shell --seed 2019351 +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))