Average Error: 25.7 → 0.6
Time: 2.7m
Precision: 64
Internal precision: 128
\[\frac{\left(x - 2.0\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606}\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.1392156119995164 \cdot 10^{+40}:\\ \;\;\;\;\left(\frac{y}{{x}^2} + 4.16438922228 \cdot x\right) - 110.1139242984811\\ \mathbf{if}\;x \le 3.559627588458501 \cdot 10^{+81}:\\ \;\;\;\;\frac{x - 2.0}{1} \cdot \frac{\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{{x}^2} + 4.16438922228 \cdot x\right) - 110.1139242984811\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original25.7
Comparison0.6
Herbie0.6
\[ \begin{array}{l} \mathbf{if}\;x \lt -3.326128725870005 \cdot 10^{+62}:\\ \;\;\;\;\left(\frac{y}{{x}^2} + 4.16438922228 \cdot x\right) - 110.1139242984811\\ \mathbf{if}\;x \lt 9.429991714554673 \cdot 10^{+55}:\\ \;\;\;\;\frac{x - 2.0}{1} \cdot \frac{\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z}{\left(\left(263.505074721 \cdot x + \left(43.3400022514 \cdot {x}^2 + x \cdot \left(x \cdot x\right)\right)\right) + 313.399215894\right) \cdot x + 47.066876606}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{{x}^2} + 4.16438922228 \cdot x\right) - 110.1139242984811\\ \end{array} \]

Derivation

  1. Split input into 3 regimes.
  2. if x < -3.1392156119995164e+40

    1. Initial program 60.5

      \[\frac{\left(x - 2.0\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606}\]
    2. Applied taylor 0.0

      \[\leadsto \left(\frac{y}{{x}^2} + 4.16438922228 \cdot x\right) - 110.1139242984811\]
    3. Taylor expanded around inf 0.0

      \[\leadsto \color{blue}{\left(\frac{y}{{x}^2} + 4.16438922228 \cdot x\right) - 110.1139242984811}\]

    if -3.1392156119995164e+40 < x < 3.559627588458501e+81

    1. Initial program 3.0

      \[\frac{\left(x - 2.0\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity 3.0

      \[\leadsto \frac{\left(x - 2.0\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z\right)}{\color{blue}{1 \cdot \left(\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606\right)}}\]
    4. Applied times-frac 1.0

      \[\leadsto \color{blue}{\frac{x - 2.0}{1} \cdot \frac{\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606}}\]

    if 3.559627588458501e+81 < x

    1. Initial program 60.2

      \[\frac{\left(x - 2.0\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606}\]
    2. Applied taylor 0.0

      \[\leadsto \left(\frac{y}{{x}^2} + 4.16438922228 \cdot x\right) - 110.1139242984811\]
    3. Taylor expanded around inf 0.0

      \[\leadsto \color{blue}{\left(\frac{y}{{x}^2} + 4.16438922228 \cdot x\right) - 110.1139242984811}\]
  3. Recombined 3 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 2.7m) Debug log

Please include this information when filing a bug report:

herbie --seed '#(1572477294 1552864242 205090021 3762437538 2051865600 724360943)'
(FPCore (x y z)
  :name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, C"

  :target
  (if (< x -3.326128725870005e+62) (- (+ (/ y (sqr x)) (* 4.16438922228 x)) 110.1139242984811) (if (< x 9.429991714554673e+55) (* (/ (- x 2.0) 1) (/ (+ (* (+ (* (+ (* (+ (* x 4.16438922228) 78.6994924154) x) 137.519416416) x) y) x) z) (+ (* (+ (+ (* 263.505074721 x) (+ (* 43.3400022514 (sqr x)) (* x (* x x)))) 313.399215894) x) 47.066876606))) (- (+ (/ y (sqr x)) (* 4.16438922228 x)) 110.1139242984811)))

  (/ (* (- x 2.0) (+ (* (+ (* (+ (* (+ (* x 4.16438922228) 78.6994924154) x) 137.519416416) x) y) x) z)) (+ (* (+ (* (+ (* (+ x 43.3400022514) x) 263.505074721) x) 313.399215894) x) 47.066876606)))