Commit Graph

128 Commits

Author SHA1 Message Date
ced76721ac maths: add array max/min convenience functions 2018-04-23 15:40:24 +10:00
1678cb3a69 maths: add rsqrt convenience function 2018-04-17 17:01:29 +10:00
366b1f7879 maths: use our abs implementation for relatively_equal
this simplifies calling logic for integral, floating, and coord types
2018-04-11 18:24:52 +10:00
34a274bc92 maths: move abs higher so more functions can use it 2018-04-11 18:24:34 +10:00
24a530e23e maths: remove pow2 function
pow2 has been used enough times to mean 2^x and x^2 that it's not worth
the ambiguity. just use pow(b,e) directly.
2018-04-09 12:30:22 +10:00
4f10505d09 build: fix warnings from -Wparentheses 2018-03-27 20:16:32 +11:00
046e6182e7 maths: avoid division by zero in relatively_equal 2018-03-27 16:14:41 +11:00
5d02171a6f maths: add relatively_equal comparator 2018-03-20 13:35:10 +11:00
af5da5b846 maths: use double negation for equality bool conversion 2018-03-16 11:10:08 +11:00
deb787847c maths: allow mix's t to lie outside [0,1] a little 2018-03-15 15:25:18 +11:00
17816021b9 coord/ops: add std::{cos,sin} overloads for coords 2018-03-13 14:39:38 +11:00
5bc2cf12d4 maths: use true constexpr values for pi 2018-03-12 23:06:15 +11:00
d0f075108e maths: remove gcd in favour of the std implementation 2018-03-11 15:21:36 +11:00
35e3f69ad2 maths, view: rationalise equal,almost_equal,==
views should not do elementwise comparisons for equality operators.
they are pairs of iterators and are only equal if their iterators are
equal.

instead, use `equal` for elementwise equality. we update the name of
exactly_equal to perform this operation too.
2018-01-31 19:33:42 +11:00
681768093e hash: use a consistency, less flexible, interface 2018-01-13 15:24:12 +11:00
9bb2bdbaba Merge remote-tracking branch 'origin/master' 2018-01-10 17:19:39 +11:00
9fbfba580a maths: allow digits10 for 64 bit integers 2018-01-01 15:46:29 +11:00
4bd693a799 maths: allow any integral exponent for pow() 2018-01-01 15:45:56 +11:00
cfe1185621 maths: move log2 into header for constexpr 2017-12-22 12:34:14 +11:00
0351313c36 Merge branch 'master' into coord 2017-11-23 17:24:11 +11:00
d3f434b523 coord: make template parameters more flexible
The coordinate system was unable to support types that prohibited
redim or retype operations. Additionally, the `tags' type used for
providing named data parameters was unwiedly.

We remove much of the dependance on template template parameters in the
defined operations and instead define these in terms of a template
specialisation of is_coord.

The tag types were replaced with direct specialisation of the `store'
struct by the primary type, and passing this type through use of the
CRTP.
2017-11-22 17:03:00 +11:00
34788756d2 build: don't use './' as an include prefix
GCC produces ODR error when including paths of the form './foo' and
'foo' in the same binary. Rather than managing duplication we just
universally pick the absolute form over the relative form.
2017-11-22 16:49:37 +11:00
fb2888d2d5 maths: workaround clang lto ICE in renormalise 2017-10-11 17:15:24 +11:00
a36991fc83 maths: prefer int for `digits' types 2017-10-05 12:45:48 +11:00
a9f8594b26 maths: rename round_to as round_up
this shows more explicitly the rounding policy we're using
2017-08-30 15:39:02 +10:00
5126bb486c maths: revert invalid 'simplification' of round_to 2017-08-30 15:37:39 +10:00
4826b4c466 maths: add some comments to rounding functions 2017-08-30 15:23:42 +10:00
d8e4354f22 maths: only enable util::limit for scalar types
this reduces conflicts with the coord limit operation.
2017-08-24 12:26:36 +10:00
046a369f55 coord: don't use kahan summation for sum(coord)
Our kahan summation algorithm has issues with infinities so we just
avoid using it in coordinates where speed and simplicity are more
important.
2017-06-16 17:38:55 +10:00
089caff53e maths: take references for generic types in almost_equal 2017-06-13 14:18:53 +10:00
f50c77425d maths: make almost_equal constexper for integers 2017-06-13 14:18:32 +10:00
da00e77e7e maths: add signed overloads for renormalise 2017-05-24 15:15:25 +10:00
dca8b174c6 build: add forgotten clang/gcc7 headers 2017-05-16 17:12:14 +10:00
6f4bc6d6b2 maths: add is_nan for arbitrary types 2017-01-23 21:47:53 +11:00
5bb55f5437 maths: don't accidentally overload almost_equal 2017-01-23 21:47:30 +11:00
c4ca41d6c4 maths: make round_pow2 constexpr 2017-01-04 22:40:06 +11:00
0da8c189ec maths: add linear mixing function 2016-12-21 20:23:43 +11:00
9a798446b5 build: remove unnecessary includes
discovered with include-what-you-use
2016-10-12 15:08:22 +11:00
9f3624ba3e maths: add mod wrappers 2016-09-14 17:37:49 +10:00
3d5aff0f30 maths: use mult rather than negation in constexpr
util::digits was triggering signed overflow warnings under gcc. By using
negative multiplication rather than explicit negation we get the same
behaviour, sans warning.
2016-08-29 14:48:07 +10:00
277dfaafae maths: add integer summation path for fsum
this allows us to simplify users of fsum which may not care what
value_type they're passing for summation
2016-08-15 20:56:10 +10:00
8cc4c1e82a format: reimplement format rendering
requires literal string arrays, and implements more of the specifier
specification. does not implement 'n' or '$' specifiers. falls back to
snprintf for real arguments.
2016-07-28 13:39:27 +10:00
e71bd9f621 maths: move is_integer into headers to avoid param explosion 2016-05-12 17:34:47 +10:00
60286202fd maths: make stirling inline rather than constexpr
stirling uses cmath functions which aren't constexpr, such as std::pow.
this sometimes works under linux/gcc but fails under clang/freebsd
2016-05-12 17:32:41 +10:00
2434424488 maths: explicitly inline small methods
Avoids multiply defined symbols when using more aggressive inlining
2016-04-27 15:57:05 +10:00
3a6faca98f maths: use structured assertions in imit 2016-04-19 14:49:17 +10:00
8022d459e5 maths: add samesign convenience function 2016-02-03 13:56:40 +11:00
2224131955 debug: simplify CHECK macros for constexpr safety 2016-02-03 12:04:47 +11:00
c04c56ed32 maths: make is_pow2 constexpr 2016-02-02 11:32:29 +11:00
8e2c5f1942 maths: explanatory header for sign() 2015-11-16 17:57:53 +11:00