Average Error: 1.9 → 2.2
Time: 12.6s
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 -569.910579515335144 \lor \neg \left(\left(t - 1\right) \cdot \log a \le -222.37280864882484\right):\\ \;\;\;\;\frac{x \cdot {e}^{\left(\left(\left(t - 1\right) \cdot \log a + y \cdot \log z\right) - b\right)}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{{z}^{y} \cdot \left(\frac{{a}^{t}}{e^{b}} \cdot {a}^{\left(-1\right)}\right)}}\\ \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.2
\[\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)) < -569.910579515335144 or -222.37280864882484 < (* (- t 1.0) (log a))

    1. Initial program 1.2

      \[\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.2

      \[\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.3

      \[\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.3

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

    if -569.910579515335144 < (* (- t 1.0) (log a)) < -222.37280864882484

    1. Initial program 6.1

      \[\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.1

      \[\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-prod6.2

      \[\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. Simplified6.2

      \[\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. Taylor expanded around inf 6.1

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

      \[\leadsto \frac{x \cdot \color{blue}{\left({a}^{\left(-1\right)} \cdot \left(\left({z}^{y} \cdot {a}^{t}\right) \cdot e^{-b}\right)\right)}}{y}\]
    8. Using strategy rm
    9. Applied associate-/l*7.5

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

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

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

Reproduce

herbie shell --seed 2020179 
(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))