[squeak-dev] The Trunk: KernelTests-fn.356.mcz
David T. Lewis
lewis at mail.msen.com
Wed Mar 13 02:49:52 UTC 2019
Excellent, thank you Fabio.
On Wed, Mar 13, 2019 at 02:01:47AM +0000, commits at source.squeak.org wrote:
> Fabio Niephaus uploaded a new version of KernelTests to project The Trunk:
> ==================== Summary ====================
> Name: KernelTests-fn.356
> Author: fn
> Time: 13 March 2019, 11:01:08.662302 am
> UUID: 2a86580c-d4e1-4478-b564-5d2a2c3679bd
> Ancestors: KernelTests-eem.355
> Add a test for https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/376.
> =============== Diff against KernelTests-eem.355 ===============
> Item was changed:
> ----- Method: FloatTest>>testFloatTruncated (in category 'testing - conversion') -----
> "(10 raisedTo: 16) asFloat has an exact representation (no round off error).
> It should convert back to integer without loosing bits.
> This is a no regression test on http://bugs.impara.de/view.php?id=3504"
> | x y int r |
> int := 10 raisedTo: 16.
> x := int asFloat.
> y := (5 raisedTo: 16) asFloat timesTwoPower: 16.
> self assert: x = y.
> self assert: x asInteger = int.
> "this one should be true for any float"
> self assert: x asInteger = x asTrueFraction asInteger.
> "a random test"
> r := Random new.
> 10000 timesRepeat: [
> x := r next * 1.9999e16 + 1.0e12 .
> + self assert: x truncated = x asTrueFraction truncated].
> + "test an edge case (see https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/376)"
> + self assert: SmallInteger maxVal + 1 equals: (SmallInteger maxVal + 1) asFloat asInteger!
> - self assert: x truncated = x asTrueFraction truncated]!
More information about the Squeak-dev