Average Error: 7.7 → 0.3
Time: 8.6s
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 r571584 = x;
        double r571585 = cosh(r571584);
        double r571586 = y;
        double r571587 = r571586 / r571584;
        double r571588 = r571585 * r571587;
        double r571589 = z;
        double r571590 = r571588 / r571589;
        return r571590;
}

double f(double x, double y, double z) {
        double r571591 = y;
        double r571592 = -4.18445552914576e-05;
        bool r571593 = r571591 <= r571592;
        double r571594 = 1.3604858359469685e+21;
        bool r571595 = r571591 <= r571594;
        double r571596 = !r571595;
        bool r571597 = r571593 || r571596;
        double r571598 = 0.5;
        double r571599 = x;
        double r571600 = exp(r571599);
        double r571601 = -r571599;
        double r571602 = exp(r571601);
        double r571603 = r571600 + r571602;
        double r571604 = r571598 * r571603;
        double r571605 = r571591 * r571604;
        double r571606 = z;
        double r571607 = r571599 * r571606;
        double r571608 = r571605 / r571607;
        double r571609 = r571605 / r571599;
        double r571610 = r571609 / r571606;
        double r571611 = r571597 ? r571608 : r571610;
        return r571611;
}

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))