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

Introducing $*RAT-UPGRADE-CLASS #4299

Merged
merged 5 commits into from Jan 4, 2022
Merged

Introducing $*RAT-UPGRADE-CLASS #4299

merged 5 commits into from Jan 4, 2022

Commits on Apr 6, 2021

  1. Introducing $*RAT-UPGRADE-CLASS

    This dynamic variable indicates the *class* in which an UPGRADE-RAT
    method will be called whenever a Rat has a denominator that does not
    fit in a 64bit native integer.
    
    The default setting for $*RAT-UPGRADE-CLASS is Num: this will silently
    downgrade a Rat to a Num (floating point), thus sacrificing precision
    for speed (the current behaviour).
    
    Other possible settings are:
    
    - CX::Warn    downgrade to Num but warn
    - FatRat      silently upgrade to FatRat
    - Failure     don't upgrade, return an appropriate Failure
    - Exception   don't upgrade, throw an appropriate Exception
    
    Although the dynamic variable indicates a "class" is expected, there
    are no technical obstacles to put anything else in there, as long
    as it can dispatch to a "UPGRADE-RAT" method that takes two Ints:
    the numerator and denominator.
    
    This does *not* affect the inlineability of the CREATE_RATIONAL_FROM_INTS
    subs, but it does make the default case of silently downgrading to Num
    slightly slower.  Currently this slowness is mostly caused by &DYNAMIC
    being slow, and no locally cached dynamic variables (which will hopefully
    change in the not-so-distant future).
    
    Inspired by the discussions at:
    
      https://www.reddit.com/r/rakulang/comments/mipog4/raku34_python19_extreme_math_steve_roe/
      https://twitter.com/liztormato/status/1378294510430601220
    lizmat committed Apr 6, 2021
    Configuration menu
    Copy the full SHA
    e5c90d2 View commit details
    Browse the repository at this point in the history
  2. s/CLASS/POLICY/

    lizmat committed Apr 6, 2021
    Configuration menu
    Copy the full SHA
    cead6b0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    05ee91f View commit details
    Browse the repository at this point in the history

Commits on Jan 4, 2022

  1. Configuration menu
    Copy the full SHA
    143de6c View commit details
    Browse the repository at this point in the history
  2. Rename to $*RAT-OVERFLOW

    lizmat committed Jan 4, 2022
    Configuration menu
    Copy the full SHA
    fe73a61 View commit details
    Browse the repository at this point in the history