Average Error: 6.4 → 2.1
Time: 5.0s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\frac{y}{t} \cdot \left(z - x\right) + x\]
x + \frac{y \cdot \left(z - x\right)}{t}
\frac{y}{t} \cdot \left(z - x\right) + x
double f(double x, double y, double z, double t) {
        double r331811 = x;
        double r331812 = y;
        double r331813 = z;
        double r331814 = r331813 - r331811;
        double r331815 = r331812 * r331814;
        double r331816 = t;
        double r331817 = r331815 / r331816;
        double r331818 = r331811 + r331817;
        return r331818;
}

double f(double x, double y, double z, double t) {
        double r331819 = y;
        double r331820 = t;
        double r331821 = r331819 / r331820;
        double r331822 = z;
        double r331823 = x;
        double r331824 = r331822 - r331823;
        double r331825 = r331821 * r331824;
        double r331826 = r331825 + r331823;
        return r331826;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.4
Target2.1
Herbie2.1
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Initial program 6.4

    \[x + \frac{y \cdot \left(z - x\right)}{t}\]
  2. Simplified2.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)}\]
  3. Using strategy rm
  4. Applied fma-udef2.1

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

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

Reproduce

herbie shell --seed 2020025 +o rules:numerics
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
  :precision binary64

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

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