Re: Numeric semantics for base pmcs

2004-08-26 Thread John Siracusa
On Thu, 26 Aug 2004 11:10:59 -0400, Dan Sugalski <[EMAIL PROTECTED]> wrote: > At 10:56 AM -0400 8/26/04, John Siracusa wrote: > >Why make a stop in 32-bit land at all in that case? If the system supports > >64-bit ints, why not use them for everything right up until you promote to > >BigNum? Is

Re: Numeric semantics for base pmcs

2004-08-26 Thread Dan Sugalski
At 10:56 AM -0400 8/26/04, John Siracusa wrote: On Wed, 25 Aug 2004 07:48:03 +0200, Leopold Toetsch <[EMAIL PROTECTED]> wrote: John Siracusa <[EMAIL PROTECTED]> wrote: > On Tue, 24 Aug 2004 14:46:53 -0400, Dan Sugalski <[EMAIL PROTECTED]> wrote: >> The big question is whether being clever and pr

Re: Numeric semantics for base pmcs

2004-08-26 Thread John Siracusa
On Wed, 25 Aug 2004 07:48:03 +0200, Leopold Toetsch <[EMAIL PROTECTED]> wrote: > John Siracusa <[EMAIL PROTECTED]> wrote: > > On Tue, 24 Aug 2004 14:46:53 -0400, Dan Sugalski <[EMAIL PROTECTED]> wrote: > >> The big question is whether being clever and producing the tightest > >> type is worth the t

RE: Numeric semantics for base pmcs

2004-08-25 Thread Butler, Gerald
BigNum is an arbitrary precision decimal number (Think BCD -- Binary Coded Decimal ala the Unix utility BC) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 25, 2004 9:12 AM To: [EMAIL PROTECTED] Subject: RE: Numeric semantics for base pmcs On

RE: Numeric semantics for base pmcs

2004-08-25 Thread Dan Sugalski
At 8:11 AM -0500 8/25/04, [EMAIL PROTECTED] wrote: On Wed, 25 Aug 2004 08:40:32 -0400, "Gay, Jerry" <[EMAIL PROTECTED]> said: Leopold Toetsch <[EMAIL PROTECTED]> wrote: > BigNums grow on demand. It depends on value and precision. > can BigNum then start at sizeof(int)? overflow would auto-grow

RE: Numeric semantics for base pmcs

2004-08-25 Thread [EMAIL PROTECTED]
On Wed, 25 Aug 2004 08:40:32 -0400, "Gay, Jerry" <[EMAIL PROTECTED]> said: > Leopold Toetsch <[EMAIL PROTECTED]> wrote: > > BigNums grow on demand. It depends on value and precision. > > > > can BigNum then start at sizeof(int)? overflow would auto-grow the BigNum > to > the appropriate size, and

RE: Numeric semantics for base pmcs

2004-08-25 Thread Gay, Jerry
Leopold Toetsch <[EMAIL PROTECTED]> wrote: > BigNums grow on demand. It depends on value and precision. > can BigNum then start at sizeof(int)? overflow would auto-grow the BigNum to the appropriate size, and most integer math operations will keep space usage as low as possible. in fact, then i

Re: Numeric semantics for base pmcs

2004-08-25 Thread Piers Cawley
Leopold Toetsch <[EMAIL PROTECTED]> writes: > Dan Sugalski <[EMAIL PROTECTED]> wrote: >> At 8:45 PM +0200 8/24/04, Leopold Toetsch wrote: >>>Dan Sugalski <[EMAIL PROTECTED]> wrote: > Nope -- we don't have bigints. :) >>> >>>Pardon, sir? > >> We've got the big number code, but I don't see muc

Re: Numeric semantics for base pmcs

2004-08-24 Thread Leopold Toetsch
Dan Sugalski <[EMAIL PROTECTED]> wrote: > At 8:45 PM +0200 8/24/04, Leopold Toetsch wrote: >>Dan Sugalski <[EMAIL PROTECTED]> wrote: >>> Nope -- we don't have bigints. :) >> >>Pardon, sir? > We've got the big number code, but I don't see much reason to > distinguish between integers and non-inte

