Commit Graph

56 Commits

Author SHA1 Message Date
Aleksander
0ccc0230ab Do not create rational from array type. (#36)
* Do not create rational from array type.
* Fix build on older compilers.
2019-04-16 11:42:54 -04:00
Tony E Lewis
f749952f0b Add more constexpr to code and doc (#32)
* Change some C++14 constexprs to C++11 constexprs
* Update doc to reflect constexpr changes
2018-11-02 08:20:58 -04:00
Tony Lewis
ec10199410 Liberally scatter BOOST_CXX14_CONSTEXPR throughout 2018-10-29 16:23:35 -04:00
James E. King III
2c7fe1aae7 Revert "Add pow method"
This reverts commit 25ad8e5a5c.
2018-07-14 11:18:52 -04:00
James E. King III
25ad8e5a5c Add pow method 2018-06-17 21:18:01 -04:00
James E. King III
63f7de8074 Add CI framework
- travis with valgrind, cppcheck, ubsan, codecov, covscan (future)
  - appveyor with MSVC 2010 through 2017, cygwin 32/64, mingw 32/64
  - README, LICENSE, etc.
2018-06-14 08:13:24 -04:00
jzmaddock
44f1c9501b Add support for construction/assignment from two different integer types.
Improve tests - check for mixed construction, and test domain_errors occur at the correct boundaries.
2017-03-27 08:23:58 +01:00
Kohei Takahashi
b2fc4f28e9 Comparators should be const member.
And constexpr is no longer const after c++14: In c++11, non-static constexpr
member is implicitly const member, but after c++14 it isn't.
2017-02-03 16:52:08 +09:00
jzmaddock
ff2530e119 Merge branch 'no-float-convert' of https://github.com/jzmaddock/rational into develop
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
2016-12-28 19:22:56 +00:00
Geoff Romer
1307b89a2f Drop using directive, and fully qualify std names.
Even with `using namespace std`, it's not safe to use names from std
without qualification in a header file, because the names may conflict
with names in the global namespace, leading to ambiguities.
2015-11-30 12:26:38 -08:00
Edward Diener
6c1cad78a2 Merge pull request #6 from mlang/gcd_lcm
Support for gcd and lcm of rational numbers.
2015-08-27 12:57:37 -04:00
Mario Lang
a5dfd176d3 Qualify to avoid ambiguities. 2015-04-03 20:01:06 +02:00
Marshall Clow
a69d2d9ea6 Merge pull request #3 from jzmaddock/boost_throw_exception
Boost throw exception.
@jzmaddock ; if you remind me tomorrow, I will merge to master. (after the tests cycle)
2015-04-01 19:25:41 -07:00
Marshall Clow
92a0f30c66 Merge pull request #1 from jzmaddock/patch-1
Update rational.hpp
Now I have write access ;-)
@jzmaddock ; if you remind me tomorrow, I will merge to master. (after the tests cycle)
2015-04-01 19:23:54 -07:00
Adam Wulkiewicz
8ba6fb10c9 Replace while(true) with for(;;) to suppress compiler warning.
msvc warning C4127: conditional expression is constant
2015-01-28 23:59:38 +01:00
Mario Lang
a5bfd77e52 Update for the move of common_factor_rt from math to integer. 2015-01-20 23:13:47 +01:00
Mario Lang
1673b917de Merge branch 'master' into gcd_lcm 2015-01-20 23:13:00 +01:00
Peter Dimov
b8ee36c542 Replaced math::gcd, lcm references to integer. 2015-01-15 03:50:48 +02:00
Mario Lang
28ba48d2c9 Support for gcd and lcm of rational numbers. 2014-11-18 01:47:47 +01:00
jzmaddock
bede51e319 We can have a throw expression in a converting constructor after all - fix so it works.
Also test that converting constructor does throw when expected.
2014-07-28 11:50:47 +01:00
jzmaddock
bf07b2f05d Use BOOST_THROW_EXCEPTION throughout.
Note that template converting constructor is now no longer constexpr - however that was always really the case since a function that potentially throws can't be used in a constexpr context anyway.
2014-07-28 11:18:52 +01:00
jzmaddock
5fddb3f889 Update rational.hpp
Access to the numerator and denominator is unnecessarily inefficient when using rational with multiprecision types (ie where copying is relatively expensive), this change returns const-references to numerator and denominator.  In all other respects existing code should be uneffected by this change.
2014-07-28 09:51:00 +01:00
Stephen Kelly
9ee8441000 Remove use of obsolete BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE{,_SPEC} macro.
[SVN r85896]
2013-09-25 10:29:44 +00:00
Daryle Walker
c7b0c7c41e Removed unneeded forward declarations, added defaulted parameter to private helper function; both suggested by Mario Lang
[SVN r85548]
2013-09-02 05:37:45 +00:00
Daryle Walker
2b307a4a18 Integrated Boost.Rational's sanity checks during assignment in the input operator, respecting IOStreams' exception policy
[SVN r85541]
2013-09-01 10:54:47 +00:00
Daryle Walker
5e8a48d030 Fixed normalization problem with Boost.Rational's "assign"; add check for negative values too large for normalization (refs #9067)
[SVN r85526]
2013-08-30 13:18:37 +00:00
Daryle Walker
d5319c0c14 Started modernizing Boost.Rational I/O (refs #7187)
[SVN r85519]
2013-08-30 00:22:01 +00:00
Daryle Walker
48d70b695d Make the I/O part of Boost.Rational conditional on the configuration flag BOOST_NO_IOSTREAM (refs #7250).
[SVN r85498]
2013-08-28 07:12:48 +00:00
Daryle Walker
2c1bfb7ed7 Added cross-instantiation constructor template, refs #9018.
[SVN r85484]
2013-08-27 10:35:26 +00:00
Daryle Walker
d9d55b3245 Add constexpr to some functions in Boost.Rational
[SVN r85454]
2013-08-25 08:36:27 +00:00
Daryle Walker
674a61fabe Used static_cast to suppress a warning/error about a narrowing conversion. Fixes #5855.
[SVN r85418]
2013-08-21 23:24:54 +00:00
Steven Watanabe
91fc23c802 Implement rational<IntType>/IntType operations directly to reduce calls to gcd. Patch by Mario Lang.
[SVN r78537]
2012-05-22 02:07:33 +00:00
John Maddock
4f0a8148b3 MSVC warning suppression.
Fixes #2606.

[SVN r50363]
2008-12-22 09:57:35 +00:00
Daryle Walker
94caf9a401 Tweaked files to pass inspection report; one file had some min/max violations; but all had to have 'boostinspect:nolicense' set because a copyrighter, Paul Moore, has disappeared, so his files can never be changed to the main Boost license
[SVN r47847]
2008-07-27 23:43:04 +00:00
Jonathan Turkanis
fa7f26c8f4 fixed issue 1545
[SVN r45750]
2008-05-25 19:13:02 +00:00
Daryle Walker
16d0b949ee Removed requirement of mixed-mode division in rational_cast; added test where the requirement's removal was needed; demonstrated limited cross-version rational casting
[SVN r35859]
2006-11-05 19:07:24 +00:00
Daryle Walker
585171bfc7 Solved patch #1438626 by depreciating 'gcd' and 'lcm' provided in namespace 'boost' in 'rational.hpp', replaced by the ones in Boost.Math; fored to add 'std::numeric_limits' compatibility as a requirement; started doing invariant checks
[SVN r35843]
2006-11-04 21:11:15 +00:00
Daryle Walker
4c87ccd627 Changed rational comparison algorithm to avoid overflow and fix bug #798357; changed integer comparison algorithm to match
[SVN r35800]
2006-10-31 15:30:22 +00:00
Joaquín M. López Muñoz
4a813b2545 added fix for CW 8.3
[SVN r35668]
2006-10-20 06:24:33 +00:00
Joaquín M. López Muñoz
2834fc0f2b applied BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE to rational_cast
[SVN r35653]
2006-10-18 12:46:19 +00:00
Daryle Walker
d0ec97c358 Added a Boolean conversion operator to boost::rational<>.
[SVN r32167]
2005-12-27 11:38:28 +00:00
Jonathan Turkanis
36d3205fd7 made int type public
[SVN r30116]
2005-07-15 17:42:12 +00:00
Beman Dawes
aed4430a52 add or update See www.boost.org comments
[SVN r16708]
2002-12-27 16:51:53 +00:00
Björn Karlsson
fbf591b599 patch for operator-
[SVN r15547]
2002-09-29 15:51:08 +00:00
Dave Abrahams
16acf13b51 applied patch from Paul Moore
[SVN r12879]
2002-02-21 16:31:54 +00:00
Beman Dawes
55d4d00158 Self-operations fixes from Paul Moore, reported by Vesa Karvonen
[SVN r12851]
2002-02-18 01:18:31 +00:00
Jens Maurer
7e430c84eb replace gcd() implementation (Helmut Zeisel, Paul Moore)
[SVN r10539]
2001-07-05 18:15:39 +00:00
John Maddock
727b4189a7 Fixed gcc 3 preproccessor logic
[SVN r10313]
2001-06-12 11:27:26 +00:00
Dave Abrahams
4262ab4051 Workarounds for Intel C++ 5.0
[SVN r9404]
2001-03-04 15:04:20 +00:00
Jens Maurer
1ddd67effc old GNU c++ lib does not have ios_base, so avoid it
[SVN r8987]
2001-02-06 22:03:02 +00:00