Skip to content

Testing math_testcases.txt lacks support for signed zeros #123836

Closed
@skirpichev

Description

@skirpichev

Feature or enhancement

Proposal:

This file tested, using result_check() helper:

def result_check(expected, got, ulp_tol=5, abs_tol=0.0):

which lacks checking of zero sign (while some entries in the data file - have signed zeros). C.f. cmath_testcases.txt, which tested with rAssertAlmostEqual(), that has such special case:
# if both a and b are zero, check whether they have the same sign
# (in theory there are examples where it would be legitimate for a
# and b to have opposite signs; in practice these hardly ever
# occur).
if not a and not b:
if math.copysign(1., a) != math.copysign(1., b):
self.fail(msg or 'zero has wrong sign: expected {!r}, '
'got {!r}'.format(a, b))

I think that first helper should be adjusted to do same. I'll work on a patch.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions