Welcome to the document of HRCore :-)
HRCore is a rough implement of high resolution calculation library, as a part of my C++ course big homework at the first term of SCUT.
It has implemented integer and float datatype, along with + - * / %
operation, with two types of implement of storage structure.
Features
- Almost unlimited data length
- High resolution, with integers and floats
- Limited calculation operator provided
- Expression calculation supported
- Support for std::cin & std::cout
About the structure
Just shown below:
General Structure
How to build
This library is header only and actually not need to build specially. Just include the file "HRCore.h" and compile, and that's it!
If you'd like to make a standalone header file, please your setup meet the following requirements:
Toolchain requirements:
- GNU C Compiler that supports for C++11 standard (With C++0x may be OK)
- CMake
- GNU Make
Then, run cmake to configure the build and execute "make merge" in the build directory you have just specified.
Actually, the library is cross-platform and MSVC is also supported.
Examples
Example 01: The usage of Integer / Float
12#ifdef HRCORE_USE_MERGE
13#include "../HRCore.hpp"
32 BFLOAT a = BINT::make<Storage::LinkedList<8>>();
35 auto x = (o ==
'-' ? a - b : a + b);
static Integer make()
Construct a new Integer object using given type of Storage::Interface implement.
HRCore main namespace, contains all classes.
Example 02 The usage of Float::precision()
12#ifdef HRCORE_USE_MERGE
13#include "../HRCore.hpp"
24 BFLOAT d = BFLOAT::make<Storage::LinkedList<8>>();
32 BFLOAT a = BINT::make<Storage::LinkedList<8>>();
40 if (Utils::abs(b) < d) {
41 cout <<
"ERROR" << endl;
size_t precision()
Get current precision of division and input.