The Trunk: Kernel-eem.883.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-eem.883.mcz

commits-2
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.883.mcz

==================== Summary ====================

Name: Kernel-eem.883
Author: eem
Time: 19 November 2014, 12:12:39.345 pm
UUID: 2ccdf2d6-38ff-4d1a-87c8-c411b596a068
Ancestors: Kernel-nice.882

Add class inst vars to hold SmallInteger class>>minVal
and maxVal.  Add SmallInteger to the front of the
start-up list.  Update SmallInteger's class comment
with 64-bit info.

=============== Diff against Kernel-nice.882 ===============

Item was changed:
  Integer subclass: #SmallInteger
  instanceVariableNames: ''
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Kernel-Numbers'!
+ SmallInteger class
+ instanceVariableNames: 'minVal maxVal'!
 
+ !SmallInteger commentStamp: 'eem 11/19/2014 12:01' prior: 0!
+ My instances are at least 31-bit numbers, stored in twos complement form. The allowable range in 32-bits is approximately +- 1 10^9 (+- 1billion).  In 64-bits my instances are 61-bit numbers, stored in twos complement form. The allowable range is approximately +- 1^18 (+- 1 quintillion).   The actual values are computed at start-up.  See SmallInteger minVal, maxVal.!
+ SmallInteger class
+ instanceVariableNames: 'minVal maxVal'!
- !SmallInteger commentStamp: '<historical>' prior: 0!
- My instances are 31-bit numbers, stored in twos complement form. The allowable range is approximately +- 1 billion (see SmallInteger minVal, maxVal).!

Item was added:
+ ----- Method: SmallInteger class>>initialize (in category 'class initialization') -----
+ initialize
+ SmalltalkImage current addToStartUpList: self before: Delay.
+ self startUp: true!

Item was added:
+ ----- Method: SmallInteger class>>startUp: (in category 'class initialization') -----
+ startUp: resuming
+ "The image is either being newly started (resuming is true), or it's just been snapshotted.
+ If this has just been a snapshot, skip all the startup stuff."
+ | next val |
+ resuming ifFalse: [^self].
+ val := -32768. "Assume at least 16 bits"
+ [next := val + val.
+ next class == self] whileTrue:
+ [val := next].
+ minVal := val.
+ maxVal := -1 - val!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-eem.883.mcz

David T. Lewis
On Wed, Nov 19, 2014 at 08:12:50PM +0000, [hidden email] wrote:

> Eliot Miranda uploaded a new version of Kernel to project The Trunk:
> http://source.squeak.org/trunk/Kernel-eem.883.mcz
>
> ==================== Summary ====================
>
> Name: Kernel-eem.883
> Author: eem
> Time: 19 November 2014, 12:12:39.345 pm
> UUID: 2ccdf2d6-38ff-4d1a-87c8-c411b596a068
> Ancestors: Kernel-nice.882
>
> Add class inst vars to hold SmallInteger class>>minVal
> and maxVal.  Add SmallInteger to the front of the
> start-up list.  Update SmallInteger's class comment
> with 64-bit info.

This is a very nice implementation, with a good class comment :)

Dave


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-eem.883.mcz

Eliot Miranda-2


On Nov 19, 2014, at 3:24 PM, "David T. Lewis" <[hidden email]> wrote:

> On Wed, Nov 19, 2014 at 08:12:50PM +0000, [hidden email] wrote:
>> Eliot Miranda uploaded a new version of Kernel to project The Trunk:
>> http://source.squeak.org/trunk/Kernel-eem.883.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Kernel-eem.883
>> Author: eem
>> Time: 19 November 2014, 12:12:39.345 pm
>> UUID: 2ccdf2d6-38ff-4d1a-87c8-c411b596a068
>> Ancestors: Kernel-nice.882
>>
>> Add class inst vars to hold SmallInteger class>>minVal
>> and maxVal.  Add SmallInteger to the front of the
>> start-up list.  Update SmallInteger's class comment
>> with 64-bit info.
>
> This is a very nice implementation, with a good class comment :)

Thanks, Dave.  I can't take any credit.  This is essentially how Smalltalk-80 V2 does it (burned in my brain from years ago).  But it was fun looking up quintillion :-)


> Dave

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-eem.883.mcz

David T. Lewis
On Wed, Nov 19, 2014 at 05:18:43PM -0800, Eliot Miranda wrote:

>
>
> On Nov 19, 2014, at 3:24 PM, "David T. Lewis" <[hidden email]> wrote:
>
> > On Wed, Nov 19, 2014 at 08:12:50PM +0000, [hidden email] wrote:
> >> Eliot Miranda uploaded a new version of Kernel to project The Trunk:
> >> http://source.squeak.org/trunk/Kernel-eem.883.mcz
> >>
> >> ==================== Summary ====================
> >>
> >> Name: Kernel-eem.883
> >> Author: eem
> >> Time: 19 November 2014, 12:12:39.345 pm
> >> UUID: 2ccdf2d6-38ff-4d1a-87c8-c411b596a068
> >> Ancestors: Kernel-nice.882
> >>
> >> Add class inst vars to hold SmallInteger class>>minVal
> >> and maxVal.  Add SmallInteger to the front of the
> >> start-up list.  Update SmallInteger's class comment
> >> with 64-bit info.
> >
> > This is a very nice implementation, with a good class comment :)
>
> Thanks, Dave.  I can't take any credit.  This is essentially how Smalltalk-80 V2 does it (burned in my brain from years ago).  But it was fun looking up quintillion :-)
>

On no, I just looked it up on the all-knowing internet and discovered that
quintillion is locale-dependent. Maybe we need a QuintillionPlugin?

;-)

Dave


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-eem.883.mcz

Bert Freudenberg

On 20.11.2014, at 03:53, David T. Lewis <[hidden email]> wrote:

> On Wed, Nov 19, 2014 at 05:18:43PM -0800, Eliot Miranda wrote:
>>
>>
>> On Nov 19, 2014, at 3:24 PM, "David T. Lewis" <[hidden email]> wrote:
>>
>>> On Wed, Nov 19, 2014 at 08:12:50PM +0000, [hidden email] wrote:
>>>> Eliot Miranda uploaded a new version of Kernel to project The Trunk:
>>>> http://source.squeak.org/trunk/Kernel-eem.883.mcz
>>>>
>>>> ==================== Summary ====================
>>>>
>>>> Name: Kernel-eem.883
>>>> Author: eem
>>>> Time: 19 November 2014, 12:12:39.345 pm
>>>> UUID: 2ccdf2d6-38ff-4d1a-87c8-c411b596a068
>>>> Ancestors: Kernel-nice.882
>>>>
>>>> Add class inst vars to hold SmallInteger class>>minVal
>>>> and maxVal.  Add SmallInteger to the front of the
>>>> start-up list.  Update SmallInteger's class comment
>>>> with 64-bit info.
>>>
>>> This is a very nice implementation, with a good class comment :)
>>
>> Thanks, Dave.  I can't take any credit.  This is essentially how Smalltalk-80 V2 does it (burned in my brain from years ago).  But it was fun looking up quintillion :-)
>>
>
> On no, I just looked it up on the all-knowing internet and discovered that
> quintillion is locale-dependent.
Indeed, quintillion sounded way too large to me.

> Maybe we need a QuintillionPlugin?

In Eliot's locale apparently quintillion equals one:

        "The allowable range is approximately +- 1^18 (+- 1 quintillion)."

SmallIntegers from -1 to 1 are indeed rather small ;)

- Bert -






smime.p7s (5K) Download Attachment