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 — Treat Fraction as a real value in mixed arithmetic operations with complex · Issue #119838 · python/cpython

Treat Fraction as a real value in mixed arithmetic operations with complex #119838

New issue
Copy link
New issue
Copy link
Closed
Closed
Treat Fraction as a real value in mixed arithmetic operations with complex#119838
Copy link

Description

@serhiy-storchaka
serhiy-storchaka
opened on May 31, 2024
Issue body actions

In arithmetic operations, if one of operands is a Fraction, and the other operand is a complex or a numbers.Complex, the fraction is implicitly converted to a complex. Third-party types implementing the numbers.Complex interface can distinguish between real and complex operands. In future we can support the mixed real-complex arithmetic also for the builtin complex type. A fraction is a real value, so it makes sense to convert it to float instead of complex in such cases.

Linked PRs

  • gh-119838: Treat Fraction as a real value in mixed arithmetic operations with complex #119839

Activity

  1. serhiy-storchaka
    added a commit that references this issue on May 31, 2024

    pythongh-119838: Treat Fraction as a real value in mixed arithmetic o…

    42b421c
  2. skirpichev commented on May 31, 2024

    @skirpichev
    skirpichev
    on May 31, 2024
    Member
    More actions

    In future we can support the mixed real-complex arithmetic also for the builtin complex type.

    Then this change will make sense. Right now it contradicts to coercion rules for int/floats op complex.

    PS: But thank you for reminding me that I should fix also the "complex op Fraction" case in my pr:)

    Edit: After looking on the code, sorry - false alert.

  3. mdickinson commented on Jun 2, 2024

    @mdickinson
    mdickinson
    on Jun 2, 2024
    Member
    More actions

    A fraction is a real value, so it makes sense to convert it to float instead of complex in such cases.

    +1

  4. serhiy-storchaka
    added a commit that references this issue on Jun 3, 2024

    gh-119838: Treat Fraction as a real value in mixed arithmetic operati…

    d7fcaa7
  5. serhiy-storchaka
    closed this as completedon Jun 3, 2024
  6. mliezun
    added a commit that references this issue on Jun 3, 2024

    pythongh-119838: Treat Fraction as a real value in mixed arithmetic o…

    0f745b9
  7. barneygale
    added a commit that references this issue on Jun 5, 2024

    pythongh-119838: Treat Fraction as a real value in mixed arithmetic o…

    1f52e84
  8. estyxx
    added a commit that references this issue on Jul 17, 2024

    pythongh-119838: Treat Fraction as a real value in mixed arithmetic o…

    0fc6847
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

    No labels
    No labels

    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.