Average Error: 7.7 → 0.3
Time: 3.3s
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 <= -5.773158360993168) || !(z <= 8329338495069279.0))) {
		VAR = ((double) (((double) cosh(x)) * ((double) (y * ((double) (1.0 / ((double) (z * x))))))));
	} else {
		VAR = ((double) (((double) (((double) cosh(x)) * ((double) (y / z)))) / x));
	}
	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.7
Target0.5
Herbie0.3
\[\]

Derivation

  1. Split input into 2 regimes
  2. if z < -5.7731583609931683 or 8329338495069279 < z

    1. Initial program 12.0

      \[\]
    2. Simplified0.3

      \[\leadsto \]
    3. Using strategy rm
    4. Applied div-inv0.4

      \[\leadsto \]

    if -5.7731583609931683 < z < 8329338495069279

    1. Initial program 0.3

      \[\]
    2. Simplified19.1

      \[\leadsto \]
    3. Using strategy rm
    4. Applied *-un-lft-identity19.1

      \[\leadsto \]
    5. Applied times-frac0.4

      \[\leadsto \]
    6. Applied associate-*r*0.4

      \[\leadsto \]
    7. Simplified0.4

      \[\leadsto \]
    8. Using strategy rm
    9. Applied associate-*l/0.3

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

    \[\leadsto \]

Reproduce

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