Average Error: 7.3 → 2.2
Time: 11.3s
Precision: 64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\frac{1}{y - z} \cdot \frac{x}{t - z}\]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\frac{1}{y - z} \cdot \frac{x}{t - z}
double f(double x, double y, double z, double t) {
        double r1223908 = x;
        double r1223909 = y;
        double r1223910 = z;
        double r1223911 = r1223909 - r1223910;
        double r1223912 = t;
        double r1223913 = r1223912 - r1223910;
        double r1223914 = r1223911 * r1223913;
        double r1223915 = r1223908 / r1223914;
        return r1223915;
}

double f(double x, double y, double z, double t) {
        double r1223916 = 1.0;
        double r1223917 = y;
        double r1223918 = z;
        double r1223919 = r1223917 - r1223918;
        double r1223920 = r1223916 / r1223919;
        double r1223921 = x;
        double r1223922 = t;
        double r1223923 = r1223922 - r1223918;
        double r1223924 = r1223921 / r1223923;
        double r1223925 = r1223920 * r1223924;
        return r1223925;
}

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
Target7.8
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 *-un-lft-identity7.3

    \[\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. Final simplification2.2

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

Reproduce

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