Average Error: 7.5 → 0.3
Time: 4.4s
Precision: 64
\[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.16932822131559739 \cdot 10^{-24} \lor \neg \left(z \le 2.23999075420357997 \cdot 10^{-19}\right):\\ \;\;\;\;\frac{e^{\log \left(\cosh x\right)} \cdot y}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\left(\cosh x \cdot \frac{y}{x}\right) \cdot \frac{1}{z}\\ \end{array}\]
\frac{\cosh x \cdot \frac{y}{x}}{z}
\begin{array}{l}
\mathbf{if}\;z \le -3.16932822131559739 \cdot 10^{-24} \lor \neg \left(z \le 2.23999075420357997 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{e^{\log \left(\cosh x\right)} \cdot y}{z \cdot x}\\

\mathbf{else}:\\
\;\;\;\;\left(\cosh x \cdot \frac{y}{x}\right) \cdot \frac{1}{z}\\

\end{array}
double f(double x, double y, double z) {
        double r538007 = x;
        double r538008 = cosh(r538007);
        double r538009 = y;
        double r538010 = r538009 / r538007;
        double r538011 = r538008 * r538010;
        double r538012 = z;
        double r538013 = r538011 / r538012;
        return r538013;
}

double f(double x, double y, double z) {
        double r538014 = z;
        double r538015 = -3.1693282213155974e-24;
        bool r538016 = r538014 <= r538015;
        double r538017 = 2.23999075420358e-19;
        bool r538018 = r538014 <= r538017;
        double r538019 = !r538018;
        bool r538020 = r538016 || r538019;
        double r538021 = x;
        double r538022 = cosh(r538021);
        double r538023 = log(r538022);
        double r538024 = exp(r538023);
        double r538025 = y;
        double r538026 = r538024 * r538025;
        double r538027 = r538014 * r538021;
        double r538028 = r538026 / r538027;
        double r538029 = r538025 / r538021;
        double r538030 = r538022 * r538029;
        double r538031 = 1.0;
        double r538032 = r538031 / r538014;
        double r538033 = r538030 * r538032;
        double r538034 = r538020 ? r538028 : r538033;
        return r538034;
}

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.3
\[\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 2 regimes
  2. if z < -3.1693282213155974e-24 or 2.23999075420358e-19 < z

    1. Initial program 11.0

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

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

      \[\leadsto \color{blue}{\frac{\cosh x \cdot y}{z \cdot x}}\]
    5. Using strategy rm
    6. Applied add-exp-log0.3

      \[\leadsto \frac{\color{blue}{e^{\log \left(\cosh x\right)}} \cdot y}{z \cdot x}\]

    if -3.1693282213155974e-24 < z < 2.23999075420358e-19

    1. Initial program 0.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.16932822131559739 \cdot 10^{-24} \lor \neg \left(z \le 2.23999075420357997 \cdot 10^{-19}\right):\\ \;\;\;\;\frac{e^{\log \left(\cosh x\right)} \cdot y}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\left(\cosh x \cdot \frac{y}{x}\right) \cdot \frac{1}{z}\\ \end{array}\]

Reproduce

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