[squeak-dev] The Trunk: KernelTests-nice.438.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Nov 24 11:56:40 UTC 2022


Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-nice.438.mcz

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

Name: KernelTests-nice.438
Author: nice
Time: 24 November 2022, 12:56:33.877687 pm
UUID: 21319d21-b5a9-1342-b984-31b767a2cafc
Ancestors: KernelTests-ct.437

Document SqNumberParser behavior when an exponent is provided without a fraction part.

For example 1e5 or 1e-4.

Uncover a bug: failure to round to nearest Float for large negative exponent.
Because (10 raisedToInteger: exp) isAnExactFloat is false for any exp abs > 22, we shall not recompose the float as integerPart * (base asFloat raisedTo: exponent), that's potentially two inexact operations in a row, and a chance of incorrect rounding.

=============== Diff against KernelTests-ct.437 ===============

Item was added:
+ ----- Method: SqNumberParserTest>>testIntegerWithNegativeExponent (in category 'tests - Integer') -----
+ testIntegerWithNegativeExponent
+ 	self assert: (SqNumberParser parse: '1200e-2') isInteger.
+ 	self assert: 12 equals: (SqNumberParser parse: '1200e-2').
+ 
+ 	self assert: (SqNumberParser parse: '1200e-3') isFloat.
+ 	self assert: 1.2 equals: (SqNumberParser parse: '1200e-3').
+ 	
+ 	"This may fail if using 25 * (10.0 raisedTo: -108)"
+ 	self assert: 25.0e-108 equals: (SqNumberParser parse: '25e-108').!

Item was added:
+ ----- Method: SqNumberParserTest>>testIntegerWithPositiveExponent (in category 'tests - Integer') -----
+ testIntegerWithPositiveExponent
+ 	self assert: (SqNumberParser parse: '12e3') isInteger.
+ 	self assert: 1200 equals: (SqNumberParser parse: '12e3').!



More information about the Squeak-dev mailing list