![]() |
Pangolin
Header-only C++20 plane computational geometry library
|
Arbitrary precision signed integers, optimized for small values. More...
#include "core/numeric.hpp"#include <cassert>#include <cmath>#include <compare>#include <concepts>#include <cstddef>#include <cstdint>#include <functional>#include <iostream>#include <limits>#include <stdexcept>#include <string>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| class | pgl::BigInt |
| Arbitrary precision signed integer. More... | |
Namespaces | |
| namespace | pgl |
Macros | |
| #define | PGL_BIGINT_COLD |
Functions | |
| BigInt | pgl::abs (const BigInt &v) |
| Free-function absolute value, matching the integer helpers. | |
Arbitrary precision signed integers, optimized for small values.
BigInt stores its magnitude in a single pgl::int128 whenever it fits, so the common case (numbers that never overflow 128 bits) runs at native speed with no heap allocation. Larger magnitudes spill into a base-2^62 limb vector. The sign is kept separately, so the stored magnitude is always non-negative.
The public interface mirrors the one offered by pgl::Rational: value construction from any integer, the usual arithmetic and comparison operators, compound assignment, increment/decrement, conversions, and stream I/O.
| #define PGL_BIGINT_COLD |