Average Error: 9.1 → 0.1
Time: 7.6s
Precision: 64
\[\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\]
\[\frac{x}{x + 1} \cdot \frac{x}{y} + 1 \cdot \frac{x}{x + 1}\]
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\frac{x}{x + 1} \cdot \frac{x}{y} + 1 \cdot \frac{x}{x + 1}
double f(double x, double y) {
        double r895445 = x;
        double r895446 = y;
        double r895447 = r895445 / r895446;
        double r895448 = 1.0;
        double r895449 = r895447 + r895448;
        double r895450 = r895445 * r895449;
        double r895451 = r895445 + r895448;
        double r895452 = r895450 / r895451;
        return r895452;
}

double f(double x, double y) {
        double r895453 = x;
        double r895454 = 1.0;
        double r895455 = r895453 + r895454;
        double r895456 = r895453 / r895455;
        double r895457 = y;
        double r895458 = r895453 / r895457;
        double r895459 = r895456 * r895458;
        double r895460 = r895454 * r895456;
        double r895461 = r895459 + r895460;
        return r895461;
}

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.1
Target0.1
Herbie0.1
\[\frac{x}{1} \cdot \frac{\frac{x}{y} + 1}{x + 1}\]

Derivation

  1. Initial program 9.1

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

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

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

Reproduce

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