Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.647.mcz
==================== Summary ====================
Name: Kernel-nice.647
Author: nice
Time: 2 November 2011, 7:50:14.247 pm
UUID: 68374059-00c3-4605-bfb3-615f3793071a
Ancestors: Kernel-nice.646
Optimize #ln and #log as in Pharo.
1) SmallInteger just inherits from super (^self asFloat log)
2) LargePositiveInteger can avoid self > à guard
3) LargeNegativeInteger can goto Error (no raise, just kidding)
4) Fraction can avoid arithmetic because (a/b) log = (a log - b log) and because a log or b log are unlikely to overflow - (10 raisedTo: (10 raisedTo: 308)) is likely to exhaust your memory before any overflow occurs ;).
=============== Diff against Kernel-nice.646 ===============
Item was changed:
----- Method: Fraction>>ln (in category 'mathematical functions') -----
ln
+ "This function is defined because super ln might overflow."
+ | res |
- "This function is defined because super ln might overflow.
- Note that < 1 is tested before converting to float in order to avoid precision loss due to gradual underflow."
- | res int |
self <= 0 ifTrue: [DomainError signal: 'ln is only defined for x > 0'].
+ "Test self < 1 before converting to float in order to avoid precision loss due to gradual underflow."
+ numerator < denominator ifTrue: [^self reciprocal ln negated].
- self < 1 ifTrue: [^self reciprocal ln negated].
res := super ln.
res isFinite ifTrue: [^res].
+ ^numerator ln - denominator ln!
- int := self integerPart.
- ^int ln + (self / int) ln!
Item was changed:
----- Method: Fraction>>log (in category 'mathematical functions') -----
log
+ "This function is defined because super log might overflow."
+ | res |
- "This function is defined because super log might overflow.
- Note that < 1 is tested before converting to float in order to avoid precision loss due to gradual underflow."
- | res int |
self <= 0 ifTrue: [DomainError signal: 'log is only defined for x > 0'].
+ "Test self < 1 before converting to float in order to avoid precision loss due to gradual underflow."
+ numerator < denominator ifTrue: [^self reciprocal log negated].
- self < 1 ifTrue: [^self reciprocal log negated].
res := super log.
res isFinite ifTrue: [^res].
+ ^numerator log - denominator log!
- int := self integerPart.
- ^int log + (self / int) log!
Item was removed:
- ----- Method: Integer>>ln (in category 'mathematical functions') -----
- ln
- "This function is defined because super ln might overflow."
- | res h |
- self <= 0 ifTrue: [DomainError signal: 'ln is only defined for x > 0'].
- res := super ln.
- res isFinite ifTrue: [^res].
- h := self highBit.
- ^2 ln * h + (self / (1 << h)) asFloat ln!
Item was removed:
- ----- Method: Integer>>log (in category 'mathematical functions') -----
- log
- "This function is defined because super log might overflow."
- | res h |
- self <= 0 ifTrue: [DomainError signal: 'log is only defined for x > 0'].
- res := super log.
- res isFinite ifTrue: [^res].
- h := self highBit.
- ^2 log * h + (self / (1 << h)) asFloat log!
Item was added:
+ ----- Method: LargeNegativeInteger>>ln (in category 'mathematical functions') -----
+ ln
+ ^DomainError signal: 'ln is only defined for x > 0' from: 0!
Item was added:
+ ----- Method: LargeNegativeInteger>>log (in category 'mathematical functions') -----
+ log
+ ^DomainError signal: 'log is only defined for x > 0' from: 0!
Item was added:
+ ----- Method: LargePositiveInteger>>ln (in category 'mathematical functions') -----
+ ln
+ "This function is defined because super ln might overflow."
+ | res h |
+ res := super ln.
+ res isFinite ifTrue: [^res].
+ h := self highBit.
+ ^2 ln * h + (self / (1 << h)) asFloat ln!
Item was added:
+ ----- Method: LargePositiveInteger>>log (in category 'mathematical functions') -----
+ log
+ "This function is defined because super log might overflow."
+ | res h |
+ res := super log.
+ res isFinite ifTrue: [^res].
+ h := self highBit.
+ ^2 log * h + (self / (1 << h)) asFloat log!
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.647.mcz
==================== Summary ====================
Name: Kernel-nice.647
Author: nice
Time: 2 November 2011, 7:50:14.247 pm
UUID: 68374059-00c3-4605-bfb3-615f3793071a
Ancestors: Kernel-nice.646
Optimize #ln and #log as in Pharo.
1) SmallInteger just inherits from super (^self asFloat log)
2) LargePositiveInteger can avoid self > à guard
3) LargeNegativeInteger can goto Error (no raise, just kidding)
4) Fraction can avoid arithmetic because (a/b) log = (a log - b log) and because a log or b log are unlikely to overflow - (10 raisedTo: (10 raisedTo: 308)) is likely to exhaust your memory before any overflow occurs ;).
=============== Diff against Kernel-nice.646 ===============
Item was changed:
----- Method: Fraction>>ln (in category 'mathematical functions') -----
ln
+ "This function is defined because super ln might overflow."
+ | res |
- "This function is defined because super ln might overflow.
- Note that < 1 is tested before converting to float in order to avoid precision loss due to gradual underflow."
- | res int |
self <= 0 ifTrue: [DomainError signal: 'ln is only defined for x > 0'].
+ "Test self < 1 before converting to float in order to avoid precision loss due to gradual underflow."
+ numerator < denominator ifTrue: [^self reciprocal ln negated].
- self < 1 ifTrue: [^self reciprocal ln negated].
res := super ln.
res isFinite ifTrue: [^res].
+ ^numerator ln - denominator ln!
- int := self integerPart.
- ^int ln + (self / int) ln!
Item was changed:
----- Method: Fraction>>log (in category 'mathematical functions') -----
log
+ "This function is defined because super log might overflow."
+ | res |
- "This function is defined because super log might overflow.
- Note that < 1 is tested before converting to float in order to avoid precision loss due to gradual underflow."
- | res int |
self <= 0 ifTrue: [DomainError signal: 'log is only defined for x > 0'].
+ "Test self < 1 before converting to float in order to avoid precision loss due to gradual underflow."
+ numerator < denominator ifTrue: [^self reciprocal log negated].
- self < 1 ifTrue: [^self reciprocal log negated].
res := super log.
res isFinite ifTrue: [^res].
+ ^numerator log - denominator log!
- int := self integerPart.
- ^int log + (self / int) log!
Item was removed:
- ----- Method: Integer>>ln (in category 'mathematical functions') -----
- ln
- "This function is defined because super ln might overflow."
- | res h |
- self <= 0 ifTrue: [DomainError signal: 'ln is only defined for x > 0'].
- res := super ln.
- res isFinite ifTrue: [^res].
- h := self highBit.
- ^2 ln * h + (self / (1 << h)) asFloat ln!
Item was removed:
- ----- Method: Integer>>log (in category 'mathematical functions') -----
- log
- "This function is defined because super log might overflow."
- | res h |
- self <= 0 ifTrue: [DomainError signal: 'log is only defined for x > 0'].
- res := super log.
- res isFinite ifTrue: [^res].
- h := self highBit.
- ^2 log * h + (self / (1 << h)) asFloat log!
Item was added:
+ ----- Method: LargeNegativeInteger>>ln (in category 'mathematical functions') -----
+ ln
+ ^DomainError signal: 'ln is only defined for x > 0' from: 0!
Item was added:
+ ----- Method: LargeNegativeInteger>>log (in category 'mathematical functions') -----
+ log
+ ^DomainError signal: 'log is only defined for x > 0' from: 0!
Item was added:
+ ----- Method: LargePositiveInteger>>ln (in category 'mathematical functions') -----
+ ln
+ "This function is defined because super ln might overflow."
+ | res h |
+ res := super ln.
+ res isFinite ifTrue: [^res].
+ h := self highBit.
+ ^2 ln * h + (self / (1 << h)) asFloat ln!
Item was added:
+ ----- Method: LargePositiveInteger>>log (in category 'mathematical functions') -----
+ log
+ "This function is defined because super log might overflow."
+ | res h |
+ res := super log.
+ res isFinite ifTrue: [^res].
+ h := self highBit.
+ ^2 log * h + (self / (1 << h)) asFloat log!
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.647.mcz
==================== Summary ====================
Name: Kernel-nice.647
Author: nice
Time: 2 November 2011, 7:50:14.247 pm
UUID: 68374059-00c3-4605-bfb3-615f3793071a
Ancestors: Kernel-nice.646
Optimize #ln and #log as in Pharo.
1) SmallInteger just inherits from super (^self asFloat log)
2) LargePositiveInteger can avoid self > à guard
3) LargeNegativeInteger can goto Error (no raise, just kidding)
4) Fraction can avoid arithmetic because (a/b) log = (a log - b log) and because a log or b log are unlikely to overflow - (10 raisedTo: (10 raisedTo: 308)) is likely to exhaust your memory before any overflow occurs ;).
=============== Diff against Kernel-nice.646 ===============
Item was changed:
----- Method: Fraction>>ln (in category 'mathematical functions') -----
ln
+ "This function is defined because super ln might overflow."
+ | res |
- "This function is defined because super ln might overflow.
- Note that < 1 is tested before converting to float in order to avoid precision loss due to gradual underflow."
- | res int |
self <= 0 ifTrue: [DomainError signal: 'ln is only defined for x > 0'].
+ "Test self < 1 before converting to float in order to avoid precision loss due to gradual underflow."
+ numerator < denominator ifTrue: [^self reciprocal ln negated].
- self < 1 ifTrue: [^self reciprocal ln negated].
res := super ln.
res isFinite ifTrue: [^res].
+ ^numerator ln - denominator ln!
- int := self integerPart.
- ^int ln + (self / int) ln!
Item was changed:
----- Method: Fraction>>log (in category 'mathematical functions') -----
log
+ "This function is defined because super log might overflow."
+ | res |
- "This function is defined because super log might overflow.
- Note that < 1 is tested before converting to float in order to avoid precision loss due to gradual underflow."
- | res int |
self <= 0 ifTrue: [DomainError signal: 'log is only defined for x > 0'].
+ "Test self < 1 before converting to float in order to avoid precision loss due to gradual underflow."
+ numerator < denominator ifTrue: [^self reciprocal log negated].
- self < 1 ifTrue: [^self reciprocal log negated].
res := super log.
res isFinite ifTrue: [^res].
+ ^numerator log - denominator log!
- int := self integerPart.
- ^int log + (self / int) log!
Item was removed:
- ----- Method: Integer>>ln (in category 'mathematical functions') -----
- ln
- "This function is defined because super ln might overflow."
- | res h |
- self <= 0 ifTrue: [DomainError signal: 'ln is only defined for x > 0'].
- res := super ln.
- res isFinite ifTrue: [^res].
- h := self highBit.
- ^2 ln * h + (self / (1 << h)) asFloat ln!
Item was removed:
- ----- Method: Integer>>log (in category 'mathematical functions') -----
- log
- "This function is defined because super log might overflow."
- | res h |
- self <= 0 ifTrue: [DomainError signal: 'log is only defined for x > 0'].
- res := super log.
- res isFinite ifTrue: [^res].
- h := self highBit.
- ^2 log * h + (self / (1 << h)) asFloat log!
Item was added:
+ ----- Method: LargeNegativeInteger>>ln (in category 'mathematical functions') -----
+ ln
+ ^DomainError signal: 'ln is only defined for x > 0' from: 0!
Item was added:
+ ----- Method: LargeNegativeInteger>>log (in category 'mathematical functions') -----
+ log
+ ^DomainError signal: 'log is only defined for x > 0' from: 0!
Item was added:
+ ----- Method: LargePositiveInteger>>ln (in category 'mathematical functions') -----
+ ln
+ "This function is defined because super ln might overflow."
+ | res h |
+ res := super ln.
+ res isFinite ifTrue: [^res].
+ h := self highBit.
+ ^2 ln * h + (self / (1 << h)) asFloat ln!
Item was added:
+ ----- Method: LargePositiveInteger>>log (in category 'mathematical functions') -----
+ log
+ "This function is defined because super log might overflow."
+ | res h |
+ res := super log.
+ res isFinite ifTrue: [^res].
+ h := self highBit.
+ ^2 log * h + (self / (1 << h)) asFloat log!
Alexander Lazarević uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-laza.457.mcz
==================== Summary ====================
Name: System-laza.457
Author: laza
Time: 1 November 2011, 5:40:33.244 pm
UUID: a4799d4c-14d9-fc4a-8132-9d3b48f02650
Ancestors: System-ul.455
Just document 1009
=============== Diff against System-ul.455 ===============
Item was changed:
----- Method: SmalltalkImage>>getSystemAttribute: (in category 'private') -----
getSystemAttribute: attributeID
"Optional. Answer the string for the system attribute with the given
integer ID. Answer nil if the given attribute is not defined on this
platform. On platforms that support invoking programs from command
lines (e.g., Unix), this mechanism can be used to pass command line
arguments to programs written in Squeak.
By convention, the first command line argument that is not a VM
configuration option is considered a 'document' to be filed in. Such a
document can add methods and classes, can contain a serialized object,
can include code to be executed, or any combination of these.
Currently defined attributes include:
-1000 1000th command line argument that specify VM options
...
-1 first command line argument that specify VM options
0 the full path name for currently executing VM
(or, on some platforms, just the path name of the VM's directory)
1 full path name of this image (better use primImageName instead)
2 a Squeak document to open, if any
3 first command line argument for Squeak programs
...
1000 1000th command line argument for Squeak programs
1001 this platform's operating system 'Mac OS', 'Win32', 'unix', ...
1002 operating system version
1003 this platform's processor type
1004 vm version
1005 window system name
1006 vm build id
1007 Interpreter class (Cog VM only)
1008 Cogit class (Cog VM only)
+ 1009 Platform source version (Cog VM only?)
1201 max filename length (Mac OS only)
1202 file last error (Mac OS only)
10001 hardware details (Win32 only)
10002 operating system details (Win32 only)
10003 graphics hardware details (Win32 only)
"
<primitive: 149>
^ nil!
Alexander Lazarević uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-laza.457.mcz
==================== Summary ====================
Name: System-laza.457
Author: laza
Time: 1 November 2011, 5:40:33.244 pm
UUID: a4799d4c-14d9-fc4a-8132-9d3b48f02650
Ancestors: System-ul.455
Just document 1009
=============== Diff against System-ul.455 ===============
Item was changed:
----- Method: SmalltalkImage>>getSystemAttribute: (in category 'private') -----
getSystemAttribute: attributeID
"Optional. Answer the string for the system attribute with the given
integer ID. Answer nil if the given attribute is not defined on this
platform. On platforms that support invoking programs from command
lines (e.g., Unix), this mechanism can be used to pass command line
arguments to programs written in Squeak.
By convention, the first command line argument that is not a VM
configuration option is considered a 'document' to be filed in. Such a
document can add methods and classes, can contain a serialized object,
can include code to be executed, or any combination of these.
Currently defined attributes include:
-1000 1000th command line argument that specify VM options
...
-1 first command line argument that specify VM options
0 the full path name for currently executing VM
(or, on some platforms, just the path name of the VM's directory)
1 full path name of this image (better use primImageName instead)
2 a Squeak document to open, if any
3 first command line argument for Squeak programs
...
1000 1000th command line argument for Squeak programs
1001 this platform's operating system 'Mac OS', 'Win32', 'unix', ...
1002 operating system version
1003 this platform's processor type
1004 vm version
1005 window system name
1006 vm build id
1007 Interpreter class (Cog VM only)
1008 Cogit class (Cog VM only)
+ 1009 Platform source version (Cog VM only?)
1201 max filename length (Mac OS only)
1202 file last error (Mac OS only)
10001 hardware details (Win32 only)
10002 operating system details (Win32 only)
10003 graphics hardware details (Win32 only)
"
<primitive: 149>
^ nil!
Alexander Lazarević uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-laza.457.mcz
==================== Summary ====================
Name: System-laza.457
Author: laza
Time: 1 November 2011, 5:40:33.244 pm
UUID: a4799d4c-14d9-fc4a-8132-9d3b48f02650
Ancestors: System-ul.455
Just document 1009
=============== Diff against System-ul.455 ===============
Item was changed:
----- Method: SmalltalkImage>>getSystemAttribute: (in category 'private') -----
getSystemAttribute: attributeID
"Optional. Answer the string for the system attribute with the given
integer ID. Answer nil if the given attribute is not defined on this
platform. On platforms that support invoking programs from command
lines (e.g., Unix), this mechanism can be used to pass command line
arguments to programs written in Squeak.
By convention, the first command line argument that is not a VM
configuration option is considered a 'document' to be filed in. Such a
document can add methods and classes, can contain a serialized object,
can include code to be executed, or any combination of these.
Currently defined attributes include:
-1000 1000th command line argument that specify VM options
...
-1 first command line argument that specify VM options
0 the full path name for currently executing VM
(or, on some platforms, just the path name of the VM's directory)
1 full path name of this image (better use primImageName instead)
2 a Squeak document to open, if any
3 first command line argument for Squeak programs
...
1000 1000th command line argument for Squeak programs
1001 this platform's operating system 'Mac OS', 'Win32', 'unix', ...
1002 operating system version
1003 this platform's processor type
1004 vm version
1005 window system name
1006 vm build id
1007 Interpreter class (Cog VM only)
1008 Cogit class (Cog VM only)
+ 1009 Platform source version (Cog VM only?)
1201 max filename length (Mac OS only)
1202 file last error (Mac OS only)
10001 hardware details (Win32 only)
10002 operating system details (Win32 only)
10003 graphics hardware details (Win32 only)
"
<primitive: 149>
^ nil!