| 1234567891011121314151617181920212223 |
- //
- // bignum_helper.h
- // bigdecimal
- //
- // Created by Sam Jaffe on 7/4/17.
- //
- #pragma once
- #include <vector>
- namespace math { namespace detail {
- using data_type = std::vector<int32_t>;
- constexpr const int32_t powers[] = {1, 10, 100, 1000, 10000,
- 100000, 1000000, 10000000, 100000000, 1};
- // 1 => GREATER, 0 => EQUAL, -1 => LESS
- int compare(data_type const & rhs, data_type const & lhs, size_t offset = 0);
- void add(data_type & rhs, data_type const & lhs, size_t offset = 0);
- void subtract_nounderflow(data_type & rhs, data_type const & lhs,
- size_t offset = 0);
- void multiply(data_type & rhs, data_type const & lhs);
- data_type divide(data_type & remainder, data_type const & divisor);
- }}
|