Average Error: 29.0 → 0.4
Time: 1.8m
Precision: 64
Internal precision: 128
\[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 -741687408416398.6:\\
\;\;\;\;\left(\frac{t}{z} - 36.527041698806414\right) \cdot \frac{y}{z} + \left(y \cdot 3.13060547623 + x\right)\\
\mathbf{if}\;z \le 7.708214234365678 \cdot 10^{+48}:\\
\;\;\;\;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}:\\
\;\;\;\;\left(\frac{t}{z} - 36.527041698806414\right) \cdot \frac{y}{z} + \left(y \cdot 3.13060547623 + x\right)\\
\end{array}\]
Target
| Original | 29.0 |
| Comparison | 1.2 |
| Herbie | 0.4 |
\[ \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}^2}\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}^2}\right) \cdot \frac{y}{1}\\
\end{array} \]
Derivation
- Split input into 2 regimes.
-
if z < -741687408416398.6 or 7.708214234365678e+48 < z
Initial program 57.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}\]
Applied taylor 7.0
\[\leadsto x + \left(\left(\frac{t \cdot y}{{z}^2} + 3.13060547623 \cdot y\right) - 36.527041698806414 \cdot \frac{y}{z}\right)\]
Taylor expanded around inf 7.0
\[\leadsto x + \color{blue}{\left(\left(\frac{t \cdot y}{{z}^2} + 3.13060547623 \cdot y\right) - 36.527041698806414 \cdot \frac{y}{z}\right)}\]
Applied simplify 0.2
\[\leadsto \color{blue}{\left(\frac{t}{z} - 36.527041698806414\right) \cdot \frac{y}{z} + \left(y \cdot 3.13060547623 + x\right)}\]
if -741687408416398.6 < z < 7.708214234365678e+48
Initial program 1.5
\[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-identity 1.5
\[\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-frac 0.6
\[\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
Please include this information when filing a bug report:
herbie --seed '#(1746587219 3530605687 931079059 713632144 176823923 469485661)'
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, D"
:target
(if (< z -6.499344996252632e+53) (+ x (* (+ (- 3.13060547623 (/ 36.527041698806414 z)) (/ t (sqr 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 (sqr 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))))