Average Error: 7.3 → 2.3
Time: 3.2s
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 <= 7.04921950447944e-271)) {
		VAR = ((double) (((double) (x / ((double) (y - z)))) / ((double) (t - z))));
	} else {
		VAR = ((double) (((double) (1.0 / ((double) (y - z)))) * ((double) (x / ((double) (t - z))))));
	}
	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.3
Target8.2
Herbie2.3
\[\]

Derivation

  1. Split input into 2 regimes
  2. if z < 7.0492195044794397e-271

    1. Initial program 7.2

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

      \[\leadsto \]

    if 7.0492195044794397e-271 < z

    1. Initial program 7.5

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

      \[\leadsto \]
    4. Applied times-frac2.0

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

    \[\leadsto \]

Reproduce

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