The Trunk: KernelTests-fn.356.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: KernelTests-fn.356.mcz

commits-2
Fabio Niephaus uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-fn.356.mcz

==================== 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') -----
  testFloatTruncated
  "(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]!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: KernelTests-fn.356.mcz

David T. Lewis
Excellent, thank you Fabio.

Dave


On Wed, Mar 13, 2019 at 02:01:47AM +0000, [hidden email] wrote:

> Fabio Niephaus uploaded a new version of KernelTests to project The Trunk:
> http://source.squeak.org/trunk/KernelTests-fn.356.mcz
>
> ==================== 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') -----
>   testFloatTruncated
>   "(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]!
>
>