Skip to content

These functions operate on 32-bit numbers, fix16_t, which have 16 bit integer part and 16 bit fractional part.

License

Notifications You must be signed in to change notification settings

netpyoung/libfixmath.net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

libfixmath.net

fix16

using fix16_t = System.Int32;

public struct fix16
{
  private fix16_t value;
}
  • 32-bit numbers, fix16_t, which have 16 bit integer part and 16 bit fractional part.
  • max : 32767.999_985
  • min : -32768.0
    • The minimum value is also used to represent fix16_overflow for overflow detection, so for some operations it cannot be determined whether it overflowed or the result was the smallest possible value. In practice this does not matter much.
  • The smallest unit (machine precision) of the datatype is 1/65536 = 0.000_015

wiki

Define Option

  • I already removed FIXMATH_NO_64BIT, FIXMATH_OPTIMIZE_8BIT from origin source.
Accuracy

    FIXMATH_NO_ROUNDING: Disable rounding. Results may round randomly up or down, i.e. their accuracy is +-1. Runs slightly faster.
    FIXMATH_NO_OVERFLOW: Disable overflow detection and saturating arithmetic support. Overflowing computations will give garbage results. Runs slightly faster.

Platform

    FIXMATH_NO_CACHE: Do not use cache for exp etc. function results. Uses less RAM, runs slightly slower.

Algorithms

    FIXMATH_SIN_LUT: This uses a look-up table generated by the fixsingen tool from svn, it is faster on some devices but the lookup table takes up ~200KiB (205376 bytes) in memory and can be slower dependant on usage.
    FIXMATH_FAST_SIN: This enables a faster but less accurate approximation of the sin function, for code where accuracy isn't as important such as games logic or graphics rendering then this is often a worthwhile tradeoff.

why.

When I try to test deterministic logic on game, I tried to find float library. and I found some. but I decided to customize from original libfixmath.

About

These functions operate on 32-bit numbers, fix16_t, which have 16 bit integer part and 16 bit fractional part.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages