Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-nice.393.mcz==================== Summary ====================
Name: KernelTests-nice.393
Author: nice
Time: 4 March 2021, 9:48:25.332412 pm
UUID: 17415633-8a99-47e7-a3eb-f736b66348ca
Ancestors: KernelTests-eem.392
Test some log2 features (exactness and overflow/underflow protection)
Also exhibit potential weakness near unity.
=============== Diff against KernelTests-eem.392 ===============
Item was added:
+ ----- Method: FloatTest>>assert:equals:withinUlp: (in category 'asserting') -----
+ assert: expected equals: actual withinUlp: maxUlp
+ self assert: (expected - actual) abs <= (maxUlp * expected asFloat ulp)!
Item was added:
+ ----- Method: FloatTest>>testLog2near1 (in category 'tests - mathematical functions') -----
+ testLog2near1
+ self assert: 1.0 predecessor ln / 2 ln equals: 1.0 predecessor log2 withinUlp: 2.
+ self assert: 1.0 successor ln / 2 ln equals: 1.0 successor log2 withinUlp: 2!
Item was added:
+ ----- Method: NumberTest>>testExactLog2 (in category 'tests') -----
+ testExactLog2
+ -10 to: 10 do: [:i | self assert: i equals: (2 raisedToInteger: i) log2].
+ Float emin - Float precision + 1 to: Float emax do: [:i | self assert: i equals: (1.0 timesTwoPower: i) log2].!
Item was added:
+ ----- Method: NumberTest>>testLog2doesNotOverflow (in category 'tests') -----
+ testLog2doesNotOverflow
+ "Note: though this is not a strict identity, we can use strict Float equality here"
+ self assert: 3000.0 equals: ((1 bitShift: 3000) - 1) log2.
+ self assert: 1500.0 equals: (((1 bitShift: 3000) - 1) / (1 bitShift: 1500)) log2.!
Item was added:
+ ----- Method: NumberTest>>testLog2doesNotUnderflow (in category 'tests') -----
+ testLog2doesNotUnderflow
+ "Note: though this is not a strict identity, we can use strict Float equality here"
+ self assert: -2000.0 equals: ((1 bitShift: 2000) - 1) reciprocal log2!