Average Error: 7.3 → 0.5
Time: 38.0s
Precision: 64
Internal precision: 128
\[\frac{\cosh x \cdot \frac{y}{x}}{z}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.3435121576273773 \cdot 10^{-33}:\\ \;\;\;\;\frac{\cosh x \cdot \frac{y}{z}}{x}\\ \mathbf{if}\;y \le 8.378170858467427 \cdot 10^{-66}:\\ \;\;\;\;\left(\cosh x \cdot \frac{y}{x}\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cosh x \cdot \frac{y}{z}}{x}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original7.3
Comparison0.4
Herbie0.5
\[ \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 y < -1.3435121576273773e-33 or 8.378170858467427e-66 < y

    1. Initial program 16.1

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

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

      \[\leadsto \color{blue}{\frac{\cosh x \cdot y}{x}} \cdot \frac{1}{z}\]
    6. Applied associate-*l/ 0.9

      \[\leadsto \color{blue}{\frac{\left(\cosh x \cdot y\right) \cdot \frac{1}{z}}{x}}\]
    7. Applied simplify 0.8

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

    if -1.3435121576273773e-33 < y < 8.378170858467427e-66

    1. Initial program 0.2

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

      \[\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: 38.0s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(1647583559 3318508030 3110287135 1484814768 2025052434 1353056123)'
(FPCore (x y z)
  :name "Linear.Quaternion:$ctan from linear-1.19.1.3"

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