Average Error: 20.1 → 0.7
Time: 1.2m
Precision: 64
Internal Precision: 1408
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z + y} \le 0.0:\\ \;\;\;\;\frac{e^{-\frac{1}{z}}}{y} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{{\left({\left(\frac{y}{z + y}\right)}^{y}\right)}^{3}}}{y} + x\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original20.1
Target0.7
Herbie0.7
\[\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)) < 0.0

    1. Initial program 59.9

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

      \[\leadsto \color{blue}{\frac{{\left(\frac{y}{y + z}\right)}^{y}}{y} + x}\]
    3. Taylor expanded around inf 0.0

      \[\leadsto \frac{\color{blue}{e^{-\frac{1}{z}}}}{y} + x\]

    if 0.0 < (/ y (+ z y))

    1. Initial program 1.0

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

      \[\leadsto \color{blue}{\frac{{\left(\frac{y}{y + z}\right)}^{y}}{y} + x}\]
    3. Using strategy rm
    4. Applied add-cbrt-cube1.0

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left({\left(\frac{y}{y + z}\right)}^{y} \cdot {\left(\frac{y}{y + z}\right)}^{y}\right) \cdot {\left(\frac{y}{y + z}\right)}^{y}}}}{y} + x\]
    5. Applied simplify1.0

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

Runtime

Time bar (total: 1.2m)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit +o reduce:binary-search
(FPCore (x y z)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, G"

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