how to use pi()?

11 views
Skip to first unread message

Jiqiang Guo

unread,
Apr 12, 2012, 11:53:27 AM4/12/12
to stan...@googlegroups.com
../../../../../bin/stanc --name=fire fire.stan.0
Model name=fire
Input file=fire.stan.0
Output file=fire.cpp

ERROR PARSING
LOCATION:  file=input; line=38, column=21

     tmp <- sqrt(2 * pi()) * alpha * sigma * Phi(alpha * sigma) * exp(0.5 * pow(alpha * sigma, 2));
                    ^-- here

DIAGNOSTIC(S) FROM PARSER:

variable "pi" does not exist.
variable "pi" does not exist.
Parser expecting: <unnamed-rule>

--
Jiqiang

Bob Carpenter

unread,
Apr 12, 2012, 12:29:17 PM4/12/12
to stan...@googlegroups.com
That's a bug -- thanks for catching it.

I've added a test and will fix the problem ASAP.


- Bob

Bob Carpenter

unread,
Apr 12, 2012, 12:45:31 PM4/12/12
to stan...@googlegroups.com
I just pushed the patch (and test),
so pi() and the other constants should
work now.

It was my fault for not understanding the
base case of the sequence w. separator
rules in the parser which don't include the empty
sequence (which seems like a bad design choice
on Boost's part, but easy enough to patch up
on our end).

- Bob

Reply all
Reply to author
Forward
0 new messages