Average Error: 7.8 → 0.4
Time: 3.5s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z) {
	return ((double) (((double) (((double) cosh(x)) * ((double) (y / x)))) / z));
}
double code(double x, double y, double z) {
	double VAR;
	if (((z <= -4.824673969013898e+58) || !(z <= 2.3322492633980286e-16))) {
		VAR = ((double) (((double) cosh(x)) * ((double) (y / ((double) (z * x))))));
	} else {
		VAR = ((double) (((double) cosh(x)) * ((double) (1.0 / ((double) (z * ((double) (x / y))))))));
	}
	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

Original7.8
Target0.4
Herbie0.4
\[\]

Derivation

  1. Split input into 2 regimes
  2. if z < -4.824673969013898e58 or 2.33224926339802862e-16 < z

    1. Initial program 12.5

      \[\]
    2. Simplified0.3

      \[\leadsto \]

    if -4.824673969013898e58 < z < 2.33224926339802862e-16

    1. Initial program 0.7

      \[\]
    2. Simplified17.6

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

      \[\leadsto \]
    5. Simplified0.6

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020190 
(FPCore (x y z)
  :name "Linear.Quaternion:$ctan from linear-1.19.1.3"
  :precision binary64

  :herbie-target
  (if (< y -4.618902267687042e-52) (* (/ (/ y z) x) (cosh x)) (if (< y 1.0385305359351529e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))

  (/ (* (cosh x) (/ y x)) z))