Sam Hocevar
155ae65a4e
Start working on the header-only part of the framework.
This implies creating a trimmed down branch that contains almost
nothing. It will then be usable by projects that do not need the
complex build system, and by the engine itself as a submodule from
the same repository.
5 vuotta sitten
Sam Hocevar
b5de2bd6e6
math: implement <<(ostream &, real).
5 vuotta sitten
Sam Hocevar
9a73325d68
math: fix a bug in hex display of reals.
5 vuotta sitten
Sam Hocevar
2bf54ebcb0
math: use std::string logic rather than printf() for real number formatting.
5 vuotta sitten
Sam Hocevar
5814dd4cf0
math: fix a bug in real::cbrt() that completely broke the function.
6 vuotta sitten
Sam Hocevar
1388625308
input: remove dead code and more cleanup.
6 vuotta sitten
Sam Hocevar
67a5138718
math: use std::vector instead of lol::array.
6 vuotta sitten
Sam Hocevar
a407c5d5c4
math: add lol::real to 64-bit integer conversions and clean up code.
6 vuotta sitten
Sam Hocevar
c826bbd6f0
Fix several compilation warnings.
7 vuotta sitten
Sam Hocevar
6281145d9d
Implement real::erf() with reasonable precision.
7 vuotta sitten
Sam Hocevar
80823faac6
Make fast real factorial more generic.
This new version allows to compute odd and even double factorials
without harming performance for the standard factorial.
7 vuotta sitten
Sam Hocevar
e0795e91ad
Implement real(int64_t) and real(uint64_t).
7 vuotta sitten
Sam Hocevar
3025ea2207
Implement real::R_INF and real::R_NAN.
7 vuotta sitten
Sam Hocevar
d89a4c9e02
Implement real::is_negative().
7 vuotta sitten
Sam Hocevar
74f174b6d7
Implement real::is_zero and a few others for code clarity.
7 vuotta sitten
Sam Hocevar
c7c34312fe
Handle real::DEFAULT_BIGIT_COUNT changes a bit better.
Most operators do not yet handle reals of different sizes, but
this change fixes the most glaring bugs.
7 vuotta sitten
Sam Hocevar
359c6fc4c4
Make the real number size a global variable (yuck).
7 vuotta sitten
Sam Hocevar
74fc7c1f58
Fix real construction from long doubles.
It was hard to avoid some of the compiler optimisations caused by our
intermediate conversion to double, so we hide them behind the actual
real object. Also, this commit fixes a potential exponent overflow.
7 vuotta sitten
Sam Hocevar
8ffc3ccae2
Fix issues in real::sqrt() and other methods.
Now that the exponent is no longer biased, it is a signed number, and we
need to account for that when dividing it and expecting rounding rules to
behave in a certain way.
7 vuotta sitten
Sam Hocevar
1c27691ef9
Temporary fix for real::sqrt() which I broke recently.
7 vuotta sitten
Sam Hocevar
dd140fd9e1
Refactor real numbers so that they can have a dynamic size.
Some checks are failing, I probably messed up several functions.
7 vuotta sitten
Sam Hocevar
783fdbab98
Implement Franke’s function and Matlab’s peaks for reals.
7 vuotta sitten
Sam Hocevar
0239617197
Various compilation and warning fixes.
7 vuotta sitten
Sam Hocevar
1733d0ffd8
math: tweak the real number printing routine.
By adding a bias we ensure that 1.999… will be displayed as 2.0 as long as we
do not ask for too many digits, and that rounding is reasonable for most values.
Note that our need for proper rounding is not as high as for IEEE floats since
we have an insane amount of digits at our disposal.
Also we now get rid of trailing zeroes when printing reals.
7 vuotta sitten
Sam Hocevar
17db5be5c8
math: remove some hardcoded stuff from the real numbers implementation.
7 vuotta sitten
Sam Hocevar
df7454b36a
math: add real::R_MIN and real::R_MAX and get rid of real::ulp().
7 vuotta sitten
Sam Hocevar
60ee86f908
ufiodsfiodsifods
7 vuotta sitten
Sam Hocevar
5d62baaaae
math: parse hexadecimal reals as per C standard, 6.4.4.2.
7 vuotta sitten
Sam Hocevar
7b9d98109b
math: use exponentiation by squaring for real::pow().
7 vuotta sitten
Sam Hocevar
10f244192c
math: allow to create real numbers from long doubles
8 vuotta sitten
Sam Hocevar
c7567975e3
math: add τ (tau) to the list of maths constants.
9 vuotta sitten
Sam Hocevar
45b57cc102
math: rename re() to inverse() in all classes.
The name “re” came from “reciprocal” but since we have “inverse” for
matrices, I thought it would be nice to make everything consistent.
9 vuotta sitten
Sam Hocevar
efe8e1d051
math: allow to build real numbers from 64-bit integers.
10 vuotta sitten
Sam Hocevar
cd988786b9
build: reorganise includes so that we can use precompiled headers later.
10 vuotta sitten
Sam Hocevar
ad9a388e80
misc: remove 100% of the "using namespace std;" madness.
10 vuotta sitten
Sam Hocevar
fe665f85b4
base: strip core.h from its contents and put it in public/private headers.
10 vuotta sitten
Sam Hocevar
cdfb4e7abf
math: fix a few compilation warnings.
10 vuotta sitten
Sam Hocevar
8443733a08
math: add GLSL-inherited degrees() and radians() conversion functions.
11 vuotta sitten
Sam Hocevar
6faf4ee067
base: roll our own constants because it’s always a pain in the ass
to get M_PI from the platform headers and cast it to float.
12 vuotta sitten
Sam Hocevar
33f2199903
math: minor improvements to the Remez exchange algorithm.
12 vuotta sitten
Sam Hocevar
4678b4cb75
math: fix a signed integer overflow issue in the fast factorial
computation function.
12 vuotta sitten
Sam Hocevar
16d53895fa
math: remove coercion rules in the vector classes, they increase the
compilation time for very little benefit and maybe even confusion.
12 vuotta sitten
Benjamin ‘Touky’ Huet
c7219ff1dd
New year copyright update.
12 vuotta sitten
Sam Hocevar
d6634da83f
build: fix the WTFPL site URL in all code comments.
12 vuotta sitten
Sam Hocevar
d4c0c005d6
math: refactor real number constant declarations so that they are only
computed on demand with static initialisation.
12 vuotta sitten
Sam Hocevar
688c046414
math: add an sprintf() method to real numbers, and ensure they are always
fully initialised.
12 vuotta sitten
Sam Hocevar
28728814cc
core: replace usage of sin() or std::sin() with lol::sin() where appropriate.
12 vuotta sitten
Sam Hocevar
ade0514b15
math: add min(), max() and clamp() for half, real and vector types.
13 vuotta sitten
Sam Hocevar
56e4332597
build: reorganise math files in a single "math" directory, and get rid of the
"shader" source directory since we have "gpu".
13 vuotta sitten
Sam Hocevar
60a2e83d54
xbox: start working on an Xbox/Direct3D port.
13 vuotta sitten