MathX is a c++ template library for fixed length arithmetic types.
- easy to learn and use.
- signed and unsigned integers.
- support Little- and Big- Endians memory layout.
- implemented operators ( arithmetic, rational, bitwise ).
- convertsion from/to strings (base2, base8, base16, base10).
- support IOstreams.
- support IO manipulators(dec, hex, oct, showbase, showpos, uppercase, setw, setfill, left, right).
- support numeric_limits.
- auto generated code for numeric_limits for new types.
- auto convert between int_t-based types and uint_t-based types
- auto convert from basic types to int_t/uint_t types
- ready to use types: int128 - uint128 - int256 - uint256 - int512 - uint512 - int1024 - uint1024 - int2048 - uint2048 - int4096 - uint4096 - int8192 - uint8192
As an author of a similar large integer library, I consider myself qualified to give a quick review of this one. This package provides a nice C++ class interface with operator overloading that covers all the basic signed and unsigned int type operations, as well as a few extras such as bit rotate left / right. It has good support for numeric_limits, and the code is thoroughly commented, although the English could use some improvement. The multplication and division algorithms used are the basic O(n*n), making it definitely amoung the slowest of libraries out there. The author also curiously chose to use the slow multiplication algorithm, multiplying by -1 to perform unary negation. The big integers are defined by recursive template instantiation. Each N-bit integer being composed of two N/2 bit integers. This leads to very small and easy to understand source code, but possibly higher compile times, and a higher liklihood that the compiler will choke when trying to use somewhat larger integer sizes. The class provides conversion from floating point types, but this only works for floating point values in the range of a 32-bit int for float, or a 64-bit int for double, even though these floating point types can store integral values far outside that range. Big endian mode is supported but makes a mistake I too once made which means it will mistakenly use big endian mode when used with gcc on Linux, due to a macro name clash. Ease of use: Very High Correctness: Some minor concerns Documentation: Good Feature set: Moderately Low Performance: Low Scalability: Low