Skip to content

bigint_detail

@brief Core foundation operators (Phase 1)

Implements fundamental operators: - Arithmetic: +, -, *, /, **, %, floor, ceil, round, abs, min, max - Comparison: =, !=, <, >, <=, >= - Logic: &&, ||, ! - List: list - I/O: print

All implementations are header-only for compiler optimization.

Functions

Name Description
any_bigint Exact arithmetic when any operand is a bigint.
narrow Give back a plain int when the result fits, so a bigint does not spread through a computation that no longer needs one.

Function Details

any_bigint

inline bool any_bigint(const std::vector<Value>& vals)

Exact arithmetic when any operand is a bigint. Mixing with a float is still done in double, since a float has already lost the precision a bigint is there to keep.

narrow

inline Value narrow(const BigInt& b)

Give back a plain int when the result fits, so a bigint does not spread through a computation that no longer needs one.