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

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Thu May 5 14:23:18 UTC 2022


Oups, sorry,
it was part of another package that was loaded in my test images.

Le jeu. 5 mai 2022 à 16:07, Marcel Taeumel <marcel.taeumel at hpi.de> a écrit :

> Hi Nicolas --
>
> You forgot to commit #isFinite on Integer? Many ComplexTest tests are
> failing:
>
> https://github.com/squeak-smalltalk/squeak-app/runs/6302546226?check_suite_focus=true
>
> Best,
> Marcel
>
> Am 27.04.2022 17:18:13 schrieb commits at source.squeak.org <
> commits at source.squeak.org>:
> Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
> http://source.squeak.org/trunk/KernelTests-nice.422.mcz
>
> ==================== Summary ====================
>
> Name: KernelTests-nice.422
> Author: nice
> Time: 26 April 2022, 1:03:31.73252 pm
> UUID: e963a1d7-702a-904d-8b40-8dbf96032f0d
> Ancestors: KernelTests-nice.421
>
> Complex tests associated with that suggestion: complex arithmetic should
> detect case of overflow in intermediate computations and fallback to
> securedely scaled operations if it's the case.
>
> =============== Diff against KernelTests-nice.421 ===============
>
> Item was changed:
> ----- Method: ComplexTest>>testDivision1 (in category 'tests') -----
> testDivision1
> "self run: #testDivision1"
> "self debug: #testDivision1"
>
> | c1 c2 quotient |
> c1 := 2.0e252 + 3.0e70 i.
> c2 := c1.
> quotient := c1 / c2.
> - self deny: (quotient - 1) isZero.
>
> + "This used to fail when / was not protected against floating point
> overflow in intermediate computations
> + but it should now work correctly if divideSecureBy: is correctly used as
> fallback case"
> + self assert: (quotient - 1) isZero
> - "This test fails due to the wonders of floating point arithmetic.
> - Please have a look at Complex>>divideSecureBy: and
> #divideFastAndSecureBy:
> - how this can be avoided."
>
> !
>
> Item was added:
> + ----- Method: ComplexTest>>testMultiplyDoesNotOverflow (in category
> 'tests') -----
> + testMultiplyDoesNotOverflow
> +
> + | c1 c2 product smallProduct scale |
> + c1 := (1 + 1 i) sqrt * Float fmax sqrt.
> + product := c1 squared.
> + self assert: product real isFinite.
> + self assert: product imaginary isFinite.
> + self assert: (product real - Float fmax) / Float fmax ulp < 3.
> + self assert: (product imaginary - Float fmax) / Float fmax ulp < 3.
> +
> + "a more tricky case"
> + c1 := 1.0 + 0.25 i.
> + c2 := 1.125+ 0.5 i.
> + smallProduct := c1 * c2.
> + "check that we will not overflow in precondition"
> + self assert: smallProduct real abs <= 1.
> + self assert: smallProduct imaginary abs <= 1.
> + "now retry with a large scale"
> + scale := Float fmax.
> + product := c1 * scale * c2.
> + self assert: product real isFinite.
> + self assert: product imaginary isFinite.
> + self assert: (scale * smallProduct real - product real) / (scale *
> smallProduct real) ulp < 3.
> + self assert: (scale * smallProduct imaginary - product imaginary) /
> (scale * smallProduct imaginary) ulp < 3.!
>
> Item was added:
> + ----- Method: ComplexTest>>testReciprocalDoesNotOverflow (in category
> 'tests') -----
> + testReciprocalDoesNotOverflow
> + "Note: intermediate overflow might cause the answer to be zero in
> careless implementation"
> +
> + | c scale cScaled cScaledInv expected |
> + c := (1 + 1i).
> + scale := Float fmax.
> + cScaled := c * scale.
> + cScaledInv := cScaled reciprocal.
> + expected := c reciprocal real / scale + (c reciprocal imaginary / scale)
> i.
> + self assert: (expected real- cScaledInv real) abs / expected real ulp <
> 3.
> + self assert: (expected imaginary - cScaledInv imaginary) abs / expected
> imaginary ulp < 3.!
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220505/5d127342/attachment.html>


More information about the Squeak-dev mailing list