Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error reading in large integral real values #204

Closed
ksvanhorn opened this issue Sep 5, 2013 · 2 comments
Closed

Error reading in large integral real values #204

ksvanhorn opened this issue Sep 5, 2013 · 2 comments
Assignees
Labels
Milestone

Comments

@ksvanhorn
Copy link
Contributor

Consider the following two data files, to be used with src/models/basic_estimators/normal_mixture:

foo.data.R:
N <- 5
y <- c(15, -6, -138109526142584496, 37.5, 4.3)

bar.data.R:
N <- 5
y <- c(15, -6, -1381, 37.5, 4.3)

The program runs fine with --data=bar.data.R, but when given --data=foo.data.R it dies with a "variable does not exist" error. Note that y is declared to be a real array in normal_mixture.stan; although y[3] is too large to be a 32-bit integer, it is a perfectly valid 64-bit floating-point value.

I ran into this problem using a data file written out by R.

@ghost ghost assigned syclik and bob-carpenter Sep 10, 2013
@syclik
Copy link
Member

syclik commented Nov 1, 2013

Related to #226. This one provides an example.

@syclik
Copy link
Member

syclik commented Jul 30, 2014

I just looked into the feasibility of fixing this. I think it's difficult dealing with it now. We don't pass into the reader the type it should be looking for. If we did, then we'd be able to read that integer as a double and be able to handle it fine.

There is a workaround to this problem:

  • make the data a floating point number instead of an integer. All that's required is adding a "." to the end of the number. I'm not sure if RStan's stan_rdump() function already takes care of that.

@ksvanhorn, does R still behave that way? If it does, can you try using RStan's stan_rdump()? If using that function creates data this way, then I'll open up an issue in RStan. I'll close this one for the time being because I think we're inferring the right type based on the input; it's just not as robust as we'd like.

@syclik syclik closed this as completed Jul 30, 2014
@syclik syclik modified the milestones: Future, v2.4.0++ Jul 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants