Average Error: 7.7 → 0.3
Time: 12.1s
Precision: 64
\[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.18445552914575991 \cdot 10^{-5} \lor \neg \left(y \le 1360485835946968480000\right):\\ \;\;\;\;\frac{y \cdot \left(\frac{1}{2} \cdot \left(e^{x} + e^{-x}\right)\right)}{x \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y \cdot \left(\frac{1}{2} \cdot \left(e^{x} + e^{-x}\right)\right)}{x}}{z}\\ \end{array}\]
\frac{\cosh x \cdot \frac{y}{x}}{z}
\begin{array}{l}
\mathbf{if}\;y \le -4.18445552914575991 \cdot 10^{-5} \lor \neg \left(y \le 1360485835946968480000\right):\\
\;\;\;\;\frac{y \cdot \left(\frac{1}{2} \cdot \left(e^{x} + e^{-x}\right)\right)}{x \cdot z}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{y \cdot \left(\frac{1}{2} \cdot \left(e^{x} + e^{-x}\right)\right)}{x}}{z}\\

\end{array}
double f(double x, double y, double z) {
        double r632505 = x;
        double r632506 = cosh(r632505);
        double r632507 = y;
        double r632508 = r632507 / r632505;
        double r632509 = r632506 * r632508;
        double r632510 = z;
        double r632511 = r632509 / r632510;
        return r632511;
}

double f(double x, double y, double z) {
        double r632512 = y;
        double r632513 = -4.18445552914576e-05;
        bool r632514 = r632512 <= r632513;
        double r632515 = 1.3604858359469685e+21;
        bool r632516 = r632512 <= r632515;
        double r632517 = !r632516;
        bool r632518 = r632514 || r632517;
        double r632519 = 0.5;
        double r632520 = x;
        double r632521 = exp(r632520);
        double r632522 = -r632520;
        double r632523 = exp(r632522);
        double r632524 = r632521 + r632523;
        double r632525 = r632519 * r632524;
        double r632526 = r632512 * r632525;
        double r632527 = z;
        double r632528 = r632520 * r632527;
        double r632529 = r632526 / r632528;
        double r632530 = r632526 / r632520;
        double r632531 = r632530 / r632527;
        double r632532 = r632518 ? r632529 : r632531;
        return r632532;
}

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.7
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 y < -4.18445552914576e-05 or 1.3604858359469685e+21 < y

    1. Initial program 22.0

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

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

      \[\leadsto \left(\color{blue}{\frac{e^{x} + e^{-x}}{2}} \cdot \frac{y}{x}\right) \cdot \frac{1}{z}\]
    6. Applied frac-times22.1

      \[\leadsto \color{blue}{\frac{\left(e^{x} + e^{-x}\right) \cdot y}{2 \cdot x}} \cdot \frac{1}{z}\]
    7. Applied associate-*l/0.4

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x} + e^{-x}\right) \cdot y\right) \cdot \frac{1}{z}}{2 \cdot x}}\]
    8. Simplified0.3

      \[\leadsto \frac{\color{blue}{\frac{\left(e^{x} + e^{-x}\right) \cdot y}{z}}}{2 \cdot x}\]
    9. Using strategy rm
    10. Applied clear-num0.4

      \[\leadsto \color{blue}{\frac{1}{\frac{2 \cdot x}{\frac{\left(e^{x} + e^{-x}\right) \cdot y}{z}}}}\]
    11. Using strategy rm
    12. Applied *-un-lft-identity0.4

      \[\leadsto \frac{1}{\color{blue}{1 \cdot \frac{2 \cdot x}{\frac{\left(e^{x} + e^{-x}\right) \cdot y}{z}}}}\]
    13. Applied add-cube-cbrt0.4

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{1 \cdot \frac{2 \cdot x}{\frac{\left(e^{x} + e^{-x}\right) \cdot y}{z}}}\]
    14. Applied times-frac0.4

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{\frac{2 \cdot x}{\frac{\left(e^{x} + e^{-x}\right) \cdot y}{z}}}}\]
    15. Simplified0.4

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{2 \cdot x}{\frac{\left(e^{x} + e^{-x}\right) \cdot y}{z}}}\]
    16. Simplified0.3

      \[\leadsto 1 \cdot \color{blue}{\frac{y \cdot \left(\frac{1}{2} \cdot \left(e^{x} + e^{-x}\right)\right)}{x \cdot z}}\]

    if -4.18445552914576e-05 < y < 1.3604858359469685e+21

    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}}\]
    4. Using strategy rm
    5. Applied cosh-def0.4

      \[\leadsto \left(\color{blue}{\frac{e^{x} + e^{-x}}{2}} \cdot \frac{y}{x}\right) \cdot \frac{1}{z}\]
    6. Applied frac-times0.4

      \[\leadsto \color{blue}{\frac{\left(e^{x} + e^{-x}\right) \cdot y}{2 \cdot x}} \cdot \frac{1}{z}\]
    7. Applied associate-*l/10.0

      \[\leadsto \color{blue}{\frac{\left(\left(e^{x} + e^{-x}\right) \cdot y\right) \cdot \frac{1}{z}}{2 \cdot x}}\]
    8. Simplified9.9

      \[\leadsto \frac{\color{blue}{\frac{\left(e^{x} + e^{-x}\right) \cdot y}{z}}}{2 \cdot x}\]
    9. Using strategy rm
    10. Applied clear-num10.0

      \[\leadsto \color{blue}{\frac{1}{\frac{2 \cdot x}{\frac{\left(e^{x} + e^{-x}\right) \cdot y}{z}}}}\]
    11. Using strategy rm
    12. Applied associate-/r/0.7

      \[\leadsto \frac{1}{\color{blue}{\frac{2 \cdot x}{\left(e^{x} + e^{-x}\right) \cdot y} \cdot z}}\]
    13. Applied associate-/r*0.4

      \[\leadsto \color{blue}{\frac{\frac{1}{\frac{2 \cdot x}{\left(e^{x} + e^{-x}\right) \cdot y}}}{z}}\]
    14. Simplified0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -4.18445552914575991 \cdot 10^{-5} \lor \neg \left(y \le 1360485835946968480000\right):\\ \;\;\;\;\frac{y \cdot \left(\frac{1}{2} \cdot \left(e^{x} + e^{-x}\right)\right)}{x \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y \cdot \left(\frac{1}{2} \cdot \left(e^{x} + e^{-x}\right)\right)}{x}}{z}\\ \end{array}\]

Reproduce

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