RomanZhu / FixedPoint-Sharp

Fixed point math with 48.16 precision (based on lib by https://github.com/fholm)
MIT License
168 stars 40 forks source link

Missing documentation #3

Closed james7132 closed 4 years ago

james7132 commented 4 years ago

The README does not document the following:

Vincenz099 commented 4 years ago

Due to the optimisation for speed, the muls and divs are significantly faster, but use the whole range of 32 bits to overflow into, meaning its only having a range of -2^15 to +2^15 and -Q15.16 to +Q15.16 Overflow is as described above.

RomanZhu commented 4 years ago

Conversions to other numeric types are explicit: https://github.com/RomanZhu/FixedPoint-Sharp/blob/8bbcc9d3523277035f2cc3fc026264bdc4f9901b/FixedPointSharp/fixnum/fp.cs#L278 All basic operations also accept ints: https://github.com/RomanZhu/FixedPoint-Sharp/blob/8bbcc9d3523277035f2cc3fc026264bdc4f9901b/FixedPointSharp/fixnum/fp.cs#L96