Average Error: 7.6 → 2.1
Time: 17.2s
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 r37600513 = x;
        double r37600514 = y;
        double r37600515 = z;
        double r37600516 = r37600514 - r37600515;
        double r37600517 = t;
        double r37600518 = r37600517 - r37600515;
        double r37600519 = r37600516 * r37600518;
        double r37600520 = r37600513 / r37600519;
        return r37600520;
}

double f(double x, double y, double z, double t) {
        double r37600521 = x;
        double r37600522 = t;
        double r37600523 = z;
        double r37600524 = r37600522 - r37600523;
        double r37600525 = r37600521 / r37600524;
        double r37600526 = y;
        double r37600527 = r37600526 - r37600523;
        double r37600528 = r37600525 / r37600527;
        return r37600528;
}

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.6
Target8.1
Herbie2.1
\[\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.6

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

    \[\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.1

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

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

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

Reproduce

herbie shell --seed 2019170 +o rules:numerics
(FPCore (x y z t)
  :name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, B"

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

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