Average Error: 7.5 → 0.5
Time: 7.6s
Precision: binary64
\[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -8.39995168417652 \cdot 10^{-50} \lor \neg \left(z \leq 6.06585713101189 \cdot 10^{-49}\right):\\ \;\;\;\;\frac{\cosh x \cdot y}{z \cdot x}\\ \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}\;z \leq -8.39995168417652 \cdot 10^{-50} \lor \neg \left(z \leq 6.06585713101189 \cdot 10^{-49}\right):\\
\;\;\;\;\frac{\cosh x \cdot y}{z \cdot x}\\

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

\end{array}
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -8.39995168417652e-50) (not (<= z 6.06585713101189e-49)))
   (/ (* (cosh x) y) (* z x))
   (/ (/ (* (cosh x) y) z) x)))
double code(double x, double y, double z) {
	return (cosh(x) * (y / x)) / z;
}
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -8.39995168417652e-50) || !(z <= 6.06585713101189e-49)) {
		tmp = (cosh(x) * y) / (z * x);
	} else {
		tmp = ((cosh(x) * y) / z) / x;
	}
	return tmp;
}

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.5
\[\begin{array}{l} \mathbf{if}\;y < -4.618902267687042 \cdot 10^{-52}:\\ \;\;\;\;\frac{\frac{y}{z}}{x} \cdot \cosh x\\ \mathbf{elif}\;y < 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 2 regimes
  2. if z < -8.39989e-50 or 6.06582e-49 < z

    1. Initial program 10.4

      \[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
    2. Using strategy rm
    3. Applied associate-*r/_binary64_191910.4

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

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

    if -8.39989e-50 < z < 6.06582e-49

    1. Initial program 0.3

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

      \[\leadsto \frac{\cosh x \cdot \color{blue}{\left(y \cdot \frac{1}{x}\right)}}{z}\]
    4. Applied associate-*r*_binary64_19170.4

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

      \[\leadsto \frac{\color{blue}{\left(y \cdot \cosh x\right)} \cdot \frac{1}{x}}{z}\]
    6. Using strategy rm
    7. Applied div-inv_binary64_18590.4

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

      \[\leadsto \color{blue}{\frac{\left(y \cdot \cosh x\right) \cdot 1}{x}} \cdot \frac{1}{z}\]
    10. Applied associate-*l/_binary64_19200.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.39995168417652 \cdot 10^{-50} \lor \neg \left(z \leq 6.06585713101189 \cdot 10^{-49}\right):\\ \;\;\;\;\frac{\cosh x \cdot y}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\cosh x \cdot y}{z}}{x}\\ \end{array}\]

Reproduce

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