fixedpoint

Implements fixed point arithmetics.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      fixedpoint:
        github: Groogy/fixedpoint
  2. Run shards install

Usage

To include the fixed point structure you have to write this to get started.

require "fixedpoint"

include FP

Everything is defined in the FP namespace, it's optional to mixin the module but highly recommended. It provides some shortcut to also make things easier to work with.

Future Development

Right now this uses a very naive implementation that does a lot of division meaning a bit slower performance, also limits the range a bit more than other solutions would, especially when it comes to multiplication. So next step should be to do a different kind of implementation that performs better and that let's us use the built-in LLVM operators for fixed point arithmetics.

Contributing

  1. Fork it (https://github.com/Groogy/fixedpoint/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors