stan-dev / stan-dev/stan

floating point values beyond representable range

Open
#2,208 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.8k
Forks
388
Avg merge
2d 17h
Merged PRs (30d)
15

Description

Summary:

ADVI (at least) can yield a value of something that is -6.63215e+311, which is beyond what can be expressed as a double but does not overflow to negative infinity. This is apparently undefined behavior.

Description:

ADVI (at least) can yield a value of something that is -6.63215e+311, which is beyond what can be expressed as a double but does not overflow to negative infinity. This is apparently undefined behavior.

Reproducible Steps:

Install rstanarm with -fsanitize=address in CXXFLAGS and clang++ as CXX. I don't know if g++ has the same issue. Then, execute

library(rstanarm)
stan_glm(Days ~ Sex/(Age + Eth*Lrn), data = MASS::quine, seed = 123,
          family = neg_binomial_2, QR = TRUE, algorithm = "fullrank") 
Current Output:
Begin eta adaptation.
Iteration:   1 / 250 [  0%]  (Adaptation)
/data/gannet/ripley/R/test-clang/BH/include/boost/math/policies/error_handling.hpp:707:32: runtime error: value -6.63215e+311 is outside the range of representable values of type 'double'
SUMMARY: AddressSanitizer: undefined-behavior /data/gannet/ripley/R/test-clang/BH/include/boost/math/policies/error_handling.hpp:707:32 in 
Expected Output:

Regular

Additional Information:
Current Version:

v2.14.0

Contributor guide

Open the contributing guide

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.

Research direction

Run the supplied rstanarm stan_glm reproduction with clang++ and -fsanitize=address, then inspect the reported conversion in boost/math/policies/error_handling.hpp:707. Done means the reproducible model run produces regular output without the undefined-behavior report for the out-of-range floating-point value.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.