Average Error: 7.6 → 2.2
Time: 3.4s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z, double t) {
	return ((double) (x / ((double) (((double) (y - z)) * ((double) (t - z))))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((z <= -4.715925227576331e-242)) {
		VAR = ((double) (((double) (x / ((double) (y - z)))) / ((double) (t - z))));
	} else {
		double VAR_1;
		if ((z <= 8.900490363783676e-162)) {
			VAR_1 = ((double) (x / ((double) (((double) (((double) (y - z)) * t)) + ((double) (z * ((double) (z - y))))))));
		} else {
			VAR_1 = ((double) (((double) (1.0 / ((double) (y - z)))) * ((double) (x * ((double) (1.0 / ((double) (t - z))))))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.4
Herbie2.2
\[\]

Derivation

  1. Split input into 3 regimes
  2. if z < -4.7159252275763314e-242

    1. Initial program 7.4

      \[\]
    2. Using strategy rm
    3. Applied associate-/r*1.5

      \[\leadsto \]

    if -4.7159252275763314e-242 < z < 8.90049036378367575e-162

    1. Initial program 6.5

      \[\]
    2. Using strategy rm
    3. Applied sub-neg6.5

      \[\leadsto \]
    4. Applied distribute-lft-in6.5

      \[\leadsto \]
    5. Simplified6.5

      \[\leadsto \]

    if 8.90049036378367575e-162 < z

    1. Initial program 8.2

      \[\]
    2. Using strategy rm
    3. Applied *-un-lft-identity8.2

      \[\leadsto \]
    4. Applied times-frac1.1

      \[\leadsto \]
    5. Using strategy rm
    6. Applied div-inv1.2

      \[\leadsto \]
  3. Recombined 3 regimes into one program.
  4. Final simplification2.2

    \[\leadsto \]

Reproduce

herbie shell --seed 2020192 
(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.0 (* (- y z) (- t z)))))

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