Average Error: 24.1 → 1.6
Time: 3.4m
Precision: 64
Internal precision: 128
\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1.0\right) \cdot \log a\right) - b}}{y}\]
\[\begin{array}{l} \mathbf{if}\;y \le -6.408792807834615 \cdot 10^{+52}:\\ \;\;\;\;\frac{\frac{{z}^{y} \cdot x}{y \cdot a}}{\left(1 + b\right) - t \cdot \log a}\\ \mathbf{if}\;y \le -69.525409230544:\\ \;\;\;\;\frac{\frac{x}{y} + \left(x \cdot \log z + \frac{1}{2} \cdot \left(y \cdot \left(x \cdot {\left(\log z\right)}^2\right)\right)\right)}{e^{b - \log a \cdot \left(t - 1.0\right)}}\\ \mathbf{if}\;y \le 1.4591773572605082 \cdot 10^{-06}:\\ \;\;\;\;\frac{{z}^{y} \cdot x}{e^{b - \log a \cdot \left(t - 1.0\right)} \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{z}^{y} \cdot x}{y \cdot a}}{\left(1 + b\right) - t \cdot \log a}\\ \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

Original24.1
Comparison29.6
Herbie1.6
\[ \begin{array}{l} \mathbf{if}\;t \lt -0.8845848504127471:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1.0\right)}}{y}}{\left(b + 1\right) - y \cdot \log z}\\ \mathbf{if}\;t \lt 852031.2288374073:\\ \;\;\;\;\frac{\frac{x}{y} \cdot {a}^{\left(t - 1.0\right)}}{e^{b - \log z \cdot y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1.0\right)}}{y}}{\left(b + 1\right) - y \cdot \log z}\\ \end{array} \]

Derivation

  1. Split input into 3 regimes.
  2. if y < -6.408792807834615e+52 or 1.4591773572605082e-06 < y

    1. Initial program 36.4

      \[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1.0\right) \cdot \log a\right) - b}}{y}\]
    2. Applied simplify 27.1

      \[\leadsto \color{blue}{\frac{{z}^{y} \cdot \frac{x}{y}}{\frac{e^{b}}{{a}^{\left(t - 1.0\right)}}}}\]
    3. Applied taylor 1.6

      \[\leadsto \frac{{z}^{y} \cdot \frac{x}{y}}{\left(a + b \cdot a\right) - t \cdot \left(\log a \cdot a\right)}\]
    4. Taylor expanded around 0 1.6

      \[\leadsto \frac{{z}^{y} \cdot \frac{x}{y}}{\color{blue}{\left(a + b \cdot a\right) - t \cdot \left(\log a \cdot a\right)}}\]
    5. Applied simplify 0.1

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

    if -6.408792807834615e+52 < y < -69.525409230544

    1. Initial program 23.4

      \[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1.0\right) \cdot \log a\right) - b}}{y}\]
    2. Applied simplify 45.3

      \[\leadsto \color{blue}{\frac{{z}^{y} \cdot \frac{x}{y}}{\frac{e^{b}}{{a}^{\left(t - 1.0\right)}}}}\]
    3. Using strategy rm
    4. Applied pow-to-exp 45.3

      \[\leadsto \frac{{z}^{y} \cdot \frac{x}{y}}{\frac{e^{b}}{\color{blue}{e^{\log a \cdot \left(t - 1.0\right)}}}}\]
    5. Applied div-exp 41.9

      \[\leadsto \frac{{z}^{y} \cdot \frac{x}{y}}{\color{blue}{e^{b - \log a \cdot \left(t - 1.0\right)}}}\]
    6. Applied taylor 5.8

      \[\leadsto \frac{\frac{x}{y} + \left(x \cdot \log z + \frac{1}{2} \cdot \left(y \cdot \left(x \cdot {\left(\log z\right)}^2\right)\right)\right)}{e^{b - \log a \cdot \left(t - 1.0\right)}}\]
    7. Taylor expanded around 0 5.8

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

    if -69.525409230544 < y < 1.4591773572605082e-06

    1. Initial program 3.6

      \[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1.0\right) \cdot \log a\right) - b}}{y}\]
    2. Applied simplify 18.4

      \[\leadsto \color{blue}{\frac{{z}^{y} \cdot \frac{x}{y}}{\frac{e^{b}}{{a}^{\left(t - 1.0\right)}}}}\]
    3. Using strategy rm
    4. Applied associate-*r/ 18.4

      \[\leadsto \frac{\color{blue}{\frac{{z}^{y} \cdot x}{y}}}{\frac{e^{b}}{{a}^{\left(t - 1.0\right)}}}\]
    5. Applied associate-/l/ 9.5

      \[\leadsto \color{blue}{\frac{{z}^{y} \cdot x}{\frac{e^{b}}{{a}^{\left(t - 1.0\right)}} \cdot y}}\]
    6. Using strategy rm
    7. Applied pow-to-exp 10.8

      \[\leadsto \frac{{z}^{y} \cdot x}{\frac{e^{b}}{\color{blue}{e^{\log a \cdot \left(t - 1.0\right)}}} \cdot y}\]
    8. Applied div-exp 3.8

      \[\leadsto \frac{{z}^{y} \cdot x}{\color{blue}{e^{b - \log a \cdot \left(t - 1.0\right)}} \cdot y}\]
  3. Recombined 3 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 3.4m) Debug log

Please include this information when filing a bug report:

herbie --seed '#(3934818526 94852643 3686681099 2470086423 465584342 2965660800)'
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2, A"

  :target
  (if (< t -0.8845848504127471) (/ (* x (/ (pow a (- t 1.0)) y)) (- (+ b 1) (* 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) (* y (log z))))))

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