Documentation ¶
Overview ¶
Package bpmath provides types and functions for doing basis point operations with math.Int. So, the result is always math.Int, and follows the Go rounding semantic for integer nubmer: rounds towards zero.
Index ¶
Constants ¶
View Source
const ( One = 10000 Half = One / 2 Zero = 0 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BP ¶
type BP uint32
BP represents values in basis points. Maximum value is 2^32-1. Note: BP operations should not be chained - this causes precision losses.
type FixedBP ¶
type FixedBP uint32
FixedBP assures that all operations are in 0-10'000 range Note: FixedBP operations should not be chained - this causes precision loses.
func FixedFromQuo ¶
FixedFromQuo returns a/b in basis points. Returns 10'000 if a >= b; Contract: a>=0 and b > 0. Panics if b==0.
Click to show internal directories.
Click to hide internal directories.