(FPCore (x y z)
:precision binary64
(/
(*
(- 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)))(FPCore (x y z)
:precision binary64
(if (<= x -8.740636302896971e+72)
(* x 4.16438922228)
(if (<= x 5.231744192883358e+71)
(*
(- x 2.0)
(/
(fma
x
(+
(* (* x x) (fma x 4.16438922228 78.6994924154))
(fma x 137.519416416 y))
z)
(fma
x
(fma x (fma x (+ x 43.3400022514) 263.505074721) 313.399215894)
47.066876606)))
(* x 4.16438922228))))double code(double x, double y, double z) {
return ((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);
}
double code(double x, double y, double z) {
double tmp;
if (x <= -8.740636302896971e+72) {
tmp = x * 4.16438922228;
} else if (x <= 5.231744192883358e+71) {
tmp = (x - 2.0) * (fma(x, (((x * x) * fma(x, 4.16438922228, 78.6994924154)) + fma(x, 137.519416416, y)), z) / fma(x, fma(x, fma(x, (x + 43.3400022514), 263.505074721), 313.399215894), 47.066876606));
} else {
tmp = x * 4.16438922228;
}
return tmp;
}
function code(x, y, z) return Float64(Float64(Float64(x - 2.0) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 4.16438922228) + 78.6994924154) * x) + 137.519416416) * x) + y) * x) + z)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(x + 43.3400022514) * x) + 263.505074721) * x) + 313.399215894) * x) + 47.066876606)) end
function code(x, y, z) tmp = 0.0 if (x <= -8.740636302896971e+72) tmp = Float64(x * 4.16438922228); elseif (x <= 5.231744192883358e+71) tmp = Float64(Float64(x - 2.0) * Float64(fma(x, Float64(Float64(Float64(x * x) * fma(x, 4.16438922228, 78.6994924154)) + fma(x, 137.519416416, y)), z) / fma(x, fma(x, fma(x, Float64(x + 43.3400022514), 263.505074721), 313.399215894), 47.066876606))); else tmp = Float64(x * 4.16438922228); end return tmp end
code[x_, y_, z_] := N[(N[(N[(x - 2.0), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(N[(x * 4.16438922228), $MachinePrecision] + 78.6994924154), $MachinePrecision] * x), $MachinePrecision] + 137.519416416), $MachinePrecision] * x), $MachinePrecision] + y), $MachinePrecision] * x), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(x + 43.3400022514), $MachinePrecision] * x), $MachinePrecision] + 263.505074721), $MachinePrecision] * x), $MachinePrecision] + 313.399215894), $MachinePrecision] * x), $MachinePrecision] + 47.066876606), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := If[LessEqual[x, -8.740636302896971e+72], N[(x * 4.16438922228), $MachinePrecision], If[LessEqual[x, 5.231744192883358e+71], N[(N[(x - 2.0), $MachinePrecision] * N[(N[(x * N[(N[(N[(x * x), $MachinePrecision] * N[(x * 4.16438922228 + 78.6994924154), $MachinePrecision]), $MachinePrecision] + N[(x * 137.519416416 + y), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] / N[(x * N[(x * N[(x * N[(x + 43.3400022514), $MachinePrecision] + 263.505074721), $MachinePrecision] + 313.399215894), $MachinePrecision] + 47.066876606), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 4.16438922228), $MachinePrecision]]]
\frac{\left(x - 2\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 \leq -8.740636302896971 \cdot 10^{+72}:\\
\;\;\;\;x \cdot 4.16438922228\\
\mathbf{elif}\;x \leq 5.231744192883358 \cdot 10^{+71}:\\
\;\;\;\;\left(x - 2\right) \cdot \frac{\mathsf{fma}\left(x, \left(x \cdot x\right) \cdot \mathsf{fma}\left(x, 4.16438922228, 78.6994924154\right) + \mathsf{fma}\left(x, 137.519416416, y\right), z\right)}{\mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, x + 43.3400022514, 263.505074721\right), 313.399215894\right), 47.066876606\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 4.16438922228\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 27.2 |
|---|---|
| Target | 0.8 |
| Herbie | 1.1 |
if x < -8.74063630289697097e72 or 5.23174419288335799e71 < x Initial program 64.0
Applied *-un-lft-identity_binary6464.0
Applied times-frac_binary6462.8
Simplified62.8
Simplified62.8
Applied add-sqr-sqrt_binary6462.8
Applied *-un-lft-identity_binary6462.8
Applied times-frac_binary6462.9
Applied associate-*r*_binary6462.9
Taylor expanded in x around inf 1.3
Simplified1.3
if -8.74063630289697097e72 < x < 5.23174419288335799e71Initial program 3.6
Applied *-un-lft-identity_binary643.6
Applied times-frac_binary641.0
Simplified1.0
Simplified1.0
Taylor expanded in x around 0 1.0
Simplified1.0
Final simplification1.1
herbie shell --seed 2022130
(FPCore (x y z)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, C"
:precision binary64
:herbie-target
(if (< x -3.326128725870005e+62) (- (+ (/ y (* x x)) (* 4.16438922228 x)) 110.1139242984811) (if (< x 9.429991714554673e+55) (* (/ (- x 2.0) 1.0) (/ (+ (* (+ (* (+ (* (+ (* x 4.16438922228) 78.6994924154) x) 137.519416416) x) y) x) z) (+ (* (+ (+ (* 263.505074721 x) (+ (* 43.3400022514 (* x x)) (* x (* x x)))) 313.399215894) x) 47.066876606))) (- (+ (/ y (* x 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)))