Expand description
This crate defines a custom medium-precision number type. It can support any base b
in the range [0, 65535], and can approximately represent numbers up to
b ^ u64::MAX (actually a bit higher than that but the math is complicated). A core
goal for this type was that it can implement Copy and as a result it can be used in
almost any context a normal unsigned integer would be valid.
Modules§
- traits
- This module contains additional traits I thought may be useful for BigNum usage.
Macros§
- create_
default_ base - This macro creates a default
Baseimplementation with a given name and number.
Structs§
- BigNum
Base - This is the main struct for
bignumbe-rs. - Binary
- This type represents a binary base. It contains more efficient overrides of the
Basefunctions to improve performance. - Decimal
- This type represents a decimal base. It contains more efficient overrides of the
Basefunctions to improve performance. - ExpRange
- This represents the non-inclusive range of exponents that constitute a valid
non-compact significand in the given base. You only need to use this if manually
defining a custom base (if performance is non-critical I would recommend using the
create_default_basemacro). - Hexadecimal
- This type represents a hexadecimal base. It contains more efficient overrides of the
Basefunctions to improve performance. - Octal
- This type represents an octal base. It contains more efficient overrides of the
Basefunctions to improve performance. - SigRange
- This represents the inclusive range of values that constitute a valid non-compact
significand in the given base. You only need to use this if manually defining a custom
base (if performance is non-critical I would recommend using the
create_default_basemacro).
Traits§
- Base
- If performance isn’t critical I’d highly recommend the
create_default_basemacro which creates a base with sensible defaults. The only reason to create a custom implementation is if you find the default implementations’ operations to be a bottleneck. In this case I’d recommend looking at my implementation of theDecimalbase as a guide.