Average Error: 7.5 → 2.2
Time: 11.0s
Precision: 64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\frac{\frac{x}{t - z}}{y - z}\]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\frac{\frac{x}{t - z}}{y - z}
double f(double x, double y, double z, double t) {
        double r1356376 = x;
        double r1356377 = y;
        double r1356378 = z;
        double r1356379 = r1356377 - r1356378;
        double r1356380 = t;
        double r1356381 = r1356380 - r1356378;
        double r1356382 = r1356379 * r1356381;
        double r1356383 = r1356376 / r1356382;
        return r1356383;
}

double f(double x, double y, double z, double t) {
        double r1356384 = x;
        double r1356385 = t;
        double r1356386 = z;
        double r1356387 = r1356385 - r1356386;
        double r1356388 = r1356384 / r1356387;
        double r1356389 = y;
        double r1356390 = r1356389 - r1356386;
        double r1356391 = r1356388 / r1356390;
        return r1356391;
}

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.5
Target8.4
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.5

    \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
  2. Using strategy rm
  3. Applied *-un-lft-identity7.5

    \[\leadsto \frac{\color{blue}{1 \cdot x}}{\left(y - z\right) \cdot \left(t - z\right)}\]
  4. Applied times-frac2.2

    \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}}\]
  5. Using strategy rm
  6. Applied associate-*l/2.2

    \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{t - z}}{y - z}}\]
  7. Simplified2.2

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

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

Reproduce

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