Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve how tuples are converted into complex values #24184

Merged
merged 5 commits into from Jan 16, 2024

Commits on Jan 12, 2024

  1. Improve how tuples are converted into complex values

    This changes the implementation of the _chpl_complexNNN() routines in
    the runtime to use the 'CMPLX()' initializer macros rather than math
    to initialize the complex values.  This seems to work around an issue
    in which inf/nan values would creep in for reasons I don't (yet)
    understand.
    
    The one trick to this change is that I had to protect the code to not
    compile it in C++ mode.  I believe this is fine because re2 is the
    only runtime code we compile with C++ and it doesn't need our complex
    types and routines.  This almost made me compelled to break the
    complex types out of chpltypes.h and into their own header, but that
    felt like a lot of trouble to go to for C++ when we're mostly focused
    on C in the runtime.
    
    If anyone going forward has suggestions for making these conversion
    routines work equally well in C as C++, I'm all ears!
    
    ---
    Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
    bradcray committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    ee2179c View commit details
    Browse the repository at this point in the history
  2. Narrow C++ restriction

    ---
    Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
    bradcray committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    fab7917 View commit details
    Browse the repository at this point in the history
  3. Support three options:

    * use initialization macros, when available
    * fall back to aliasing trick if not
    * support the old implementation as a fallback if someone doesn't
      like the aliasing trick and wants to disable it
    
    ---
    Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
    bradcray committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    3a9895b View commit details
    Browse the repository at this point in the history
  4. Cleanup for review

    ---
    Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
    bradcray committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    a273c25 View commit details
    Browse the repository at this point in the history
  5. Clean up macros as Michael points out is possible

    (I'd cleaned up some of what I'd found online, but not enough)
    
    ---
    Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
    bradcray committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    31687e9 View commit details
    Browse the repository at this point in the history