Average Error: 7.3 → 0.3
Time: 3.6s
Precision: 64
\[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\cosh x \cdot \frac{y}{x}}{z} \le -1.569646754895685203707472211986928556371 \cdot 10^{-6}:\\ \;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\ \mathbf{elif}\;\frac{\cosh x \cdot \frac{y}{x}}{z} \le 1.43550247534837939212643563586416747364 \cdot 10^{308}:\\ \;\;\;\;\frac{\cosh x \cdot \frac{y}{x}}{z}\\ \mathbf{else}:\\ \;\;\;\;\cosh x \cdot \left(y \cdot \frac{\frac{1}{z}}{x}\right)\\ \end{array}\]
\frac{\cosh x \cdot \frac{y}{x}}{z}
\begin{array}{l}
\mathbf{if}\;\frac{\cosh x \cdot \frac{y}{x}}{z} \le -1.569646754895685203707472211986928556371 \cdot 10^{-6}:\\
\;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\

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

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

\end{array}
double f(double x, double y, double z) {
        double r488628 = x;
        double r488629 = cosh(r488628);
        double r488630 = y;
        double r488631 = r488630 / r488628;
        double r488632 = r488629 * r488631;
        double r488633 = z;
        double r488634 = r488632 / r488633;
        return r488634;
}

double f(double x, double y, double z) {
        double r488635 = x;
        double r488636 = cosh(r488635);
        double r488637 = y;
        double r488638 = r488637 / r488635;
        double r488639 = r488636 * r488638;
        double r488640 = z;
        double r488641 = r488639 / r488640;
        double r488642 = -1.5696467548956852e-06;
        bool r488643 = r488641 <= r488642;
        double r488644 = r488637 / r488640;
        double r488645 = r488644 / r488635;
        double r488646 = r488636 * r488645;
        double r488647 = 1.4355024753483794e+308;
        bool r488648 = r488641 <= r488647;
        double r488649 = 1.0;
        double r488650 = r488649 / r488640;
        double r488651 = r488650 / r488635;
        double r488652 = r488637 * r488651;
        double r488653 = r488636 * r488652;
        double r488654 = r488648 ? r488641 : r488653;
        double r488655 = r488643 ? r488646 : r488654;
        return r488655;
}

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.3
Target0.4
Herbie0.3
\[\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.038530535935152855236908684227749499669 \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 3 regimes
  2. if (/ (* (cosh x) (/ y x)) z) < -1.5696467548956852e-06

    1. Initial program 12.2

      \[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity12.2

      \[\leadsto \frac{\cosh x \cdot \frac{y}{x}}{\color{blue}{1 \cdot z}}\]
    4. Applied times-frac12.2

      \[\leadsto \color{blue}{\frac{\cosh x}{1} \cdot \frac{\frac{y}{x}}{z}}\]
    5. Simplified12.2

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

      \[\leadsto \cosh x \cdot \color{blue}{\frac{y}{x \cdot z}}\]
    7. Using strategy rm
    8. Applied div-inv12.6

      \[\leadsto \cosh x \cdot \color{blue}{\left(y \cdot \frac{1}{x \cdot z}\right)}\]
    9. Using strategy rm
    10. Applied add-cube-cbrt12.6

      \[\leadsto \cosh x \cdot \left(y \cdot \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{x \cdot z}\right)\]
    11. Applied times-frac12.7

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

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

      \[\leadsto \cosh x \cdot \left(y \cdot \left(\frac{1}{x} \cdot \color{blue}{\frac{1}{z}}\right)\right)\]
    14. Using strategy rm
    15. Applied associate-*l/12.6

      \[\leadsto \cosh x \cdot \left(y \cdot \color{blue}{\frac{1 \cdot \frac{1}{z}}{x}}\right)\]
    16. Applied associate-*r/0.4

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

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

    if -1.5696467548956852e-06 < (/ (* (cosh x) (/ y x)) z) < 1.4355024753483794e+308

    1. Initial program 0.2

      \[\frac{\cosh x \cdot \frac{y}{x}}{z}\]

    if 1.4355024753483794e+308 < (/ (* (cosh x) (/ y x)) z)

    1. Initial program 63.9

      \[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity63.9

      \[\leadsto \frac{\cosh x \cdot \frac{y}{x}}{\color{blue}{1 \cdot z}}\]
    4. Applied times-frac63.7

      \[\leadsto \color{blue}{\frac{\cosh x}{1} \cdot \frac{\frac{y}{x}}{z}}\]
    5. Simplified63.7

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

      \[\leadsto \cosh x \cdot \color{blue}{\frac{y}{x \cdot z}}\]
    7. Using strategy rm
    8. Applied div-inv0.5

      \[\leadsto \cosh x \cdot \color{blue}{\left(y \cdot \frac{1}{x \cdot z}\right)}\]
    9. Using strategy rm
    10. Applied add-cube-cbrt0.5

      \[\leadsto \cosh x \cdot \left(y \cdot \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{x \cdot z}\right)\]
    11. Applied times-frac0.6

      \[\leadsto \cosh x \cdot \left(y \cdot \color{blue}{\left(\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{x} \cdot \frac{\sqrt[3]{1}}{z}\right)}\right)\]
    12. Simplified0.6

      \[\leadsto \cosh x \cdot \left(y \cdot \left(\color{blue}{\frac{1}{x}} \cdot \frac{\sqrt[3]{1}}{z}\right)\right)\]
    13. Simplified0.6

      \[\leadsto \cosh x \cdot \left(y \cdot \left(\frac{1}{x} \cdot \color{blue}{\frac{1}{z}}\right)\right)\]
    14. Using strategy rm
    15. Applied associate-*l/0.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\cosh x \cdot \frac{y}{x}}{z} \le -1.569646754895685203707472211986928556371 \cdot 10^{-6}:\\ \;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\ \mathbf{elif}\;\frac{\cosh x \cdot \frac{y}{x}}{z} \le 1.43550247534837939212643563586416747364 \cdot 10^{308}:\\ \;\;\;\;\frac{\cosh x \cdot \frac{y}{x}}{z}\\ \mathbf{else}:\\ \;\;\;\;\cosh x \cdot \left(y \cdot \frac{\frac{1}{z}}{x}\right)\\ \end{array}\]

Reproduce

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