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

sync-up gammavariate and expovariate code #74746

Closed
leodema mannequin opened this issue Jun 3, 2017 · 2 comments
Closed

sync-up gammavariate and expovariate code #74746

leodema mannequin opened this issue Jun 3, 2017 · 2 comments
Labels
performance Performance or resource usage

Comments

@leodema
Copy link
Mannequin

leodema mannequin commented Jun 3, 2017

BPO 30561
Nosy @rhettinger, @leodema
PRs
  • bpo-30561: Sync-up expovariate() and gammavariate code #1934
  • bpo-30464: Fix comment in gammavariate #1798
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-12-24.06:55:58.854>
    created_at = <Date 2017-06-03.20:16:30.394>
    labels = ['performance']
    title = 'sync-up gammavariate and expovariate code'
    updated_at = <Date 2018-12-24.16:17:04.242>
    user = 'https://github.com/leodema'

    bugs.python.org fields:

    activity = <Date 2018-12-24.16:17:04.242>
    actor = 'rhettinger'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-12-24.06:55:58.854>
    closer = 'rhettinger'
    components = []
    creation = <Date 2017-06-03.20:16:30.394>
    creator = 'leodema'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30561
    keywords = []
    message_count = 2.0
    messages = ['295102', '332481']
    nosy_count = 2.0
    nosy_names = ['rhettinger', 'leodema']
    pr_nums = ['1934', '1798']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue30561'
    versions = []

    @leodema
    Copy link
    Mannequin Author

    leodema mannequin commented Jun 3, 2017

    As suggested by rhettinger in http://bugs.python.org/msg294438:

    I agree that the comment should be changed. While we at it, perhaps sync-up with expovariate() code and eliminate the u <= 1e-7 test:

    Instead of:

        elif alpha == 1.0:
            # expovariate(1)
            u = random()
            while u <= 1e-7:
                u = random()
            return -_log(u) * beta
    

    Use this instead:

        elif alpha == 1.0:
            # expovariate(1.0 / beta)
            return -_log(1.0 - random()) * beta
    

    @leodema leodema mannequin added the performance Performance or resource usage label Jun 3, 2017
    @rhettinger
    Copy link
    Contributor

    New changeset 63d1522 by Raymond Hettinger (leodema) in branch 'master':
    bpo-30561: Sync-up expovariate() and gammavariate code (GH-1934)
    63d1522

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    performance Performance or resource usage
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant