Skip to content

abhisharma1357/solidity-float-point-calculation

 
 

Repository files navigation

Floating point math library

Brought to you by Bankex Foundation

WIP, not ready for production

Fuctionality

Float point number is represented in a binary256 IEEE standard (so library operates on bytes32 and uint256[3] internally).

Included functions:

  • add
  • sub
  • mul
  • div (naive implementation, slow)
  • log2
  • fast inverse sqrt
  • fast div (using fast inverse sqrt)

Planned functions:

  • exp

Known issues:

  • Non-normalized numbers are not properly represented
  • Overflow is not processed

What's inside

Crude core for library and set of tests, including helper functions to encode BigNumber into bytes32. Library is in a form of contract for ease of compilation in deployment (see Tester.sol for example).

How to run

npm install
npm test

tests.js is a set of helper and test functions.

Contributors

About

Proof of concept of basic math operation with Solidity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%