Average Error: 1.9 → 2.0
Time: 16.5s
Precision: binary64
\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\]
\[\begin{array}{l} \mathbf{if}\;\left(t - 1\right) \cdot \log a \le -579.37353672177346 \lor \neg \left(\left(t - 1\right) \cdot \log a \le -317.1819312800277\right):\\ \;\;\;\;\left(x \cdot {e}^{\left(\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b\right)}\right) \cdot \frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{{z}^{y} \cdot \left({a}^{t} \cdot \frac{{a}^{\left(-1\right)}}{e^{b}}\right)}{y}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Target

Original1.9
Target11.5
Herbie2.0
\[\begin{array}{l} \mathbf{if}\;t \lt -0.88458485041274715:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1\right)}}{y}}{\left(b + 1\right) - y \cdot \log z}\\ \mathbf{elif}\;t \lt 852031.22883740731:\\ \;\;\;\;\frac{\frac{x}{y} \cdot {a}^{\left(t - 1\right)}}{e^{b - \log z \cdot y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1\right)}}{y}}{\left(b + 1\right) - y \cdot \log z}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (* (- t 1.0) (log a)) < -579.37353672177346 or -317.1819312800277 < (* (- t 1.0) (log a))

    1. Initial program 1.3

      \[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity1.3

      \[\leadsto \frac{x \cdot e^{\color{blue}{1 \cdot \left(\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b\right)}}}{y}\]
    4. Applied exp-prod1.4

      \[\leadsto \frac{x \cdot \color{blue}{{\left(e^{1}\right)}^{\left(\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b\right)}}}{y}\]
    5. Simplified1.4

      \[\leadsto \frac{x \cdot {\color{blue}{e}}^{\left(\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b\right)}}{y}\]
    6. Using strategy rm
    7. Applied div-inv1.4

      \[\leadsto \color{blue}{\left(x \cdot {e}^{\left(\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b\right)}\right) \cdot \frac{1}{y}}\]

    if -579.37353672177346 < (* (- t 1.0) (log a)) < -317.1819312800277

    1. Initial program 6.3

      \[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity6.3

      \[\leadsto \frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{\color{blue}{1 \cdot y}}\]
    4. Applied times-frac2.3

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}}\]
    5. Simplified2.3

      \[\leadsto \color{blue}{x} \cdot \frac{e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\]
    6. Simplified7.5

      \[\leadsto x \cdot \color{blue}{\frac{{z}^{y} \cdot \frac{{a}^{\left(t - 1\right)}}{e^{b}}}{y}}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity7.5

      \[\leadsto x \cdot \frac{{z}^{y} \cdot \frac{{a}^{\left(t - 1\right)}}{\color{blue}{1 \cdot e^{b}}}}{y}\]
    9. Applied sub-neg7.5

      \[\leadsto x \cdot \frac{{z}^{y} \cdot \frac{{a}^{\color{blue}{\left(t + \left(-1\right)\right)}}}{1 \cdot e^{b}}}{y}\]
    10. Applied unpow-prod-up7.4

      \[\leadsto x \cdot \frac{{z}^{y} \cdot \frac{\color{blue}{{a}^{t} \cdot {a}^{\left(-1\right)}}}{1 \cdot e^{b}}}{y}\]
    11. Applied times-frac7.4

      \[\leadsto x \cdot \frac{{z}^{y} \cdot \color{blue}{\left(\frac{{a}^{t}}{1} \cdot \frac{{a}^{\left(-1\right)}}{e^{b}}\right)}}{y}\]
    12. Simplified7.4

      \[\leadsto x \cdot \frac{{z}^{y} \cdot \left(\color{blue}{{a}^{t}} \cdot \frac{{a}^{\left(-1\right)}}{e^{b}}\right)}{y}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(t - 1\right) \cdot \log a \le -579.37353672177346 \lor \neg \left(\left(t - 1\right) \cdot \log a \le -317.1819312800277\right):\\ \;\;\;\;\left(x \cdot {e}^{\left(\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b\right)}\right) \cdot \frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{{z}^{y} \cdot \left({a}^{t} \cdot \frac{{a}^{\left(-1\right)}}{e^{b}}\right)}{y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020182 
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (if (< t -0.8845848504127471) (/ (* x (/ (pow a (- t 1.0)) y)) (- (+ b 1.0) (* y (log z)))) (if (< t 852031.2288374073) (/ (* (/ x y) (pow a (- t 1.0))) (exp (- b (* (log z) y)))) (/ (* x (/ (pow a (- t 1.0)) y)) (- (+ b 1.0) (* y (log z))))))

  (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))