Average Error: 20.2 → 0.1
Time: 2.0m
Precision: 64
Internal Precision: 384
\[x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\]
↓
\[\begin{array}{l}
\mathbf{if}\;z \le -354554309650.3642:\\
\;\;\;\;\left(x + y \cdot 0.0692910599291889\right) - \frac{y}{z} \cdot \left(\frac{0.40462203869992125}{z} - 0.07512208616047561\right)\\
\mathbf{if}\;z \le 1.1570910217973246 \cdot 10^{-07}:\\
\;\;\;\;x + \frac{y}{\sqrt{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}} \cdot \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\sqrt{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y \cdot 0.0692910599291889\right) - \frac{y}{z} \cdot \left(\frac{0.40462203869992125}{z} - 0.07512208616047561\right)\\
\end{array}\]
Target
| Original | 20.2 |
|---|
| Target | 0.4 |
|---|
| Herbie | 0.1 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \lt -8120153.652456675:\\
\;\;\;\;\left(\frac{0.07512208616047561}{z} + 0.0692910599291889\right) \cdot y - \left(\frac{0.40462203869992125 \cdot y}{z \cdot z} - x\right)\\
\mathbf{if}\;z \lt 6.576118972787377 \cdot 10^{+20}:\\
\;\;\;\;x + \left(y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)\right) \cdot \frac{1}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{0.07512208616047561}{z} + 0.0692910599291889\right) \cdot y - \left(\frac{0.40462203869992125 \cdot y}{z \cdot z} - x\right)\\
\end{array}\]
Derivation
- Split input into 2 regimes
if z < -354554309650.3642 or 1.1570910217973246e-07 < z
Initial program 40.2
\[x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\]
Taylor expanded around inf 0.0
\[\leadsto x + \color{blue}{\left(\left(0.07512208616047561 \cdot \frac{y}{z} + 0.0692910599291889 \cdot y\right) - 0.40462203869992125 \cdot \frac{y}{{z}^{2}}\right)}\]
Applied simplify0.0
\[\leadsto \color{blue}{\left(x + y \cdot 0.0692910599291889\right) - \frac{y}{z} \cdot \left(\frac{0.40462203869992125}{z} - 0.07512208616047561\right)}\]
if -354554309650.3642 < z < 1.1570910217973246e-07
Initial program 0.1
\[x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\]
- Using strategy
rm Applied add-sqr-sqrt0.4
\[\leadsto x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\color{blue}{\sqrt{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304} \cdot \sqrt{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}}}\]
Applied times-frac0.1
\[\leadsto x + \color{blue}{\frac{y}{\sqrt{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}} \cdot \frac{\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525}{\sqrt{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}}}\]
- 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)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, B"
:herbie-target
(if (< z -8120153.652456675) (- (* (+ (/ 0.07512208616047561 z) 0.0692910599291889) y) (- (/ (* 0.40462203869992125 y) (* z z)) x)) (if (< z 6.576118972787377e+20) (+ x (* (* y (+ (* (+ (* z 0.0692910599291889) 0.4917317610505968) z) 0.279195317918525)) (/ 1 (+ (* (+ z 6.012459259764103) z) 3.350343815022304)))) (- (* (+ (/ 0.07512208616047561 z) 0.0692910599291889) y) (- (/ (* 0.40462203869992125 y) (* z z)) x))))
(+ x (/ (* y (+ (* (+ (* z 0.0692910599291889) 0.4917317610505968) z) 0.279195317918525)) (+ (* (+ z 6.012459259764103) z) 3.350343815022304))))