@@ -803,8 +803,20 @@ def testHypot(self):
803
803
scale = FLOAT_MIN / 2.0 ** exp
804
804
self .assertEqual (math .hypot (4 * scale , 3 * scale ), 5 * scale )
805
805
806
+ @requires_IEEE_754
807
+ @unittest .skipIf (HAVE_DOUBLE_ROUNDING ,
808
+ "hypot() loses accuracy on machines with double rounding" )
806
809
def testHypotAccuracy (self ):
807
810
# Verify improved accuracy in cases that were known to be inaccurate.
811
+ #
812
+ # The new algorithm's accuracy depends on IEEE 754 arithmetic
813
+ # guarantees, on having the usual ROUND HALF EVEN rounding mode, on
814
+ # the system not having double rounding due to extended precision,
815
+ # and on the compiler maintaining the specified order of operations.
816
+ #
817
+ # This test is known to succeed on most of our builds. If it fails
818
+ # some build, we either need to add another skipIf if the cause is
819
+ # identifiable; otherwise, we can remove this test entirely.
808
820
809
821
hypot = math .hypot
810
822
Decimal = decimal .Decimal
@@ -835,7 +847,7 @@ def testHypotAccuracy(self):
835
847
('0x1.1243a50751fd4p+29' , '0x1.a5a10175622d9p+29' ),
836
848
('0x1.57a8596e74722p+30' , '0x1.42d1af9d04da9p+30' ),
837
849
838
- # Cases with 1 ulp error in version fff3c28052e6b0750d6218e00acacd2fded4991a
850
+ # Cases with 1 ulp error in version fff3c28052e6b0
839
851
('0x1.ee7dbd9565899p+29' , '0x1.7ab4d6fc6e4b4p+29' ),
840
852
('0x1.5c6bfbec5c4dcp+30' , '0x1.02511184b4970p+30' ),
841
853
('0x1.59dcebba995cap+30' , '0x1.50ca7e7c38854p+29' ),
0 commit comments