Skip to content

A fixed-point numerics library aimed for game development in C#.

License

Notifications You must be signed in to change notification settings

stellarLuminant/FixedGameMath

Repository files navigation

FixedGameMath

Build Status codecov

A fixed-point numerics library that implements Fix64, a Q31.32 signed number alongside basic functions. This fork takes a more opinionated approach towards usage with a 2D game framework such as MonoGame.

Features

  • Basic arithmetic: Supports saturating addition, subtraction, multiplication, division. Also offers faster alternatives without overflow checks.
  • Basic trigonometry in degrees: Currently supports sin(x), cos(x), tan(x), atan(x), atan2(y, x), and acos(x).
  • Exponential functions: Currently supports Sqrt(x), Pow(x, y), Pow2(x), Log2(x), Ln(x).
  • Explicit conversion between integral and floating point types.
  • Full-precision parsing and printing with configurable digits and zero padding.

Roadmap

  • Add basic geometric structs: Reimplementations of common structs such as Rects or Vector2 would mean less work on the user to integrate this library.
  • Implement a determinism test suite: Current test suite verifies functions by comparing them to verified implementations (such as System.Math floating point) with a small range of tolerance for error. A determinism test suite would instead store the outputs from a single target platform and compare them for bit-exactness on other platforms.

License

This project uses code derivative of:

Contributions are welcome!

About

A fixed-point numerics library aimed for game development in C#.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages