Average Error: 1.8 → 1.8
Time: 17.1s
Precision: 64
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\[\frac{x}{y} \cdot z + \left(t - t \cdot \frac{x}{y}\right)\]
\frac{x}{y} \cdot \left(z - t\right) + t
\frac{x}{y} \cdot z + \left(t - t \cdot \frac{x}{y}\right)
double f(double x, double y, double z, double t) {
        double r286138 = x;
        double r286139 = y;
        double r286140 = r286138 / r286139;
        double r286141 = z;
        double r286142 = t;
        double r286143 = r286141 - r286142;
        double r286144 = r286140 * r286143;
        double r286145 = r286144 + r286142;
        return r286145;
}

double f(double x, double y, double z, double t) {
        double r286146 = x;
        double r286147 = y;
        double r286148 = r286146 / r286147;
        double r286149 = z;
        double r286150 = r286148 * r286149;
        double r286151 = t;
        double r286152 = r286151 * r286148;
        double r286153 = r286151 - r286152;
        double r286154 = r286150 + r286153;
        return r286154;
}

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-lft-in1.8

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

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

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

    \[\leadsto \frac{x}{y} \cdot z + \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))