Skip to content

ENH: template kolmogorov for float and double - #253

Open
fbourgey wants to merge 1 commit into
scipy:mainfrom
fbourgey:template_kolmogorov
Open

ENH: template kolmogorov for float and double#253
fbourgey wants to merge 1 commit into
scipy:mainfrom
fbourgey:template_kolmogorov

Conversation

@fbourgey

Copy link
Copy Markdown
Member

Reference issue

What does this implement/fix?

Replace the separate float and double overloads with a constrained template for kolmogorov. This PR tries to replicate was is done in https://github.com/scipy/xsf/blob/main/include/xsf/tools.h#L45.

Note that https://github.com/scipy/xsf/blob/main/include/xsf/gamma.h#L11 appears to have no constraints.

Additional information

AI Generation Disclosure

Asked Codex for feedback.

@github-actions github-actions Bot added the Enhancement New feature or request label Aug 19, 2026
@fbourgey

fbourgey commented Aug 19, 2026

Copy link
Copy Markdown
Member Author

Another solution is to define in xsf/config.h

template <typename T>
using enable_if_float_or_double_t = typename std::enable_if<is_float_or_double_v<T>, int>::type;

and use

template <typename T, enable_if_float_or_double_t<T> = 0>
    inline T kolmogorov(T x) {
        return static_cast<T>(cephes::kolmogorov(static_cast<double>(x)));
    }

@steppi, @j-bowhay @dschmitz89 any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant