Average Error: 9.5 → 0.0
Time: 13.7s
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 r568794 = x;
        double r568795 = y;
        double r568796 = z;
        double r568797 = r568796 - r568794;
        double r568798 = r568795 * r568797;
        double r568799 = r568794 + r568798;
        double r568800 = r568799 / r568796;
        return r568800;
}

double f(double x, double y, double z) {
        double r568801 = x;
        double r568802 = z;
        double r568803 = r568801 / r568802;
        double r568804 = y;
        double r568805 = r568803 + r568804;
        double r568806 = r568803 * r568804;
        double r568807 = r568805 - r568806;
        double r568808 = 0.0;
        double r568809 = r568806 * r568808;
        double r568810 = r568807 + r568809;
        return r568810;
}

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.5
Target0.0
Herbie0.0
\[\left(y + \frac{x}{z}\right) - \frac{y}{\frac{z}{x}}\]

Derivation

  1. Initial program 9.5

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

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

    \[\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-sqrt34.0

    \[\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-diff34.0

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

    \[\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 2019212 +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))