Skip to content

sgnGamma(-0.5) should be -1 #10801

Open
Open
@tedgin

Description

@tedgin

When evaluating the expression std.mathspecial.sgnGamma(-0.5) recently, I got 1. This surprised me, because Γ(x) < 0 when -1 < x < 0. Looking at the source code, I see that rndtol is used to convert x to an integer for binning. Depending on the rounding mode, -0.5 will be rounded to either 0 or -1. I think this is the source of my error. Since the domain boundaries are the no positive integers, it might be better to use a function like trunc that will map negative numbers in the same domain to the same integer, since it doesn't rely on the rounding mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions