Commit Graph

139 Commits

Author SHA1 Message Date
b9f739324a maths: add pow2 convenience function 2019-03-28 14:28:08 +11:00
89a4641c33 maths: add maxmin query 2019-03-20 16:07:30 +11:00
5cdabcb583 maths: remove duplicate equality test helpers 2019-02-03 16:38:06 +11:00
6b1dbb3834 maths: abs should be constexpr 2018-09-27 14:17:54 +10:00
f6056153e3 rename root namespace from util to cruft
This places, at long last, the core library code into the same namespace
as the extended library code.
2018-08-05 14:42:02 +10:00
803acc9a87 relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
437b4267d3 maths: relax argument restrictions for min/max 2018-05-30 16:54:04 +10:00
cdac2dcbc2 maths: add 'frac' function
Extracts the fractional component from a floating point number. Prefer
to use temporaries that you have on hand over these functions.
2018-05-21 15:06:07 +10:00
2ec9a7ebe6 maths: remove util::is_nan in preference of std::isnan 2018-05-10 12:45:45 +10:00
b01173d82b maths: rename limit to clamp 2018-05-03 21:43:48 +10:00
497d3ca970 build: update for gcc-8.1 warnings 2018-05-03 18:32:08 +10:00
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