Average Error: 10.2 → 0.0
Time: 12.6s
Precision: 64
\[\frac{x + y \cdot \left(z - x\right)}{z}\]
\[\frac{x}{z} \cdot \left(1 - y\right) + y\]
\frac{x + y \cdot \left(z - x\right)}{z}
\frac{x}{z} \cdot \left(1 - y\right) + y
double f(double x, double y, double z) {
        double r616979 = x;
        double r616980 = y;
        double r616981 = z;
        double r616982 = r616981 - r616979;
        double r616983 = r616980 * r616982;
        double r616984 = r616979 + r616983;
        double r616985 = r616984 / r616981;
        return r616985;
}

double f(double x, double y, double z) {
        double r616986 = x;
        double r616987 = z;
        double r616988 = r616986 / r616987;
        double r616989 = 1.0;
        double r616990 = y;
        double r616991 = r616989 - r616990;
        double r616992 = r616988 * r616991;
        double r616993 = r616992 + r616990;
        return r616993;
}

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

Derivation

  1. Initial program 10.2

    \[\frac{x + y \cdot \left(z - x\right)}{z}\]
  2. Simplified3.5

    \[\leadsto \color{blue}{y + \frac{x - x \cdot y}{z}}\]
  3. Using strategy rm
  4. Applied clear-num3.6

    \[\leadsto y + \color{blue}{\frac{1}{\frac{z}{x - x \cdot y}}}\]
  5. Using strategy rm
  6. Applied div-inv3.6

    \[\leadsto y + \frac{1}{\color{blue}{z \cdot \frac{1}{x - x \cdot y}}}\]
  7. Applied add-cube-cbrt3.6

    \[\leadsto y + \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{z \cdot \frac{1}{x - x \cdot y}}\]
  8. Applied times-frac3.6

    \[\leadsto y + \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{z} \cdot \frac{\sqrt[3]{1}}{\frac{1}{x - x \cdot y}}}\]
  9. Simplified3.6

    \[\leadsto y + \color{blue}{\frac{1}{z}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{x - x \cdot y}}\]
  10. Simplified3.6

    \[\leadsto y + \frac{1}{z} \cdot \color{blue}{\left(x - x \cdot y\right)}\]
  11. Using strategy rm
  12. Applied sub-neg3.6

    \[\leadsto y + \frac{1}{z} \cdot \color{blue}{\left(x + \left(-x \cdot y\right)\right)}\]
  13. Applied distribute-lft-in3.6

    \[\leadsto y + \color{blue}{\left(\frac{1}{z} \cdot x + \frac{1}{z} \cdot \left(-x \cdot y\right)\right)}\]
  14. Simplified3.5

    \[\leadsto y + \left(\color{blue}{\frac{x}{z}} + \frac{1}{z} \cdot \left(-x \cdot y\right)\right)\]
  15. Simplified0.0

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

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

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

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

Reproduce

herbie shell --seed 2019195 
(FPCore (x y z)
  :name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"

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

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