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}\]
Target
| Original | 24.1 |
| Comparison | 29.6 |
| Herbie | 1.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
- Split input into 3 regimes.
-
if y < -6.408792807834615e+52 or 1.4591773572605082e-06 < y
Initial program 36.4
\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1.0\right) \cdot \log a\right) - b}}{y}\]
Applied simplify 27.1
\[\leadsto \color{blue}{\frac{{z}^{y} \cdot \frac{x}{y}}{\frac{e^{b}}{{a}^{\left(t - 1.0\right)}}}}\]
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)}\]
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)}}\]
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
Initial program 23.4
\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1.0\right) \cdot \log a\right) - b}}{y}\]
Applied simplify 45.3
\[\leadsto \color{blue}{\frac{{z}^{y} \cdot \frac{x}{y}}{\frac{e^{b}}{{a}^{\left(t - 1.0\right)}}}}\]
- Using strategy
rm
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)}}}}\]
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)}}}\]
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)}}\]
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
Initial program 3.6
\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1.0\right) \cdot \log a\right) - b}}{y}\]
Applied simplify 18.4
\[\leadsto \color{blue}{\frac{{z}^{y} \cdot \frac{x}{y}}{\frac{e^{b}}{{a}^{\left(t - 1.0\right)}}}}\]
- Using strategy
rm
Applied associate-*r/ 18.4
\[\leadsto \frac{\color{blue}{\frac{{z}^{y} \cdot x}{y}}}{\frac{e^{b}}{{a}^{\left(t - 1.0\right)}}}\]
Applied associate-/l/ 9.5
\[\leadsto \color{blue}{\frac{{z}^{y} \cdot x}{\frac{e^{b}}{{a}^{\left(t - 1.0\right)}} \cdot y}}\]
- Using strategy
rm
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}\]
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}\]
- Recombined 3 regimes into one program.
- Removed slow pow expressions
Runtime
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))