[squeak-dev] The Inbox: Kernel-spfa.1312.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Mar 8 13:22:23 UTC 2020


Stephane Rollandin uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-spfa.1312.mcz

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

Name: Kernel-spfa.1312
Author: spfa
Time: 8 March 2020, 2:22:41.860727 pm
UUID: 69693489-ed71-fa41-ad62-441618120c9c
Ancestors: Kernel-nice.1311

Make comparing two near-zero numbers follow the same logic as comparing a near-zero number and zero.

=============== Diff against Kernel-nice.1311 ===============

Item was changed:
  ----- Method: Float>>closeTo: (in category 'comparing') -----
  closeTo: num
   	"are these two numbers close?"
  	num isNumber ifFalse: [^[self = num] ifError: [false]].
  	self = 0.0 ifTrue: [^num abs < 0.0001].
  	num = 0 ifTrue: [^self abs < 0.0001].
+ 	^self = num asFloat or: [
+ 		| abs |
+ 		(abs := self abs) < 0.0001 ifTrue: [^num abs < 0.0001].
+ 		(self - num) abs / (abs max: num abs) < 0.0001]!
- 	^self = num asFloat
- 		or: [(self - num) abs / (self abs max: num abs) < 0.0001]!



More information about the Squeak-dev mailing list