Average Error: 29.8 → 0.6
Time: 2.1m
Precision: 64
Internal Precision: 384
\[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\]
↓
\[\begin{array}{l}
\mathbf{if}\;z \le -1.6365020135425002 \cdot 10^{+69}:\\
\;\;\;\;\frac{y}{z} \cdot \left(\frac{t}{z} - 36.527041698806414\right) + \left(x + y \cdot 3.13060547623\right)\\
\mathbf{if}\;z \le 1.9046950652676932 \cdot 10^{+26}:\\
\;\;\;\;x + \frac{y}{1} \cdot \frac{\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot \left(\frac{t}{z} - 36.527041698806414\right) + \left(x + y \cdot 3.13060547623\right)\\
\end{array}\]
Target
| Original | 29.8 |
|---|
| Target | 1.1 |
|---|
| Herbie | 0.6 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \lt -6.499344996252632 \cdot 10^{+53}:\\
\;\;\;\;x + \left(\left(3.13060547623 - \frac{36.527041698806414}{z}\right) + \frac{t}{z \cdot z}\right) \cdot \frac{y}{1}\\
\mathbf{if}\;z \lt 7.066965436914287 \cdot 10^{+59}:\\
\;\;\;\;x + \frac{y}{\frac{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}{\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b}}\\
\mathbf{else}:\\
\;\;\;\;x + \left(\left(3.13060547623 - \frac{36.527041698806414}{z}\right) + \frac{t}{z \cdot z}\right) \cdot \frac{y}{1}\\
\end{array}\]
Derivation
- Split input into 2 regimes
if z < -1.6365020135425002e+69 or 1.9046950652676932e+26 < z
Initial program 59.7
\[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\]
Taylor expanded around inf 7.1
\[\leadsto x + \color{blue}{\left(\left(3.13060547623 \cdot y + \frac{y \cdot t}{{z}^{2}}\right) - 36.527041698806414 \cdot \frac{y}{z}\right)}\]
Applied simplify0.1
\[\leadsto \color{blue}{\frac{y}{z} \cdot \left(\frac{t}{z} - 36.527041698806414\right) + \left(x + y \cdot 3.13060547623\right)}\]
if -1.6365020135425002e+69 < z < 1.9046950652676932e+26
Initial program 2.6
\[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\]
- Using strategy
rm Applied *-un-lft-identity2.6
\[\leadsto x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\color{blue}{1 \cdot \left(\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771\right)}}\]
Applied times-frac1.0
\[\leadsto x + \color{blue}{\frac{y}{1} \cdot \frac{\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}}\]
- Recombined 2 regimes into one program.
- Removed slow
pow expressions.
Runtime
herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, D"
:herbie-target
(if (< z -6.499344996252632e+53) (+ x (* (+ (- 3.13060547623 (/ 36.527041698806414 z)) (/ t (* z z))) (/ y 1))) (if (< z 7.066965436914287e+59) (+ x (/ y (/ (+ (* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z) 0.607771387771) (+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b)))) (+ x (* (+ (- 3.13060547623 (/ 36.527041698806414 z)) (/ t (* z z))) (/ y 1)))))
(+ x (/ (* y (+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b)) (+ (* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z) 0.607771387771))))