Commit Graph

71 Commits

Author SHA1 Message Date
Jeremy W. Murphy
e963c67af2 Normalize after left-shift assignment to prevent denormalized zeroes. 2016-04-10 01:27:36 +10:00
jzmaddock
11500b787b Merge branch 'polynomial_shift' of https://github.com/jeremy-murphy/math into gcd
# 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-04-06 17:58:21 +01:00
Jeremy W. Murphy
238cd6078b polynomial: odd/even predicates.
We use the definition of odd and even consistent with considering x as the
smallest prime factor. That is, an even polynomial has a constant of zero.
2016-03-28 16:04:27 +11:00
Jeremy W. Murphy
e9da8a10bf polynomial: Left and right shift operators.
Shifting adds or removes a factor of x in the same way that shifting adds
or removes a factor of 2 to integers.
2016-03-27 22:03:33 +11:00
jzmaddock
65f7440c2f Minor fixes for polynomial division:
* Use Boost.Config macros not direct checks on C++ version.
* Use dedicated integer power function - fixes VC10 build failure, also prevents loss of digits when integer type is wider than double.
2016-03-02 19:37:46 +00:00
Jeremy W. Murphy
93a0ff967d Use the strictly correct brace initializer_list construction. 2016-03-02 13:38:36 +11:00
Jeremy W. Murphy
7969de6fae Add C++11 initializer_list constructor and assignment to polynomial class. 2016-01-31 19:04:37 +11:00
Jeremy W. Murphy
0e4bfc9f8e Test cpp_int, cpp_rational, cpp_bin_float_single and cpp_dec_float_50. 2016-01-16 14:54:00 +11:00
Jeremy W. Murphy
99e6e2c3cb A better and more instructive unit test for gcd. 2015-12-11 11:58:33 +11:00
Jeremy W. Murphy
c313aed73b Explicitly cast right-hand argument to avoid MSVC C2666. 2015-11-28 09:00:21 +11:00
Jeremy W. Murphy
292bfc6752 Denormalize zero in multiplication to fit algorithmic requirements.
Fixes bug introduced by normalizing zero to the empty set.
2015-11-20 11:33:00 +11:00
Jeremy W. Murphy
e459241687 Use a different polynomial to test arithmetic relations.
This one appears to reveal a bug in operator *=.
2015-11-19 09:08:27 +11:00
Jeremy W. Murphy
e6e1e9440b Make the single-argument constructor explicit.
Prevent unexpected conversion to polynomial!
2015-11-18 12:15:35 +11:00
Jeremy W. Murphy
cca7e08d3f Make an explicit note of which unit tests currently fail. 2015-11-17 10:17:30 +11:00
Jeremy W. Murphy
87268a735a Division of polynomials over integers.
Test int and double throughout most of test suite.
2015-11-16 00:41:37 +11:00
Jeremy W. Murphy
94e961ec7c Division and modulus by a number.
Test that multiplication by 0.5 is equal to division by 2.
2015-11-09 00:43:29 +11:00
Jeremy Murphy
6ee7f90bf8 Typedef the coefficient type. 2015-11-04 20:15:38 +11:00
Jeremy W. Murphy
ac2943e053 Unit tests for arithmetic in general, especially for zero. 2015-11-03 23:59:29 +11:00
Jeremy W. Murphy
5cbeac0297 Update unit test; enable in Jamfile. 2015-11-01 16:11:53 +11:00
Jeremy W. Murphy
03de702ee5 Unit testing... 2015-10-28 22:27:13 +11:00
Jeremy W. Murphy
f8fc1e4e35 Start making a unit test. 2015-10-27 10:35:06 +11:00