-
-
Notifications
You must be signed in to change notification settings - Fork 193
Investigate which int overloads are still needed (exp, pow, ...) #1692
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
Comments
That problem hadn't occurred to me! The reason we have the We could get around this by having our math lib version be defined as something like:
Then it won't try to cast |
OK, I just went and looked up the signatures of |
But stan::math::exp still uses std::exp so these would be the same in the end right? So I guess this was to prevent int being promoted to var? |
Right---the exp(int) signature was just to disambiguate calls to exp(int) in Stan, which were otherwise ambiguous betwene promotion to double and promotion to var.
… On Feb 10, 2020, at 3:02 PM, Rok Češnovar ***@***.***> wrote:
while still being a better match for exp(int) than std::exp()
But stan::math::exp still uses std::exp so these would be the same in the end right? So I guess this was to prevent int being promoted to var?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Description
My lab mate asked me about the reasoning behind having
exp(int)
defined in the Math library.Example:
inline double exp(int x) { return std::exp(x); }
in https://github.com/stan-dev/math/blob/develop/stan/math/prim/fun/exp.hpp#L18I could not find a reason so I am wondering myself also. Can anyone help me understand the reasoning behind this.
This came up while trying to add a custom function in stan math and using something like
exp(3.3)
inside the stan::math namespace was being truncated down toexp(3)
. This was due to a missingusing std::exp;
that would have been picked if he used cpplint.Current Version:
v3.1.0
The text was updated successfully, but these errors were encountered: