Repository: scipy/scipy
File: scipy/special/xsf_wrappers.cpp (C++)

Code before:

double xsf_gdtr(double a, double b, double x) { return xsf::gdtr(a, b, x); }

double xsf_gdtrc(double a, double b, double x) { return xsf::gdtrc(a, b, x); }

double special_gdtria(double p, double b, double x) { 
    if (x == 0) {
        return std::numeric_limits<double>::quiet_NaN();
    }
    if ((b == 0) & (p == 0)) {
        if (std::isinf(x) && (x > 0)) {
            return std::numeric_limits<double>::quiet_NaN();
        }
        return 0.0;
    }
    return xsf::gammaincinv(b, p) / x; }

double special_gdtrix(double a, double b, double p) { 
    if ((a == 0) && (b == 0)) {
            return std::numeric_limits<double>::quiet_NaN();
    }
    // if a or b is positive infinite, return NaN
    if ((std::isinf(a) || std::isinf(b)) && (a >= 0 && b >= 0)) {
        return std::numeric_limits<double>::quiet_NaN();
    }
    return xsf::gammaincinv(b, p) / a; }

double xsf_gdtrib(double a, double p, double x) { return xsf::gdtrib(a, p, x); }

double xsf_kolmogorov(double x) { return xsf::kolmogorov(x); }

double xsf_kolmogc(double x) { return xsf::kolmogc(x); }

double xsf_kolmogi(double x) { return xsf::kolmogi(x); }

double xsf_kolmogci(double x) { return xsf::kolmogci(x); }

double xsf_kolmogp(double x) { return xsf::kolmogp(x); }

double xsf_nbdtr(int k, int n, double p) { return xsf::nbdtr(k, n, p); }

double xsf_nbdtrc(int k, int n, double p) { return xsf::nbdtrc(k, n, p); }

double xsf_nbdtri(int k, int n, double p) { return xsf::nbdtri(k, n, p); }

double xsf_ndtr(double x) { return xsf::ndtr(x); }

npy_cdouble xsf_cndtr(npy_cdouble x) { return to_ccomplex(xsf::ndtr(to_complex(x))); }

double xsf_log_ndtr(double x) { return xsf::log_ndtr(x); }


Review comment (suggestion):
Style nit:
```suggestion
    return xsf::gammaincinv(b, p) / a;
}
```

Code after:

double xsf_gdtr(double a, double b, double x) { return xsf::gdtr(a, b, x); }

double xsf_gdtrc(double a, double b, double x) { return xsf::gdtrc(a, b, x); }

double special_gdtria(double p, double b, double x) { 
    if (x == 0) {
        return std::numeric_limits<double>::quiet_NaN();
    }
    if ((b == 0) & (p == 0)) {
        if (std::isinf(x) && (x > 0)) {
            return std::numeric_limits<double>::quiet_NaN();
        }
        return 0.0;
    }
    return xsf::gammaincinv(b, p) / x;
}

double special_gdtrix(double a, double b, double p) { 
    if ((a == 0) && (b == 0)) {
        return std::numeric_limits<double>::quiet_NaN();
    }
    // if a or b is positive infinite, return NaN
    if ((std::isinf(a) || std::isinf(b)) && (a >= 0 && b >= 0)) {
        return std::numeric_limits<double>::quiet_NaN();
    }
    return xsf::gammaincinv(b, p) / a;
}

double xsf_gdtrib(double a, double p, double x) { return xsf::gdtrib(a, p, x); }

double xsf_kolmogorov(double x) { return xsf::kolmogorov(x); }

double xsf_kolmogc(double x) { return xsf::kolmogc(x); }

double xsf_kolmogi(double x) { return xsf::kolmogi(x); }

double xsf_kolmogci(double x) { return xsf::kolmogci(x); }

double xsf_kolmogp(double x) { return xsf::kolmogp(x); }

double xsf_nbdtr(int k, int n, double p) { return xsf::nbdtr(k, n, p); }

double xsf_nbdtrc(int k, int n, double p) { return xsf::nbdtrc(k, n, p); }

double xsf_nbdtri(int k, int n, double p) { return xsf::nbdtri(k, n, p); }

double xsf_ndtr(double x) { return xsf::ndtr(x); }

npy_cdouble xsf_cndtr(npy_cdouble x) { return to_ccomplex(xsf::ndtr(to_complex(x))); }