-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
Fix: max(int,int) returning double #3024
Conversation
This seems to have been discussed when these overloads were added: /~https://github.com/stan-dev/math/pull/2612/files#r755859461 But I believe Rok was mistaken about what the return_type_t test was actually saying. |
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
Summary
Initially reported downstream: stan-dev/rstan#1116
I believe this may signal a larger issue with return_type_t usage, because the minimum type considered there is
double
, so we should probably avoid using it on functions which accept and want to return all ints.Tests
There were no existing tests for the
max(scalar, scalar)
case, so I added a few, including ones testing that int is returned.Side Effects
None
Release notes
Fixed the return type of
max(int, int)
being a double.Checklist
Copyright holder: Simons Foundation
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
./runTests.py test/unit
)make test-headers
)make test-math-dependencies
)make doxygen
)make cpplint
)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested