Average Error: 1.8 → 1.8
Time: 20.2s
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 r349983 = x;
        double r349984 = y;
        double r349985 = r349983 / r349984;
        double r349986 = z;
        double r349987 = t;
        double r349988 = r349986 - r349987;
        double r349989 = r349985 * r349988;
        double r349990 = r349989 + r349987;
        return r349990;
}

double f(double x, double y, double z, double t) {
        double r349991 = z;
        double r349992 = x;
        double r349993 = y;
        double r349994 = r349992 / r349993;
        double r349995 = r349991 * r349994;
        double r349996 = t;
        double r349997 = r349996 * r349994;
        double r349998 = r349996 - r349997;
        double r349999 = r349995 + r349998;
        return r349999;
}

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 z \cdot \frac{x}{y} + \left(t - t \cdot \frac{x}{y}\right)\]

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))