Average Error: 7.5 → 0.4
Time: 3.5s
Precision: 64
\[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
\[\begin{array}{l} \mathbf{if}\;y \le -5.69050507587288648 \cdot 10^{36}:\\ \;\;\;\;\cosh x \cdot \frac{y}{x \cdot z}\\ \mathbf{elif}\;y \le 1.53812960369040041 \cdot 10^{30}:\\ \;\;\;\;\frac{\cosh x \cdot \frac{y}{x}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\cosh x \cdot y}{z}}{x}\\ \end{array}\]
\frac{\cosh x \cdot \frac{y}{x}}{z}
\begin{array}{l}
\mathbf{if}\;y \le -5.69050507587288648 \cdot 10^{36}:\\
\;\;\;\;\cosh x \cdot \frac{y}{x \cdot z}\\

\mathbf{elif}\;y \le 1.53812960369040041 \cdot 10^{30}:\\
\;\;\;\;\frac{\cosh x \cdot \frac{y}{x}}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{z}}{x}\\

\end{array}
double code(double x, double y, double z) {
	return ((cosh(x) * (y / x)) / z);
}
double code(double x, double y, double z) {
	double VAR;
	if ((y <= -5.690505075872886e+36)) {
		VAR = (cosh(x) * (y / (x * z)));
	} else {
		double VAR_1;
		if ((y <= 1.5381296036904004e+30)) {
			VAR_1 = ((cosh(x) * (y / x)) / z);
		} else {
			VAR_1 = (((cosh(x) * y) / z) / x);
		}
		VAR = VAR_1;
	}
	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.5
Target0.4
Herbie0.4
\[\begin{array}{l} \mathbf{if}\;y \lt -4.618902267687042 \cdot 10^{-52}:\\ \;\;\;\;\frac{\frac{y}{z}}{x} \cdot \cosh x\\ \mathbf{elif}\;y \lt 1.0385305359351529 \cdot 10^{-39}:\\ \;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{z}}{x} \cdot \cosh x\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if y < -5.690505075872886e+36

    1. Initial program 25.2

      \[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity25.2

      \[\leadsto \frac{\cosh x \cdot \frac{y}{x}}{\color{blue}{1 \cdot z}}\]
    4. Applied times-frac25.1

      \[\leadsto \color{blue}{\frac{\cosh x}{1} \cdot \frac{\frac{y}{x}}{z}}\]
    5. Simplified25.1

      \[\leadsto \color{blue}{\cosh x} \cdot \frac{\frac{y}{x}}{z}\]
    6. Simplified0.3

      \[\leadsto \cosh x \cdot \color{blue}{\frac{y}{x \cdot z}}\]

    if -5.690505075872886e+36 < y < 1.5381296036904004e+30

    1. Initial program 0.5

      \[\frac{\cosh x \cdot \frac{y}{x}}{z}\]

    if 1.5381296036904004e+30 < y

    1. Initial program 23.6

      \[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
    2. Using strategy rm
    3. Applied div-inv23.6

      \[\leadsto \color{blue}{\left(\cosh x \cdot \frac{y}{x}\right) \cdot \frac{1}{z}}\]
    4. Using strategy rm
    5. Applied associate-*r/23.6

      \[\leadsto \color{blue}{\frac{\cosh x \cdot y}{x}} \cdot \frac{1}{z}\]
    6. Applied associate-*l/0.4

      \[\leadsto \color{blue}{\frac{\left(\cosh x \cdot y\right) \cdot \frac{1}{z}}{x}}\]
    7. Simplified0.3

      \[\leadsto \frac{\color{blue}{\frac{\cosh x \cdot y}{z}}}{x}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -5.69050507587288648 \cdot 10^{36}:\\ \;\;\;\;\cosh x \cdot \frac{y}{x \cdot z}\\ \mathbf{elif}\;y \le 1.53812960369040041 \cdot 10^{30}:\\ \;\;\;\;\frac{\cosh x \cdot \frac{y}{x}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\cosh x \cdot y}{z}}{x}\\ \end{array}\]

Reproduce

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