Chris Muller uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-cmm.808.mcz
==================== Summary ====================
Name: Tools-cmm.808
Author: cmm
Time: 28 April 2018, 3:27:07.649576 pm
UUID: 941a22f6-3add-4476-951b-65c2ad89ba4b
Ancestors: Tools-cmm.807
Fix UndefinedObject DNU #isUniClass when opening a MessageSet containing invalid MethodReferences.
=============== Diff against Tools-cmm.807 ===============
Item was changed:
----- Method: MessageSet>>initializeMessageList: (in category 'private') -----
initializeMessageList: anArray
"Initialize my messageList from the given list of MethodReference or string objects. NB: special handling for uniclasses.
+ Do /not/ replace the elements of anArray if they are already MethodReferences, so as to allow users to construct richer systems, such as differencers between existing and edited versions of code."
- Do /not/ replace the elements of anArray if they are already MethodReferences, so as to allow users to construct richer
- systems, such as differencers between existing and edited versions of code."
-
messageList := OrderedCollection new.
anArray do: [:each |
each isMethodReference
ifTrue: [messageList addLast: each]
ifFalse: [MessageSet parse: each toClassAndSelector: [ :class :sel |
class ifNotNil: [
messageList addLast: (
MethodReference new
class: class
selector: sel)] ]]].
-
"Unify labels if wanted."
self class useUnifiedMessageLabels ifTrue: [
messageList do: [:each | | cls |
cls := each actualClass.
+ each stringVersion:
+ (cls
+ ifNil: [each asString]
+ ifNotNil:
+ [cls isUniClass
+ ifTrue: [cls typicalInstanceName, ' ', each selector]
+ ifFalse: [cls name , ' ' , each selector , ' {' ,
+ ((cls organization categoryOfElement: each selector) ifNil: ['']) , '}' ,
+ ' {', cls category, '}']])]].
- each stringVersion: (cls isUniClass
- ifTrue: [cls typicalInstanceName, ' ', each selector]
- ifFalse: [cls name , ' ' , each selector , ' {' ,
- ((cls organization categoryOfElement: each selector) ifNil: ['']) , '}' ,
- ' {', cls category, '}'])]].
-
messageListIndex := messageList isEmpty ifTrue: [0] ifFalse: [1].
contents := ''!
Bert Freudenberg uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-bf.787.mcz
==================== Summary ====================
Name: Collections-bf.787
Author: bf
Time: 26 April 2018, 1:25:29.283438 pm
UUID: ed53996c-b8a6-40b7-a186-37ec55737b62
Ancestors: Collections-pre.786
Allow to write Strings to binary WriteStream.
=============== Diff against Collections-pre.786 ===============
Item was changed:
----- Method: WriteStream>>nextPutAll: (in category 'accessing') -----
nextPutAll: aCollection
| newEnd |
(collection class == aCollection class
+ or: [ collection class isBits
- or: [ collection isString
and: [ aCollection isString
and: [ collection class format = aCollection class format ] ] ]) "Let Strings with the same field size as collection take the quick route too."
ifFalse: [ ^ super nextPutAll: aCollection ].
newEnd := position + aCollection size.
newEnd > writeLimit ifTrue:
[self growTo: newEnd + 10].
collection replaceFrom: position+1 to: newEnd with: aCollection startingAt: 1.
position := newEnd.
^aCollection!
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.1168.mcz
==================== Summary ====================
Name: Kernel-nice.1168
Author: nice
Time: 26 April 2018, 11:40:17.923908 am
UUID: fa008d75-249a-b243-8b1e-068eeb72a45d
Ancestors: Kernel-nice.1167
Change asApproximateFraction to allow prescribing a relative decimal precision
Example:
(FloatArray with: 1/3) first
asApproximateFractionRelativeDecimalPlaces: 6.
0.6667 asApproximateFractionRelativeDecimalPlaces: 3.
0.6667 asApproximateFractionRelativeDecimalPlaces: 5.
=============== Diff against Kernel-nice.1167 ===============
Item was changed:
----- Method: Float>>asApproximateFraction (in category 'converting') -----
asApproximateFraction
"Answer a Fraction approximating the receiver. This conversion uses the
continued fraction method to approximate a floating point number."
+ ^ self asApproximateFractionRelativeDecimalPlaces: 10!
- ^ self asApproximateFractionAtOrder: 0!
Item was changed:
----- Method: Float>>asApproximateFractionAtOrder: (in category 'converting') -----
asApproximateFractionAtOrder: maxOrder
"Answer a Fraction approximating the receiver. This conversion uses the
continued fraction method to approximate a floating point number. If maxOrder
is zero, use maximum order"
+ ^self
+ asApproximateFractionAtOrder: maxOrder
+ precision: self ulp / 2!
- | num1 denom1 num2 denom2 int frac newD temp order |
- num1 := self asInteger. "The first of two alternating numerators"
- denom1 := 1. "The first of two alternating denominators"
- num2 := 1. "The second numerator"
- denom2 := 0. "The second denominator--will update"
- int := num1. "The integer part of self"
- frac := self fractionPart. "The fractional part of self"
- order := maxOrder = 0 ifTrue: [-1] ifFalse: [maxOrder].
- [frac = 0 or: [order = 0] ]
- whileFalse:
- ["repeat while the fractional part is not zero and max order is not reached"
- order := order - 1.
- newD := 1.0 / frac. "Take reciprocal of the fractional part"
- int := newD asInteger. "get the integer part of this"
- frac := newD fractionPart. "and save the fractional part for next time"
- temp := num2. "Get old numerator and save it"
- num2 := num1. "Set second numerator to first"
- num1 := num1 * int + temp. "Update first numerator"
- temp := denom2. "Get old denominator and save it"
- denom2 := denom1. "Set second denominator to first"
- denom1 := int * denom1 + temp. "Update first denominator"
- 10000000000.0 < denom1
- ifTrue:
- ["Is ratio past float precision? If so, pick which
- of the two ratios to use"
- num2 = 0.0
- ifTrue: ["Is second denominator 0?"
- ^ Fraction numerator: num1 denominator: denom1].
- ^ Fraction numerator: num2 denominator: denom2]].
- "If fractional part is zero, return the first ratio"
- denom1 = 1
- ifTrue: ["Am I really an Integer?"
- ^ num1 "Yes, return Integer result"]
- ifFalse: ["Otherwise return Fraction result"
- ^ Fraction numerator: num1 denominator: denom1]!
Item was added:
+ ----- Method: Float>>asApproximateFractionAtOrder:precision: (in category 'converting') -----
+ asApproximateFractionAtOrder: maxOrder precision: limit
+ "Answer a Rational number--Integer or Fraction--representing the receiver.
+ This conversion uses the continued fraction method to approximate a floating point number.
+ The iteration stops when precision has reached the prescribed limit,
+ or when the maximum number of iterations has been reached.
+ If maxOrder is zero, then the number of iterations is not limited."
+
+ | num1 denom1 num2 denom2 int frac newD order |
+ newD := self asFraction. "use exact arithmetic to avoid both overflow and accumulation of rounding errors"
+ num1 := denom2 := 1. "Initialize alternating numerators"
+ num2 := denom1 := 0. "and denominators"
+ order := maxOrder = 0 ifTrue: [-1] ifFalse: [maxOrder].
+ [int := newD integerPart. "get the integer part of this"
+ frac := newD fractionPart. "and save the fractional part for next time"
+ num1 := num2 + ((num2 := num1) * int). "Update numerators"
+ denom1 := denom2 + ((denom2 := denom1) * int). "and denominators"
+ frac = 0
+ or: [order = 0
+ or: [((Fraction numerator: num1 denominator: denom1) - self) abs <= limit]]]
+ whileFalse:
+ [newD := frac reciprocal "Take reciprocal of the fractional part".
+ order := order - 1].
+ ^denom1 = 1
+ ifTrue: ["Am i really an Integer?"
+ num1"Yes, return Integer result"]
+ ifFalse: ["Otherwise return Fraction result"
+ Fraction numerator: num1 denominator: denom1]!
Item was added:
+ ----- Method: Float>>asApproximateFractionRelativeDecimalPlaces: (in category 'converting') -----
+ asApproximateFractionRelativeDecimalPlaces: decimalPlaces
+ "Answer a Fraction approximating the receiver. This conversion uses the
+ continued fraction method to approximate a floating point number.
+ Stop the recursion when precision has reached prescribed number of relative decimalPlaces."
+
+ ^ self
+ asApproximateFractionAtOrder: 0
+ precision: (1.0 timesTwoPower: self exponent - (decimalPlaces * Ln10 / Ln2) rounded)!
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.1167.mcz
==================== Summary ====================
Name: Kernel-nice.1167
Author: nice
Time: 25 April 2018, 11:09:01.928037 am
UUID: fd3a4e4a-925e-1842-9c73-f7f5736dd21c
Ancestors: Kernel-eem.1166
I shall not invoke super floorLog: with a different radix.
Ouch, probably a remnant from my ancestor method floorLog10 that I generalized.
=============== Diff against Kernel-eem.1166 ===============
Item was changed:
----- Method: Fraction>>floorLog: (in category 'mathematical functions') -----
floorLog: radix
"Unlike super, this version is exact when radix is integer"
| d n |
+ radix isInteger ifFalse: [^super floorLog: radix].
- radix isInteger ifFalse: [^super floorLog: 10].
n := numerator floorLog: radix.
d := denominator floorLog: radix.
^(numerator * (radix raisedTo: d))
< (denominator * (radix raisedTo: n))
ifTrue: [n - d - 1]
ifFalse: [n - d]!
Item was changed:
----- Method: Integer>>floorLog: (in category 'mathematical functions') -----
floorLog: radix
"Unlike super, this version is exact when radix is integer"
+ radix isInteger ifFalse: [^super floorLog: radix].
- radix isInteger ifFalse: [^super floorLog: 10].
self <= 0 ifTrue: [^DomainError signal: 'floorLog: is only defined for x > 0.0'].
^(self numberOfDigitsInBase: radix) - 1!
Marcel Taeumel uploaded a new version of Chronology-Core to project The Trunk:
http://source.squeak.org/trunk/Chronology-Core-tcj.12.mcz
==================== Summary ====================
Name: Chronology-Core-tcj.12
Author: tcj
Time: 24 April 2018, 2:19:04.161964 pm
UUID: 4374e394-3435-4377-afdc-1d19fac9ad83
Ancestors: Chronology-Core-mt.11
Add edc's method to create a DateAndTime from a given UNIX time value.
=============== Diff against Chronology-Core-mt.11 ===============
Item was added:
+ ----- Method: DateAndTime class>>fromUnixTime: (in category 'squeak protocol') -----
+ fromUnixTime: aNumber
+
+
+ ^ self fromSeconds: aNumber + self unixEpoch asSeconds!
Chris Muller uploaded a new version of SMBase to project The Trunk:
http://source.squeak.org/trunk/SMBase-cmm.139.mcz
==================== Summary ====================
Name: SMBase-cmm.139
Author: cmm
Time: 24 April 2018, 10:15:36.055101 pm
UUID: d3386bdd-19dc-4431-b09f-7745471ef8df
Ancestors: SMBase-cmm.139
When creating new package Releases, use the script of the selected ancestor as the template, because usually it's just some package #'s that need updating.
The new informative template script is used when creating the first Release, or by selecting the Package itself, instead of one of its Releases.
=============== Diff against SMBase-cmm.139 ===============