Average Error: 7.1 → 0.6
Time: 2.1m
Precision: 64
Internal Precision: 384
\[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -4.325937455082745 \cdot 10^{+35}:\\ \;\;\;\;\frac{\left(\sqrt[3]{\cosh x} \cdot \sqrt[3]{e^{x} + e^{-x}}\right) \cdot \left(\sqrt[3]{\cosh x} \cdot y\right)}{z \cdot \left(\sqrt[3]{2} \cdot x\right)}\\ \mathbf{if}\;z \le 1474036971039.3018:\\ \;\;\;\;\left(\cosh x \cdot \frac{y}{x}\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\sqrt[3]{\cosh x} \cdot \sqrt[3]{e^{x} + e^{-x}}\right) \cdot \left(\sqrt[3]{\cosh x} \cdot y\right)}{z \cdot \left(\sqrt[3]{2} \cdot x\right)}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original7.1
Target0.5
Herbie0.6
\[\begin{array}{l} \mathbf{if}\;y \lt -4.618902267687042 \cdot 10^{-52}:\\ \;\;\;\;\frac{\frac{y}{z}}{x} \cdot \cosh x\\ \mathbf{if}\;y \lt 1.038530535935153 \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 < -4.325937455082745e+35 or 1474036971039.3018 < z

    1. Initial program 11.4

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

      \[\leadsto \frac{\color{blue}{\left(\left(\sqrt[3]{\cosh x} \cdot \sqrt[3]{\cosh x}\right) \cdot \sqrt[3]{\cosh x}\right)} \cdot \frac{y}{x}}{z}\]
    4. Applied associate-*l*11.4

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{\cosh x} \cdot \sqrt[3]{\cosh x}\right) \cdot \left(\sqrt[3]{\cosh x} \cdot \frac{y}{x}\right)}}{z}\]
    5. Using strategy rm
    6. Applied associate-*r/11.4

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

      \[\leadsto \frac{\left(\sqrt[3]{\cosh x} \cdot \sqrt[3]{\color{blue}{\frac{e^{x} + e^{-x}}{2}}}\right) \cdot \frac{\sqrt[3]{\cosh x} \cdot y}{x}}{z}\]
    8. Applied cbrt-div11.4

      \[\leadsto \frac{\left(\sqrt[3]{\cosh x} \cdot \color{blue}{\frac{\sqrt[3]{e^{x} + e^{-x}}}{\sqrt[3]{2}}}\right) \cdot \frac{\sqrt[3]{\cosh x} \cdot y}{x}}{z}\]
    9. Applied associate-*r/11.4

      \[\leadsto \frac{\color{blue}{\frac{\sqrt[3]{\cosh x} \cdot \sqrt[3]{e^{x} + e^{-x}}}{\sqrt[3]{2}}} \cdot \frac{\sqrt[3]{\cosh x} \cdot y}{x}}{z}\]
    10. Applied frac-times11.5

      \[\leadsto \frac{\color{blue}{\frac{\left(\sqrt[3]{\cosh x} \cdot \sqrt[3]{e^{x} + e^{-x}}\right) \cdot \left(\sqrt[3]{\cosh x} \cdot y\right)}{\sqrt[3]{2} \cdot x}}}{z}\]
    11. Applied associate-/l/0.5

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

    if -4.325937455082745e+35 < z < 1474036971039.3018

    1. Initial program 0.6

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

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

Runtime

Time bar (total: 2.1m)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(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))