Average Error: 7.3 → 2.2
Time: 12.4s
Precision: 64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\frac{x}{y - z} \cdot \frac{1}{t - z}\]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\frac{x}{y - z} \cdot \frac{1}{t - z}
double f(double x, double y, double z, double t) {
        double r816986 = x;
        double r816987 = y;
        double r816988 = z;
        double r816989 = r816987 - r816988;
        double r816990 = t;
        double r816991 = r816990 - r816988;
        double r816992 = r816989 * r816991;
        double r816993 = r816986 / r816992;
        return r816993;
}

double f(double x, double y, double z, double t) {
        double r816994 = x;
        double r816995 = y;
        double r816996 = z;
        double r816997 = r816995 - r816996;
        double r816998 = r816994 / r816997;
        double r816999 = 1.0;
        double r817000 = t;
        double r817001 = r817000 - r816996;
        double r817002 = r816999 / r817001;
        double r817003 = r816998 * r817002;
        return r817003;
}

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

Original7.3
Target8.1
Herbie2.2
\[\begin{array}{l} \mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \lt 0.0:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{\left(y - z\right) \cdot \left(t - z\right)}\\ \end{array}\]

Derivation

  1. Initial program 7.3

    \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
  2. Using strategy rm
  3. Applied associate-/r*2.1

    \[\leadsto \color{blue}{\frac{\frac{x}{y - z}}{t - z}}\]
  4. Using strategy rm
  5. Applied div-inv2.2

    \[\leadsto \color{blue}{\frac{x}{y - z} \cdot \frac{1}{t - z}}\]
  6. Final simplification2.2

    \[\leadsto \frac{x}{y - z} \cdot \frac{1}{t - z}\]

Reproduce

herbie shell --seed 2019350 
(FPCore (x y z t)
  :name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, B"
  :precision binary64

  :herbie-target
  (if (< (/ x (* (- y z) (- t z))) 0.0) (/ (/ x (- y z)) (- t z)) (* x (/ 1 (* (- y z) (- t z)))))

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