Average Error: 2.8 → 2.0
Time: 42.7s
Precision: 64
Internal Precision: 384
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -5.7336804601369906 \cdot 10^{+181}:\\ \;\;\;\;\frac{\left(x \cdot \sin y\right) \cdot \frac{1}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{x}{z} \cdot \frac{\sin y}{y}\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original2.8
Target0.3
Herbie2.0
\[\begin{array}{l} \mathbf{if}\;z \lt -4.2173720203427147 \cdot 10^{-29}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \mathbf{if}\;z \lt 4.446702369113811 \cdot 10^{+64}:\\ \;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -5.7336804601369906e+181

    1. Initial program 0.2

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

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

      \[\leadsto \frac{\color{blue}{\left(x \cdot \sin y\right) \cdot \frac{1}{y}}}{z}\]

    if -5.7336804601369906e+181 < x

    1. Initial program 3.0

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied clear-num3.6

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}}\]
    4. Using strategy rm
    5. Applied div-inv3.6

      \[\leadsto \color{blue}{1 \cdot \frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}}\]
    6. Applied simplify2.1

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

Runtime

Time bar (total: 42.7s)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit +o reduce:binary-search
(FPCore (x y z)
  :name "Linear.Quaternion:$ctanh from linear-1.19.1.3"

  :herbie-target
  (if (< z -4.2173720203427147e-29) (/ (* x (/ 1 (/ y (sin y)))) z) (if (< z 4.446702369113811e+64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1 (/ y (sin y)))) z)))

  (/ (* x (/ (sin y) y)) z))