[sage-devel] Re: request for comments: ZZ(ZZ(FOO).binary(),2) == FOO

2007-06-30 Thread Martin Albrecht
On Saturday 30 June 2007 07:11, Robert Bradshaw wrote: > +1 for little endian-ness. As well as consistency, I think big endian > only makes sense for fixed size words. Otherwise you have to know how > large the number is to know what each digit represents, and it seems > odd to me to, say, subtrac

[sage-devel] Re: request for comments: ZZ(ZZ(FOO).binary(),2) == FOO

2007-06-29 Thread Robert Bradshaw
+1 for little endian-ness. As well as consistency, I think big endian only makes sense for fixed size words. Otherwise you have to know how large the number is to know what each digit represents, and it seems odd to me to, say, subtract and have the result of the 5th and 7th digits be plac

[sage-devel] Re: request for comments: ZZ(ZZ(FOO).binary(),2) == FOO

2007-06-29 Thread Gonzalo Tornaria
After all, Intel has taken over Powerpc even in macs.. ;-) With that as a precedent, if SAGE goes little-endian, while Mathematica is big-endian, it could only mean that... Gonzalo On 6/29/07, David Roe <[EMAIL PROTECTED]> wrote: > I would agree on the little endian-ness. The lists of digits c

[sage-devel] Re: request for comments: ZZ(ZZ(FOO).binary(),2) == FOO

2007-06-29 Thread David Roe
I would agree on the little endian-ness. The lists of digits coming from p-adics (and printing in series mode) is little-endian. It would be nice to be consistent with this. I also agree with David Harvey's arguments. David On 6/29/07, David Harvey <[EMAIL PROTECTED]> wrote: > > > > On Jun 29,

[sage-devel] Re: request for comments: ZZ(ZZ(FOO).binary(),2) == FOO

2007-06-29 Thread David Harvey
On Jun 29, 2007, at 5:51 AM, Martin Albrecht wrote: > > On Friday 29 June 2007 02:48, Nick Alexander wrote: >> Martin Albrecht <[EMAIL PROTECTED]> writes: >>> Hi there, >>> >>> I often come across the situation where I have to construct an >>> integer >>> from its binary representation and vic

[sage-devel] Re: request for comments: ZZ(ZZ(FOO).binary(),2) == FOO

2007-06-29 Thread Martin Albrecht
On Friday 29 June 2007 02:48, Nick Alexander wrote: > Martin Albrecht <[EMAIL PROTECTED]> writes: > > Hi there, > > > > I often come across the situation where I have to construct an integer > > from its binary representation and vice versa. So far you do it in SAGE > > using strings. I have attac

[sage-devel] Re: request for comments: ZZ(ZZ(FOO).binary(),2) == FOO

2007-06-28 Thread Nick Alexander
Martin Albrecht <[EMAIL PROTECTED]> writes: > Hi there, > > I often come across the situation where I have to construct an integer from > its binary representation and vice versa. So far you do it in SAGE using > strings. I have attached a preliminary patch which allows the following code > to

[sage-devel] Re: request for comments: ZZ(ZZ(FOO).binary(),2) == FOO

2007-06-28 Thread David Harvey
On Jun 28, 2007, at 6:06 PM, Martin Albrecht wrote: > >> Hmmm I don't know if I like this. Well, I don't have any objections >> to such a method being available, but I prefer the name "binary" to >> have the current behaviour. It's more pythonic, like the hex >> function. > > But there is no b

[sage-devel] Re: request for comments: ZZ(ZZ(FOO).binary(),2) == FOO

2007-06-28 Thread Martin Albrecht
> Hmmm I don't know if I like this. Well, I don't have any objections > to such a method being available, but I prefer the name "binary" to > have the current behaviour. It's more pythonic, like the hex function. But there is no binary/bin function. I understand that __hex__ returns a string to

[sage-devel] Re: request for comments: ZZ(ZZ(FOO).binary(),2) == FOO

2007-06-28 Thread didier deshommes
On 6/29/07, David Harvey <[EMAIL PROTECTED]> wrote: > > > On Jun 28, 2007, at 5:04 PM, Martin Albrecht wrote: > > > Hi there, > > > > I often come across the situation where I have to construct an > > integer from > > its binary representation and vice versa. So far you do it in SAGE > > using > >

[sage-devel] Re: request for comments: ZZ(ZZ(FOO).binary(),2) == FOO

2007-06-28 Thread David Harvey
On Jun 28, 2007, at 5:04 PM, Martin Albrecht wrote: > Hi there, > > I often come across the situation where I have to construct an > integer from > its binary representation and vice versa. So far you do it in SAGE > using > strings. I have attached a preliminary patch which allows the > f