Average Error: 7.8 → 0.8
Time: 8.2s
Precision: binary64
Cost: 7176
\[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -6.293785592098951 \cdot 10^{+93} \lor \neg \left(z \leq 3.5870371763425196 \cdot 10^{-71}\right):\\ \;\;\;\;\frac{y \cdot \cosh x}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y \cdot \cosh x}{z}}{x}\\ \end{array}\]
\frac{\cosh x \cdot \frac{y}{x}}{z}
\begin{array}{l}
\mathbf{if}\;z \leq -6.293785592098951 \cdot 10^{+93} \lor \neg \left(z \leq 3.5870371763425196 \cdot 10^{-71}\right):\\
\;\;\;\;\frac{y \cdot \cosh x}{z \cdot x}\\

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

\end{array}
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -6.293785592098951e+93) (not (<= z 3.5870371763425196e-71)))
   (/ (* y (cosh x)) (* z x))
   (/ (/ (* y (cosh x)) 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 <= -6.293785592098951e+93) || !(z <= 3.5870371763425196e-71)) {
		tmp = (y * cosh(x)) / (z * x);
	} else {
		tmp = ((y * cosh(x)) / 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.8
Target0.4
Herbie0.8
\[\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}\]

Alternatives

Alternative 1
Error0.5
Cost7176
\[\begin{array}{l} \mathbf{if}\;z \leq -5.10664396477314 \cdot 10^{-26} \lor \neg \left(z \leq 6.831983702458547 \cdot 10^{-71}\right):\\ \;\;\;\;\frac{y \cdot \cosh x}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cosh x}{\frac{x}{\frac{y}{z}}}\\ \end{array}\]
Alternative 2
Error0.9
Cost7176
\[\begin{array}{l} \mathbf{if}\;z \leq -6.293785592098951 \cdot 10^{+93} \lor \neg \left(z \leq 1.1208631392430497 \cdot 10^{-73}\right):\\ \;\;\;\;\frac{y \cdot \cosh x}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\cosh x}{\frac{z}{y}}}{x}\\ \end{array}\]
Alternative 3
Error0.5
Cost7176
\[\begin{array}{l} \mathbf{if}\;z \leq -7.692520283127174 \cdot 10^{-41} \lor \neg \left(z \leq 6.831983702458547 \cdot 10^{-71}\right):\\ \;\;\;\;\frac{y \cdot \cosh x}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cosh x}{\frac{z}{\frac{y}{x}}}\\ \end{array}\]
Alternative 4
Error1.2
Cost7176
\[\begin{array}{l} \mathbf{if}\;z \leq -8.270710748687143 \cdot 10^{-09} \lor \neg \left(z \leq 6.831983702458547 \cdot 10^{-71}\right):\\ \;\;\;\;\frac{y}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cosh x}{\frac{z}{\frac{y}{x}}}\\ \end{array}\]
Alternative 5
Error1.1
Cost1602
\[\begin{array}{l} \mathbf{if}\;y \leq -16.571914064355056:\\ \;\;\;\;\frac{\frac{y + 0.5 \cdot \left(x \cdot \left(y \cdot x\right)\right)}{z}}{x}\\ \mathbf{elif}\;y \leq 7.98352922225633 \cdot 10^{-46}:\\ \;\;\;\;\frac{\frac{y}{x} + 0.5 \cdot \left(y \cdot x\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{z} + 0.5 \cdot \left(\frac{y}{z} \cdot \left(x \cdot x\right)\right)}{x}\\ \end{array}\]
Alternative 6
Error1.0
Cost1160
\[\begin{array}{l} \mathbf{if}\;y \leq -13.795716282848064 \lor \neg \left(y \leq 1.2286576793531614 \cdot 10^{-19}\right):\\ \;\;\;\;\frac{\frac{y + 0.5 \cdot \left(x \cdot \left(y \cdot x\right)\right)}{z}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x} + 0.5 \cdot \left(y \cdot x\right)}{z}\\ \end{array}\]
Alternative 7
Error1.5
Cost1032
\[\begin{array}{l} \mathbf{if}\;y \leq -1.0042656095298039 \cdot 10^{+21} \lor \neg \left(y \leq 6.862107961969659 \cdot 10^{+68}\right):\\ \;\;\;\;\frac{\frac{y}{z}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x} + 0.5 \cdot \left(y \cdot x\right)}{z}\\ \end{array}\]
Alternative 8
Error1.9
Cost648
\[\begin{array}{l} \mathbf{if}\;z \leq -6.293785592098951 \cdot 10^{+93} \lor \neg \left(z \leq 6.831983702458547 \cdot 10^{-71}\right):\\ \;\;\;\;\frac{y}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{z}}{x}\\ \end{array}\]
Alternative 9
Error1.5
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -29.023117811002376 \lor \neg \left(y \leq 3.296291255855265 \cdot 10^{-37}\right):\\ \;\;\;\;\frac{\frac{y}{z}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x}}{z}\\ \end{array}\]
Alternative 10
Error8.9
Cost320
\[\frac{\frac{y}{x}}{z}\]
Alternative 11
Error58.6
Cost64
\[0\]
Alternative 12
Error61.8
Cost64
\[1\]

Error

Derivation

  1. Split input into 2 regimes
  2. if z < -6.29378559209895108e93 or 3.5870371763425196e-71 < z

    1. Initial program 11.6

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

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

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

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

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

    if -6.29378559209895108e93 < z < 3.5870371763425196e-71

    1. Initial program 1.6

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.293785592098951 \cdot 10^{+93} \lor \neg \left(z \leq 3.5870371763425196 \cdot 10^{-71}\right):\\ \;\;\;\;\frac{y \cdot \cosh x}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y \cdot \cosh x}{z}}{x}\\ \end{array}\]

Reproduce

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