GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remove remnants of support for non-IEEE 754 systems from cmathmodule.c · Issue #121268 · python/cpython

Remove remnants of support for non-IEEE 754 systems from cmathmodule.c #121268

New issue
Copy link
New issue
Copy link
Closed
Closed
Remove remnants of support for non-IEEE 754 systems from cmathmodule.c#121268
Copy link
Labels
type-featureA feature request or enhancementA feature request or enhancement

Description

@skirpichev
skirpichev
opened on Jul 2, 2024
Issue body actions

Feature or enhancement

Proposal:

Proposed patch:

diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c
index bf86a211bc..591442334e 100644
--- a/Modules/cmathmodule.c
+++ b/Modules/cmathmodule.c
@@ -185,15 +185,8 @@ cmath_acos_impl(PyObject *module, Py_complex z)
     if (fabs(z.real) > CM_LARGE_DOUBLE || fabs(z.imag) > CM_LARGE_DOUBLE) {
         /* avoid unnecessary overflow for large arguments */
         r.real = atan2(fabs(z.imag), z.real);
-        /* split into cases to make sure that the branch cut has the
-           correct continuity on systems with unsigned zeros */
-        if (z.real < 0.) {
-            r.imag = -copysign(log(hypot(z.real/2., z.imag/2.)) +
-                               M_LN2*2., z.imag);
-        } else {
-            r.imag = copysign(log(hypot(z.real/2., z.imag/2.)) +
-                              M_LN2*2., -z.imag);
-        }
+        r.imag = -copysign(log(hypot(z.real/2., z.imag/2.)) +
+                           M_LN2*2., z.imag);
     } else {
         s1.real = 1.-z.real;
         s1.imag = -z.imag;
@@ -386,11 +379,7 @@ cmath_atanh_impl(PyObject *module, Py_complex z)
         */
         h = hypot(z.real/2., z.imag/2.);  /* safe from overflow */
         r.real = z.real/4./h/h;
-        /* the two negations in the next line cancel each other out
-           except when working with unsigned zeros: they're there to
-           ensure that the branch cut has the correct continuity on
-           systems that don't support signed zeros */
-        r.imag = -copysign(Py_MATH_PI/2., -z.imag);
+        r.imag = copysign(Py_MATH_PI/2., z.imag);
         errno = 0;
     } else if (z.real == 1. && ay < CM_SQRT_DBL_MIN) {
         /* C99 standard says:  atanh(1+/-0.) should be inf +/- 0i */

Removing this legacy was proposed in #102067, but before merging #31790. Maybe now that change does make sense?

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

#102067 (comment)

Linked PRs

  • gh-121268: remove workarounds for non-IEEE 754 systems in cmath #122716

Activity

  1. skirpichev
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Jul 2, 2024
  2. skirpichev
    added a commit that references this issue on Aug 6, 2024

    pythongh-121268: remove workarounds for non-IEEE 754 systems in cmath

    5aba316
  3. serhiy-storchaka commented on Aug 7, 2024

    @serhiy-storchaka
    serhiy-storchaka
    on Aug 7, 2024
    Member
    More actions

    For reference, the original code was added in 6f34109 (ported to Python 3 in 53876d9).

    Reacted by Victor Stinner and Sergey B Kirpichev
  4. vstinner
    added a commit that references this issue on Aug 9, 2024

    gh-121268: Remove workarounds for non-IEEE 754 systems in cmath (#122716

    b6e745a
  5. vstinner commented on Aug 9, 2024

    @vstinner
    vstinner
    on Aug 9, 2024
    Member
    More actions

    Fixed by change b6e745a.

  6. vstinner
    closed this as completedon Aug 9, 2024
  7. serhiy-storchaka commented on Aug 9, 2024

    @serhiy-storchaka
    serhiy-storchaka
    on Aug 9, 2024
    Member
    More actions

    I would like to hear opinions of @tiran and @mdickinson about this change.

    Reacted by Victor Stinner
  8. blhsing
    added a commit that references this issue on Aug 22, 2024

    pythongh-121268: Remove workarounds for non-IEEE 754 systems in cmath (…

    1ec4e47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.