Average Error: 9.0 → 0.1
Time: 2.5s
Precision: 64
\[\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\]
\[\frac{x}{x + 1} \cdot \frac{x}{y} + \frac{x}{x + 1} \cdot 1\]
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\frac{x}{x + 1} \cdot \frac{x}{y} + \frac{x}{x + 1} \cdot 1
double f(double x, double y) {
        double r816858 = x;
        double r816859 = y;
        double r816860 = r816858 / r816859;
        double r816861 = 1.0;
        double r816862 = r816860 + r816861;
        double r816863 = r816858 * r816862;
        double r816864 = r816858 + r816861;
        double r816865 = r816863 / r816864;
        return r816865;
}

double f(double x, double y) {
        double r816866 = x;
        double r816867 = 1.0;
        double r816868 = r816866 + r816867;
        double r816869 = r816866 / r816868;
        double r816870 = y;
        double r816871 = r816866 / r816870;
        double r816872 = r816869 * r816871;
        double r816873 = r816869 * r816867;
        double r816874 = r816872 + r816873;
        return r816874;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original9.0
Target0.1
Herbie0.1
\[\frac{x}{1} \cdot \frac{\frac{x}{y} + 1}{x + 1}\]

Derivation

  1. Initial program 9.0

    \[\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\]
  2. Using strategy rm
  3. Applied associate-/l*0.1

    \[\leadsto \color{blue}{\frac{x}{\frac{x + 1}{\frac{x}{y} + 1}}}\]
  4. Using strategy rm
  5. Applied associate-/r/0.1

    \[\leadsto \color{blue}{\frac{x}{x + 1} \cdot \left(\frac{x}{y} + 1\right)}\]
  6. Using strategy rm
  7. Applied distribute-lft-in0.1

    \[\leadsto \color{blue}{\frac{x}{x + 1} \cdot \frac{x}{y} + \frac{x}{x + 1} \cdot 1}\]
  8. Final simplification0.1

    \[\leadsto \frac{x}{x + 1} \cdot \frac{x}{y} + \frac{x}{x + 1} \cdot 1\]

Reproduce

herbie shell --seed 2020062 +o rules:numerics
(FPCore (x y)
  :name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
  :precision binary64

  :herbie-target
  (* (/ x 1) (/ (+ (/ x y) 1) (+ x 1)))

  (/ (* x (+ (/ x y) 1)) (+ x 1)))