Float256
Golang library built on top of math/big Float for basic high precision financial calculations for a cryptocurrency ledger with 42:214 fixed precision serialisation
Install / Use
/learn @l0k18/Float256README
float256
A cryptocurrency ledger token denomination math library
Golang library built on top of math/big Float for high precision financial calculations, intended for use with a cryptocurrency ledger with a maximum integer part of the maximum supply of 4,398,046,511,103, and an unsigned fixed point 42.214 bit 256 bit form for storage and transmission.
This is mainly just convenience wrappers to make working with big.Float easier (functions simply take variables and return results instead of the confusing return-and-modify in math/big, with an added power function (Exp) and n<sup>th</sup> root function (Root) that automatically configures for 256 bits of precision.
It also has convenience converters to and from big.Int, string, int64 and uint64, and numerous other standard basic math library functions. There is no trigonometric functions as these are (pretty much) never used in financial calculations, and also largely absent from the base math/big library.
The reason for the high precision of decimals in this library is because it has been written for a future protocol upgrade to pod (currently being restructured here) due to the unusually small total supply and incredible amount of the tokens stuck in lost or liquidation from failed exchanges that were the only venue at that time for parallelcoin.
To make your code a little less wordy you may want to alias the import with a shorter name with or two letters like f, F, or fl or something similar. The return values are plain vanilla *big.Float variables so it is possible to use them in the normal math/big manner should there be any need to inspect internals such as precision, mantissa, exponent, accuracy, and so forth.
Related Skills
node-connect
335.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
335.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.7kCommit, push, and open a PR
