Hi,
Jason Grout wrote:
> sage: pari(RealField(500)(10)).eint1().python()
> 4.15696892968532427740285981027818038434629008241953313262759569712786222819608803586147163177527802101305497591041862309918139192016097135380721447598904e-6
> sage: RealField(500)(10).eint()
> 2492.22897624187775913844014399852484898964710143094234538818526713774122742888744417794599665663156560488342454657568480015672868779475213684965774390
> sage:
> sage: pari(RealField(500)(-10)).eint1().python()
> -2492.22897624187775913844014399852484898964710143094234538818526713774122742888744417794599665663156560488342454657568480015672868779475213684965774390402
> sage: RealField(500)(-10).eint()
> NaN
the RealField() results correspond to the definition of eint in mpfr:
-- Function: int mpfr_eint (mpfr_t Y, mpfr_t X, mp_rnd_t RND)
Set Y to the exponential integral of X, rounded in the direction
RND. For positive X, the exponential integral is the sum of
Euler's constant, of the logarithm of X, and of the sum for k from
1 to infinity of X to the power k, divided by k and factorial(k).
For negative X, the returned value is NaN.
and Carl Witty wrote:
> Actually, Sage doesn't print the entire value for floating-point
> numbers by default; it leaves a few digits off the end, so the
> potential binary->decimal conversion error above is a lot more than
> 1/2 ulp. To get the entire within-1/2-ulp decimal value, you can use:
>
> sage: RealField(150)(10).eint().str(truncate=False)
> '2492.2289762418777591384401439985248489896471010'
thank you Carl for pointing out that. This means that the total error is
less that 1/2 ulp on the binary value, plus 1/2 ulp on the decimal conversion
(with truncate=False), or plus 0.5005 ulp on the default printing if 3 digits
are left off (assuming rounding to nearest).
Paul Zimmermann
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---