Average Error: 24.7 → 9.1
Time: 10.9s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z, double t, double a) {
	return ((double) (x + ((double) (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z))))));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if (((a <= -2.39424874483831e-107) || !(a <= 9.99656078994344e-119))) {
		VAR = ((double) (x + ((double) (((double) (((double) (y - z)) / ((double) (a - z)))) * ((double) (t - x))))));
	} else {
		VAR = ((double) (t + ((double) (((double) (y / z)) * ((double) (x - t))))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original24.7
Target11.9
Herbie9.1
\[\]

Derivation

  1. Split input into 2 regimes
  2. if a < -2.3942487448383101e-107 or 9.9965607899434403e-119 < a

    1. Initial program 22.7

      \[\]
    2. Simplified11.0

      \[\leadsto \]
    3. Using strategy rm
    4. Applied clear-num11.3

      \[\leadsto \]
    5. Using strategy rm
    6. Applied associate-/r/11.0

      \[\leadsto \]
    7. Applied associate-*r*8.7

      \[\leadsto \]
    8. Simplified8.6

      \[\leadsto \]

    if -2.3942487448383101e-107 < a < 9.9965607899434403e-119

    1. Initial program 29.5

      \[\]
    2. Simplified24.4

      \[\leadsto \]
    3. Taylor expanded around inf 15.4

      \[\leadsto \]
    4. Simplified10.4

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020179 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< z -1.2536131056095036e+188) (- t (* (/ y z) (- t x))) (if (< z 4.446702369113811e+64) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x)))))

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