Average Error: 3.5 → 0.3
Time: 2.6s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z) {
	return ((double) (x * ((double) (1.0 - ((double) (((double) (1.0 - y)) * z))))));
}
double code(double x, double y, double z) {
	double VAR;
	if (((z <= -3.628128241651189e-16) || !(z <= 5.342086898725273e-113))) {
		VAR = ((double) (((double) (x * 1.0)) + ((double) (((double) (z * x)) * ((double) (y - 1.0))))));
	} else {
		VAR = ((double) (((double) (x * 1.0)) + ((double) (x * ((double) (z * ((double) (y - 1.0))))))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original3.5
Target0.2
Herbie0.3
\[\]

Derivation

  1. Split input into 2 regimes
  2. if z < -3.628128241651189e-16 or 5.34208689872527273e-113 < z

    1. Initial program 6.7

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

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

      \[\leadsto \]
    5. Simplified6.7

      \[\leadsto \]
    6. Using strategy rm
    7. Applied associate-*r*0.5

      \[\leadsto \]

    if -3.628128241651189e-16 < z < 5.34208689872527273e-113

    1. Initial program 0.1

      \[\]
    2. Using strategy rm
    3. Applied sub-neg0.1

      \[\leadsto \]
    4. Applied distribute-lft-in0.1

      \[\leadsto \]
    5. Simplified0.1

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020190 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, J"
  :precision binary64

  :herbie-target
  (if (< (* x (- 1.0 (* (- 1.0 y) z))) -1.618195973607049e+50) (+ x (* (- 1.0 y) (* (neg z) x))) (if (< (* x (- 1.0 (* (- 1.0 y) z))) 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) (+ x (* (- 1.0 y) (* (neg z) x)))))

  (* x (- 1.0 (* (- 1.0 y) z))))