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 年前
Sam Hocevar
783fdbab98
Implement Franke’s function and Matlab’s peaks for reals.
7 年前
Sam Hocevar
0239617197
Various compilation and warning fixes.
7 年前
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 年前
Sam Hocevar
17db5be5c8
math: remove some hardcoded stuff from the real numbers implementation.
7 年前
Sam Hocevar
df7454b36a
math: add real::R_MIN and real::R_MAX and get rid of real::ulp().
7 年前
Sam Hocevar
60ee86f908
ufiodsfiodsifods
7 年前
Sam Hocevar
5d62baaaae
math: parse hexadecimal reals as per C standard, 6.4.4.2.
7 年前
Sam Hocevar
7b9d98109b
math: use exponentiation by squaring for real::pow().
7 年前
Sam Hocevar
10f244192c
math: allow to create real numbers from long doubles
8 年前
Sam Hocevar
c7567975e3
math: add τ (tau) to the list of maths constants.
9 年前
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.
10 年前
Sam Hocevar
efe8e1d051
math: allow to build real numbers from 64-bit integers.
10 年前
Sam Hocevar
cd988786b9
build: reorganise includes so that we can use precompiled headers later.
10 年前
Sam Hocevar
ad9a388e80
misc: remove 100% of the "using namespace std;" madness.
10 年前
Sam Hocevar
fe665f85b4
base: strip core.h from its contents and put it in public/private headers.
10 年前
Sam Hocevar
cdfb4e7abf
math: fix a few compilation warnings.
11 年前
Sam Hocevar
8443733a08
math: add GLSL-inherited degrees() and radians() conversion functions.
11 年前
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 年前
Sam Hocevar
33f2199903
math: minor improvements to the Remez exchange algorithm.
12 年前
Sam Hocevar
4678b4cb75
math: fix a signed integer overflow issue in the fast factorial
computation function.
12 年前
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 年前
Benjamin ‘Touky’ Huet
c7219ff1dd
New year copyright update.
12 年前
Sam Hocevar
d6634da83f
build: fix the WTFPL site URL in all code comments.
12 年前
Sam Hocevar
d4c0c005d6
math: refactor real number constant declarations so that they are only
computed on demand with static initialisation.
12 年前
Sam Hocevar
688c046414
math: add an sprintf() method to real numbers, and ensure they are always
fully initialised.
12 年前
Sam Hocevar
28728814cc
core: replace usage of sin() or std::sin() with lol::sin() where appropriate.
12 年前
Sam Hocevar
ade0514b15
math: add min(), max() and clamp() for half, real and vector types.
13 年前
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 年前
Sam Hocevar
60a2e83d54
xbox: start working on an Xbox/Direct3D port.
13 年前
Sam Hocevar
8bea4cf189
math: ensure real::fabs() is never chosen over std::fabs() for arguments
that are not explicitly real, even with namespace mistakes.
13 年前
Sam Hocevar
bed5dea0c0
math: implement ulp() for reals, which returns the smallest real y > 0 such
that x + y != x, and nextafter() which behaves like the C function.
13 年前
Sam Hocevar
a949a2cd08
math: fix an infinite loop in the real number print function.
13 年前
Sam Hocevar
c4bad581a2
math: write a faster factorial method for use in exp() and sin(). These
functions are now about 20% faster.
13 年前
Sam Hocevar
52e44ef8be
core: fix a few implicit 64-to-32-bit casts in the real methods.
13 年前
Sam Hocevar
366644d43c
real: get rid of <<= and >>= operators; we can use ldexp() instead. As a
bonus, multiplication or division by a power of two will be optimised as
a shift of the exponent.
13 年前
Sam Hocevar
578b35c806
real: fix a rounding bug in real number printing.
13 年前
Sam Hocevar
2beb5d7b8c
core: placement new requires #include <new>, fixing that and a few other
missing includes.
13 年前
Sam Hocevar
f56c72c53d
core: fix the sign of a negative real number raised to an even power, and
add the corresponding unit test.
13 年前
Sam Hocevar
992c198a66
core: allow to build a real number using a string literal.
13 年前
Sam Hocevar
c508dc2a4a
core: dynamically allocate mantissa for real numbers. One day we'll be able
to modify their precision at runtime.
13 年前
Sam Hocevar
4e4e800572
core: implement the gamma function for reals using Spouge's formula.
13 年前
Sam Hocevar
b6b8044442
core: implement frexp(), ldexp() and modf() for reals.
13 年前
Sam Hocevar
b354e17ef3
core: implement log10, sinh and cosh for real numbers.
13 年前
Sam Hocevar
1280301f27
core: implement pow() for real numbers; for now special cases such as
negative zero or negative nth roots are not handled.
13 年前
Sam Hocevar
a66fc123c1
core: fix a bug in real::log() and real::log2() with values smaller than 1.
13 年前
Sam Hocevar
4041166c56
core: improve sin() and exp() performance by replacing divisions with
multiplications where appropriate.
13 年前
Sam Hocevar
2235e9c180
core: implement real methods cbrt(), log2(), exp2(), and copysign().
13 年前
Sam Hocevar
efafb640b7
core: implement tan() for real numbers.
13 年前
Sam Hocevar
5d9167bda0
core: fix an accuracy error in real::re() and real::sqrt() introduced in
the 16-to-32-bit refactoring.
13 年前