Average Error: 19.4 → 0.8
Time: 33.5s
Precision: 64
Internal precision: 128
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z + y} \le 5.3881129393563 \cdot 10^{-317}:\\ \;\;\;\;\left(\frac{1}{y} + x\right) - \frac{1}{z \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{y}{z + y}\right)}^{y}}{y} + x\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original19.4
Comparison2.6
Herbie0.8
\[ \begin{array}{l} \mathbf{if}\;\frac{y}{z + y} \lt 7.1154157597908 \cdot 10^{-315}:\\ \;\;\;\;x + \frac{e^{\frac{-1}{z}}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{e^{\log \left({\left(\frac{y}{y + z}\right)}^{y}\right)}}{y}\\ \end{array} \]

Derivation

  1. Split input into 2 regimes.
  2. if (/ y (+ z y)) < 5.3881129393563e-317

    1. Initial program 59.1

      \[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
    2. Applied simplify 54.7

      \[\leadsto \color{blue}{\frac{{\left(\frac{y}{z + y}\right)}^{y}}{y} + x}\]
    3. Applied taylor 5.9

      \[\leadsto \frac{e^{-\frac{1}{z}}}{y} + x\]
    4. Taylor expanded around inf 5.9

      \[\leadsto \frac{\color{blue}{e^{-\frac{1}{z}}}}{y} + x\]
    5. Applied taylor 0.0

      \[\leadsto \left(\frac{1}{y} + x\right) - \frac{1}{z \cdot y}\]
    6. Taylor expanded around inf 0.0

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

    if 5.3881129393563e-317 < (/ y (+ z y))

    1. Initial program 1.1

      \[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
    2. Applied simplify 1.1

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

Runtime

Time bar (total: 33.5s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(1176599356 1757141449 4072909358 2971363 2715525575 3892048116)'
(FPCore (x y z)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, G"

  :target
  (if (< (/ y (+ z y)) 7.1154157597908e-315) (+ x (/ (exp (/ -1 z)) y)) (+ x (/ (exp (log (pow (/ y (+ y z)) y))) y)))

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