Bill Allombert on Fri, 28 May 2010 20:17:00 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: integer representation in pari |
On Fri, May 28, 2010 at 01:42:44PM -0400, Sam Steingold wrote: > On 5/28/10, Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr> wrote: > > * Bill Allombert [2010-05-28 18:26]: > > > On Fri, May 28, 2010 at 11:13:11AM -0400, Sam Steingold wrote: > > > > On 5/27/10, Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr> wrote: > > > > > > > > > > You can also check whether the C macro PARI_KERNEL_GMP is defined, > > > > > but usually it is better to use int_W() to acces the mantissa. > > > > > > > > thanks! > > > > can I also use int_W to access the mantissa of a t_REAL? > > > > (it never explicitly says that, but ...) > > > > > > No you cannot. t_REAL mantissa is always in HIGH bytes first, > > > so this would not work with the GMP kernel. Note that > > > t_REAL mantissa is normalized (i.e. first bit is one). > > > > All this may change (in fact, it *will* change : it is very annoying to > > have different internal representations for t_INTs and t_REALs). > > indeed. > > > In general, direct access to an object's internal representation is > > strongly discouraged. > > understandably so. Well, maybe we could add a t_REAL interface today, but it is not easy to take into account future changes to the format (For example whether the mantissa is normalized, whether we allow unlimited exponents, etc.) Cheers, Bill.