Average Error: 2.0 → 2.0
Time: 17.9s
Precision: 64
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\[z \cdot \frac{x}{y} + \left(t - t \cdot \frac{x}{y}\right)\]
\frac{x}{y} \cdot \left(z - t\right) + t
z \cdot \frac{x}{y} + \left(t - t \cdot \frac{x}{y}\right)
double f(double x, double y, double z, double t) {
        double r355324 = x;
        double r355325 = y;
        double r355326 = r355324 / r355325;
        double r355327 = z;
        double r355328 = t;
        double r355329 = r355327 - r355328;
        double r355330 = r355326 * r355329;
        double r355331 = r355330 + r355328;
        return r355331;
}

double f(double x, double y, double z, double t) {
        double r355332 = z;
        double r355333 = x;
        double r355334 = y;
        double r355335 = r355333 / r355334;
        double r355336 = r355332 * r355335;
        double r355337 = t;
        double r355338 = r355337 * r355335;
        double r355339 = r355337 - r355338;
        double r355340 = r355336 + r355339;
        return r355340;
}

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

Original2.0
Target2.3
Herbie2.0
\[\begin{array}{l} \mathbf{if}\;z \lt 2.759456554562692182563154937894909044548 \cdot 10^{-282}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \mathbf{elif}\;z \lt 2.32699445087443595687739933019129648094 \cdot 10^{-110}:\\ \;\;\;\;x \cdot \frac{z - t}{y} + t\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \end{array}\]

Derivation

  1. Initial program 2.0

    \[\frac{x}{y} \cdot \left(z - t\right) + t\]
  2. Using strategy rm
  3. Applied sub-neg2.0

    \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(z + \left(-t\right)\right)} + t\]
  4. Applied distribute-rgt-in2.0

    \[\leadsto \color{blue}{\left(z \cdot \frac{x}{y} + \left(-t\right) \cdot \frac{x}{y}\right)} + t\]
  5. Applied associate-+l+2.0

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

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

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

Reproduce

herbie shell --seed 2019304 
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
  :precision binary64

  :herbie-target
  (if (< z 2.7594565545626922e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))

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