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.
pirms 5 gadiem
Sam Hocevar
b5de2bd6e6
math: implement <<(ostream &, real).
pirms 5 gadiem
Sam Hocevar
9a73325d68
math: fix a bug in hex display of reals.
pirms 5 gadiem
Sam Hocevar
2bf54ebcb0
math: use std::string logic rather than printf() for real number formatting.
pirms 5 gadiem
Sam Hocevar
5814dd4cf0
math: fix a bug in real::cbrt() that completely broke the function.
pirms 6 gadiem
Sam Hocevar
1388625308
input: remove dead code and more cleanup.
pirms 6 gadiem
Sam Hocevar
67a5138718
math: use std::vector instead of lol::array.
pirms 6 gadiem
Sam Hocevar
a407c5d5c4
math: add lol::real to 64-bit integer conversions and clean up code.
pirms 6 gadiem
Sam Hocevar
c826bbd6f0
Fix several compilation warnings.
pirms 7 gadiem
Sam Hocevar
6281145d9d
Implement real::erf() with reasonable precision.
pirms 7 gadiem
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.
pirms 7 gadiem
Sam Hocevar
e0795e91ad
Implement real(int64_t) and real(uint64_t).
pirms 7 gadiem
Sam Hocevar
3025ea2207
Implement real::R_INF and real::R_NAN.
pirms 7 gadiem
Sam Hocevar
d89a4c9e02
Implement real::is_negative().
pirms 7 gadiem
Sam Hocevar
74f174b6d7
Implement real::is_zero and a few others for code clarity.
pirms 7 gadiem
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.
pirms 7 gadiem
Sam Hocevar
359c6fc4c4
Make the real number size a global variable (yuck).
pirms 7 gadiem
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.
pirms 7 gadiem
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.
pirms 7 gadiem
Sam Hocevar
1c27691ef9
Temporary fix for real::sqrt() which I broke recently.
pirms 7 gadiem
Sam Hocevar
dd140fd9e1
Refactor real numbers so that they can have a dynamic size.
Some checks are failing, I probably messed up several functions.
pirms 7 gadiem
Sam Hocevar
783fdbab98
Implement Franke’s function and Matlab’s peaks for reals.
pirms 7 gadiem
Sam Hocevar
0239617197
Various compilation and warning fixes.
pirms 7 gadiem
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.
pirms 7 gadiem
Sam Hocevar
17db5be5c8
math: remove some hardcoded stuff from the real numbers implementation.
pirms 7 gadiem
Sam Hocevar
df7454b36a
math: add real::R_MIN and real::R_MAX and get rid of real::ulp().
pirms 7 gadiem
Sam Hocevar
60ee86f908
ufiodsfiodsifods
pirms 7 gadiem
Sam Hocevar
5d62baaaae
math: parse hexadecimal reals as per C standard, 6.4.4.2.
pirms 7 gadiem
Sam Hocevar
7b9d98109b
math: use exponentiation by squaring for real::pow().
pirms 7 gadiem
Sam Hocevar
10f244192c
math: allow to create real numbers from long doubles
pirms 8 gadiem
Sam Hocevar
c7567975e3
math: add τ (tau) to the list of maths constants.
pirms 9 gadiem
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.
pirms 9 gadiem
Sam Hocevar
efe8e1d051
math: allow to build real numbers from 64-bit integers.
pirms 10 gadiem
Sam Hocevar
cd988786b9
build: reorganise includes so that we can use precompiled headers later.
pirms 10 gadiem
Sam Hocevar
ad9a388e80
misc: remove 100% of the "using namespace std;" madness.
pirms 10 gadiem
Sam Hocevar
fe665f85b4
base: strip core.h from its contents and put it in public/private headers.
pirms 10 gadiem
Sam Hocevar
cdfb4e7abf
math: fix a few compilation warnings.
pirms 10 gadiem
Sam Hocevar
8443733a08
math: add GLSL-inherited degrees() and radians() conversion functions.
pirms 11 gadiem
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.
pirms 12 gadiem
Sam Hocevar
33f2199903
math: minor improvements to the Remez exchange algorithm.
pirms 12 gadiem
Sam Hocevar
4678b4cb75
math: fix a signed integer overflow issue in the fast factorial
computation function.
pirms 12 gadiem
Sam Hocevar
16d53895fa
math: remove coercion rules in the vector classes, they increase the
compilation time for very little benefit and maybe even confusion.
pirms 12 gadiem
Benjamin ‘Touky’ Huet
c7219ff1dd
New year copyright update.
pirms 12 gadiem
Sam Hocevar
d6634da83f
build: fix the WTFPL site URL in all code comments.
pirms 12 gadiem
Sam Hocevar
d4c0c005d6
math: refactor real number constant declarations so that they are only
computed on demand with static initialisation.
pirms 12 gadiem
Sam Hocevar
688c046414
math: add an sprintf() method to real numbers, and ensure they are always
fully initialised.
pirms 12 gadiem
Sam Hocevar
28728814cc
core: replace usage of sin() or std::sin() with lol::sin() where appropriate.
pirms 12 gadiem
Sam Hocevar
ade0514b15
math: add min(), max() and clamp() for half, real and vector types.
pirms 13 gadiem
Sam Hocevar
56e4332597
build: reorganise math files in a single "math" directory, and get rid of the
"shader" source directory since we have "gpu".
pirms 13 gadiem
Sam Hocevar
60a2e83d54
xbox: start working on an Xbox/Direct3D port.
pirms 13 gadiem