Average Error: 12.2 → 2.2
Time: 43.5s
Precision: 64
Internal precision: 128
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -6.168596136367833 \cdot 10^{-58}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{if}\;x \le 6.519946701032483 \cdot 10^{+140}:\\ \;\;\;\;\frac{y \cdot x}{z} + x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original12.2
Comparison3.0
Herbie2.2
\[ \frac{x}{\frac{z}{y + z}} \]

Derivation

  1. Split input into 2 regimes.
  2. if x < -6.168596136367833e-58 or 6.519946701032483e+140 < x

    1. Initial program 21.9

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Using strategy rm
    3. Applied associate-/l* 0.2

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}}\]
    4. Using strategy rm
    5. Applied div-inv 0.2

      \[\leadsto \color{blue}{x \cdot \frac{1}{\frac{z}{y + z}}}\]
    6. Applied simplify 0.2

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

    if -6.168596136367833e-58 < x < 6.519946701032483e+140

    1. Initial program 6.7

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Applied taylor 3.3

      \[\leadsto \frac{y \cdot x}{z} + x\]
    3. Taylor expanded around 0 3.3

      \[\leadsto \color{blue}{\frac{y \cdot x}{z} + x}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 43.5s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(1732877526 4196286305 669315667 760288596 3024672377 3977034441)'
(FPCore (x y z)
  :name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"

  :target
  (/ x (/ z (+ y z)))

  (/ (* x (+ y z)) z))