Fisher F complemented quantile fails for two upper-tail probabilities

Open
#1,666 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@hector2394 is already working on this.

Since Nov 20, 2026.

  • #1667 by @hector2394 — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
15/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp
Domain
backend

Research direction

The reproducer calls quantile(complement(...)) on fisher_f_distribution<double, Policy> with promotion disabled. Start by running the provided C++17 example against the Boost.Math include directory and compare both results with the stated reference values. Done means the first probability returns approximately 5.272596610651114e306 and the second overflows to positive infinity; a linked pull request is already open.

Written by the indexing model from the issue text.

Description

quantile(complement(fisher_f_distribution<double>(1, 0.1), q)) gives incorrect results for two upper-tail probabilities with promotion disabled. I reproduced this on Windows x64 with MSVC in C++17 mode, using Boost.Math commit 8b9e21b41a45443d8f77ad84295b2f372c9e2c19 from SciPy’s Boost upgrade PR.

q Expected from 100-digit reference Actual
3.85e-16 5.272596610651114e306 halley_iterate<double> throws because no root was found
1e-20 +inf because the quantile exceeds the double range 4.4942328371557913e306

Compile with BOOST_MATH_STANDALONE=1 and the Boost.Math include directory on the include path.

#include <boost/math/distributions/fisher_f.hpp>
#include <boost/math/policies/policy.hpp>
#include <exception>
#include <iomanip>
#include <initializer_list>
#include <iostream>

int main() {
    using namespace boost::math;
    using Policy = policies::policy<
        policies::promote_float<false>,
        policies::promote_double<false>,
        policies::max_root_iterations<400>,
        policies::overflow_error<policies::ignore_error>>;

    const fisher_f_distribution<double, Policy> dist(1, 0.1);
    std::cout << std::setprecision(17);
    for (double q : {3.85e-16, 1e-20}) {
        try {
            const double x = quantile(complement(dist, q));
            std::cout << q << " -> " << x << '\n';
        } catch (const std::exception& e) {
            std::cout << q << " -> " << e.what() << '\n';
        }
    }
}

Related SciPy discussion

I will open a PR for it myself.

Dominant language
C++
Stars
382
Forks
274
Avg merge
21h 14m
Merged PRs (30d)
51

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/math

All issues in boostorg/math

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.