Re: Numeric semantics for base pmcs

2004-08-24 Thread Leopold Toetsch
John Siracusa <[EMAIL PROTECTED]> wrote: > On Tue, 24 Aug 2004 14:46:53 -0400, Dan Sugalski <[EMAIL PROTECTED]> wrote: >> The big question is whether being clever and producing the tightest >> type is worth the time to figure out what that type is, as well as >> the potentially uncertain output typ

Re: Numeric semantics for base pmcs

2004-08-24 Thread Leopold Toetsch
Felix Gallo <[EMAIL PROTECTED]> wrote: > Dan, any feeling about RISC vs. CISC? Because to me, this seems > like a good place to punt, and provide two, maybe three mults: Not the best idea. The same argument would hold for all operations that could overflow. With such a strategy will end with MMD

Re: Numeric semantics for base pmcs

2004-08-24 Thread Sean O'Rourke
At Tue, 24 Aug 2004 15:19:52 -0400, Dan Sugalski wrote: > > At 11:47 AM -0700 8/24/04, Sean O'Rourke wrote: > >At Tue, 24 Aug 2004 13:33:45 -0400, > >Dan Sugalski wrote: > >> 7) Strings are treated as floats for math operations > > > >I think we can do better than this by first converting a strin

Re: Numeric semantics for base pmcs

2004-08-24 Thread Felix Gallo
Nick writes: > 2 * 3 give a bignum. That feels evil. > Except that the way that $a = 2 * 3 will work is that the assignment of > the bignum temporary to $a will cause $a to drop it back to an int > (for most languages' choice of target PMC) ? Dan, any feeling about RISC vs. CISC? Because to me, t

Re: Numeric semantics for base pmcs

2004-08-24 Thread Nicholas Clark
On Tue, Aug 24, 2004 at 03:08:21PM -0400, Dan Sugalski wrote: > At 8:56 PM +0200 8/24/04, Leopold Toetsch wrote: > >Dan Sugalski <[EMAIL PROTECTED]> wrote: > >> 5) Multiplication of two ints produces a bignum or an int, depending > >> on the result > > > >Why that difference? > > At this point I'

Re: Numeric semantics for base pmcs

2004-08-24 Thread Dan Sugalski
At 11:47 AM -0700 8/24/04, Sean O'Rourke wrote: At Tue, 24 Aug 2004 13:33:45 -0400, Dan Sugalski wrote: 6) Division of two ints produces a bignum Where "bignum" means both "bigger than 32-bit integer" and "rational number"? So Yes. 4 / 2 ==> Bignum("2/1") which doesn't get automatically downg

Re: Numeric semantics for base pmcs

2004-08-24 Thread Dan Sugalski
At 8:56 PM +0200 8/24/04, Leopold Toetsch wrote: Dan Sugalski <[EMAIL PROTECTED]> wrote: Okay, so: 4) Addition and subtraction of ints produces an int ??? Yeah, that was wrong. Later fixed. :) 5) Multiplication of two ints produces a bignum or an int, depending on the result Why that differen

Re: Numeric semantics for base pmcs

2004-08-24 Thread Dan Sugalski
At 8:45 PM +0200 8/24/04, Leopold Toetsch wrote: Dan Sugalski <[EMAIL PROTECTED]> wrote: At 1:42 PM -0400 8/24/04, Butler, Gerald wrote: Shouldn't 4 also have potential to produce BigInt? Nope -- we don't have bigints. :) Pardon, sir? We've got the big number code, but I don't see much reason to

Re: Numeric semantics for base pmcs

2004-08-24 Thread Leopold Toetsch
Dan Sugalski <[EMAIL PROTECTED]> wrote: > Okay, so: > 4) Addition and subtraction of ints produces an int ??? > 5) Multiplication of two ints produces a bignum or an int, depending > on the result Why that difference? Int Int gives Bigint or Int (whatever fits) for in (abs, neg, add, sub

Re: Numeric semantics for base pmcs

2004-08-24 Thread Leopold Toetsch
Dan Sugalski <[EMAIL PROTECTED]> wrote: > At 1:42 PM -0400 8/24/04, Butler, Gerald wrote: >>Shouldn't 4 also have potential to produce BigInt? > Nope -- we don't have bigints. :) Pardon, sir? leo

Re: Numeric semantics for base pmcs

2004-08-24 Thread Sean O'Rourke
At Tue, 24 Aug 2004 13:33:45 -0400, Dan Sugalski wrote: > 6) Division of two ints produces a bignum Where "bignum" means both "bigger than 32-bit integer" and "rational number"? So 4 / 2 ==> Bignum("2/1") which doesn't get automatically downgraded to a normal int. Ok. > 7) Strings are tre

Re: Numeric semantics for base pmcs

2004-08-24 Thread John Siracusa
On Tue, 24 Aug 2004 14:46:53 -0400, Dan Sugalski <[EMAIL PROTECTED]> wrote: > The big question is whether being clever and producing the tightest > type is worth the time to figure out what that type is, as well as > the potentially uncertain output type. Tangentially related: will promotion be su

Re: Numeric semantics for base pmcs

2004-08-24 Thread Dan Sugalski
At 1:39 PM -0400 8/24/04, Simon Glover wrote: On Tue, 24 Aug 2004, Dan Sugalski wrote:> 6) Division of two ints produces a bignum Surely it should only produce a bignum as a last resort. For instance, shouldn't: 4 / 3 produce a float? A float or a bignum, both are reasonable. There's that who

Re: Numeric semantics for base pmcs

2004-08-24 Thread Dan Sugalski
At 2:08 PM -0400 8/24/04, Matt Fowles wrote: > >From: Dan Sugalski [mailto:[EMAIL PROTECTED] > >10) The destination PMC is responsible for final conversion of the >inbound value > I know there has been a lot of grumbling in the past about the need to create PMCs to be the LHS of operations. I

RE: Numeric semantics for base pmcs

2004-08-24 Thread Butler, Gerald
Oops. I meant BigNum. -Original Message- From: Dan Sugalski [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 24, 2004 1:47 PM To: Butler, Gerald; '[EMAIL PROTECTED]' Subject: RE: Numeric semantics for base pmcs At 1:42 PM -0400 8/24/04, Butler, Gerald wrote: >Shouldn&

RE: Numeric semantics for base pmcs

2004-08-24 Thread Butler, Gerald
Shouldn't 4 also have potential to produce BigInt? -Original Message- From: Dan Sugalski [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 24, 2004 1:34 PM To: [EMAIL PROTECTED] Subject: Numeric semantics for base pmcs Okay, so: 1) We round to zero when going from float to

Re: Numeric semantics for base pmcs

2004-08-24 Thread Matt Fowles
Dan~ > >-Original Message- > >From: Dan Sugalski [mailto:[EMAIL PROTECTED] > >Sent: Tuesday, August 24, 2004 1:34 PM > >To: [EMAIL PROTECTED] > >Subject: Numeric semantics for base pmcs > > > >10) The destination PMC is responsible for final conv

RE: Numeric semantics for base pmcs

2004-08-24 Thread Dan Sugalski
At 1:42 PM -0400 8/24/04, Butler, Gerald wrote: Shouldn't 4 also have potential to produce BigInt? Nope -- we don't have bigints. :) -Original Message- From: Dan Sugalski [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 24, 2004 1:34 PM To: [EMAIL PROTECTED] Subject: Numeric sem

Re: Numeric semantics for base pmcs

2004-08-24 Thread Simon Glover
On Tue, 24 Aug 2004, Dan Sugalski wrote:> > > 6) Division of two ints produces a bignum Surely it should only produce a bignum as a last resort. For instance, shouldn't: 4 / 3 produce a float? Also, what about a case like: 4 / 2 Does that produce an int, a float or a bignum? > 9) An

Numeric semantics for base pmcs

2004-08-24 Thread Dan Sugalski
Okay, so: 1) We round to zero when going from float to int 2) Overflows, underflows, and division by zero throws an exception 3) All-float operations produce floats 4) Addition and subtraction of ints produces an int 5) Multiplication of two ints produces a bignum or an int, depending on the resul