Average Error: 34.1 → 6.0
Time: 3.5m
Precision: 64
Internal Precision: 1408
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1.0 - z\right) - b\right)}\]
\[\begin{array}{l} \mathbf{if}\;y \le 3.439646959482297 \cdot 10^{-130}:\\ \;\;\;\;\left(x \cdot e^{\left(\log \left(1.0 - z\right) - b\right) \cdot a}\right) \cdot {\left(\left(z + \frac{1}{2} \cdot \left(z \cdot {t}^{2}\right)\right) - z \cdot t\right)}^{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot e^{\left(\log \left(1.0 - z\right) - b\right) \cdot a}\right) \cdot {\left(\frac{z}{e^{t}}\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

Original34.1
Target34.1
Herbie6.0
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1.0 - z\right) - b\right)}\]

Derivation

  1. Split input into 2 regimes
  2. if y < 3.439646959482297e-130

    1. Initial program 34.1

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

      \[\leadsto \color{blue}{\left(x \cdot {\left(\frac{1.0 - z}{e^{b}}\right)}^{a}\right) \cdot {\left(\frac{z}{e^{t}}\right)}^{y}}\]
    3. Taylor expanded around 0 17.5

      \[\leadsto \left(x \cdot {\left(\frac{1.0 - z}{e^{b}}\right)}^{a}\right) \cdot {\color{blue}{\left(\left(z + \frac{1}{2} \cdot \left(z \cdot {t}^{2}\right)\right) - z \cdot t\right)}}^{y}\]
    4. Using strategy rm
    5. Applied add-exp-log17.5

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

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

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

    if 3.439646959482297e-130 < y

    1. Initial program 34.1

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

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

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

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

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

Runtime

Time bar (total: 3.5m)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, B"

  :herbie-target
  (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b)))))

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