Average Error: 8.2 → 0.5
Time: 18.4s
Precision: 64
\[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{x} \cdot \cosh x \le -1.224452087430355703373954342329018708562 \cdot 10^{256}:\\ \;\;\;\;\frac{y}{z \cdot x} + \frac{1}{2} \cdot \frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{x} \cdot \cosh x \le 1.716322984210519615306631151341635933561 \cdot 10^{164}:\\ \;\;\;\;\frac{\frac{y}{x} \cdot \cosh x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z \cdot x} + \frac{1}{2} \cdot \frac{x \cdot y}{z}\\ \end{array}\]
\frac{\cosh x \cdot \frac{y}{x}}{z}
\begin{array}{l}
\mathbf{if}\;\frac{y}{x} \cdot \cosh x \le -1.224452087430355703373954342329018708562 \cdot 10^{256}:\\
\;\;\;\;\frac{y}{z \cdot x} + \frac{1}{2} \cdot \frac{x \cdot y}{z}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot x} + \frac{1}{2} \cdot \frac{x \cdot y}{z}\\

\end{array}
double f(double x, double y, double z) {
        double r21546813 = x;
        double r21546814 = cosh(r21546813);
        double r21546815 = y;
        double r21546816 = r21546815 / r21546813;
        double r21546817 = r21546814 * r21546816;
        double r21546818 = z;
        double r21546819 = r21546817 / r21546818;
        return r21546819;
}

double f(double x, double y, double z) {
        double r21546820 = y;
        double r21546821 = x;
        double r21546822 = r21546820 / r21546821;
        double r21546823 = cosh(r21546821);
        double r21546824 = r21546822 * r21546823;
        double r21546825 = -1.2244520874303557e+256;
        bool r21546826 = r21546824 <= r21546825;
        double r21546827 = z;
        double r21546828 = r21546827 * r21546821;
        double r21546829 = r21546820 / r21546828;
        double r21546830 = 0.5;
        double r21546831 = r21546821 * r21546820;
        double r21546832 = r21546831 / r21546827;
        double r21546833 = r21546830 * r21546832;
        double r21546834 = r21546829 + r21546833;
        double r21546835 = 1.7163229842105196e+164;
        bool r21546836 = r21546824 <= r21546835;
        double r21546837 = r21546824 / r21546827;
        double r21546838 = r21546836 ? r21546837 : r21546834;
        double r21546839 = r21546826 ? r21546834 : r21546838;
        return r21546839;
}

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

Original8.2
Target0.4
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;y \lt -4.618902267687041990497740832940559043667 \cdot 10^{-52}:\\ \;\;\;\;\frac{\frac{y}{z}}{x} \cdot \cosh x\\ \mathbf{elif}\;y \lt 1.038530535935153018369520384190862667426 \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 (* (cosh x) (/ y x)) < -1.2244520874303557e+256 or 1.7163229842105196e+164 < (* (cosh x) (/ y x))

    1. Initial program 30.7

      \[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
    2. Taylor expanded around 0 1.2

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{x \cdot y}{z} + \frac{y}{x \cdot z}}\]

    if -1.2244520874303557e+256 < (* (cosh x) (/ y x)) < 1.7163229842105196e+164

    1. Initial program 0.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{x} \cdot \cosh x \le -1.224452087430355703373954342329018708562 \cdot 10^{256}:\\ \;\;\;\;\frac{y}{z \cdot x} + \frac{1}{2} \cdot \frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{x} \cdot \cosh x \le 1.716322984210519615306631151341635933561 \cdot 10^{164}:\\ \;\;\;\;\frac{\frac{y}{x} \cdot \cosh x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z \cdot x} + \frac{1}{2} \cdot \frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

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

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

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