jyaif / dux_fixed

Fixed point library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dux_fixed

Build Status

dux_fixed is a library doing deterministic computations.

  • Only implements 52:12 fixed point values.
  • Uses C++17.
  • Follows roughly the Google C++ Style Guide.
  • MIT license.

To run tests locally (requires cmake):

mkdir out
cd out
cmake ../test/
cmake --build . --parallel

./dux_fixed_test

Example

// Arithmetic
dux::FInt a = 42_fx;
dux::FInt b = 2_fx;
dux::FInt c = 84_fx;
assert(a * b == c);
// Trigonometry
assert(dux::trig::Sin(0_fx) == 0_fx);
// 2D Vector
dux::FVec2 v(3_fx, 4_fx);
assert(v.Length() == 5_fx);

About

Fixed point library.

License:MIT License


Languages

Language:C++ 97.2%Language:CMake 1.4%Language:C 1.3%Language:Shell 0.2%