Average Error: 1.8 → 1.8
Time: 9.6s
Precision: 64
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\frac{x}{y} \cdot \left(z - t\right) + t
\frac{x}{y} \cdot \left(z - t\right) + t
double f(double x, double y, double z, double t) {
        double r353384 = x;
        double r353385 = y;
        double r353386 = r353384 / r353385;
        double r353387 = z;
        double r353388 = t;
        double r353389 = r353387 - r353388;
        double r353390 = r353386 * r353389;
        double r353391 = r353390 + r353388;
        return r353391;
}

double f(double x, double y, double z, double t) {
        double r353392 = x;
        double r353393 = y;
        double r353394 = r353392 / r353393;
        double r353395 = z;
        double r353396 = t;
        double r353397 = r353395 - r353396;
        double r353398 = r353394 * r353397;
        double r353399 = r353398 + r353396;
        return r353399;
}

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

Original1.8
Target2.0
Herbie1.8
\[\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 1.8

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019303 
(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))