|
Dynamic Fraction Library 1.0.0
Reference-counted arbitrary precision rational number library (MIT OR Unlicense)
|
Basic arithmetic operations for arbitrary precision integers. More...
Functions | |
| di_int | di_add (di_int a, di_int b) |
| Add two integers. | |
| di_int | di_add_i32 (di_int a, int32_t b) |
| Add an integer and a 32-bit signed integer. | |
| di_int | di_sub (di_int a, di_int b) |
| Subtract two integers. | |
| di_int | di_sub_i32 (di_int a, int32_t b) |
| Subtract a 32-bit signed integer from an integer. | |
| di_int | di_mul (di_int a, di_int b) |
| Multiply two integers. | |
| di_int | di_mul_i32 (di_int a, int32_t b) |
| Multiply an integer by a 32-bit signed integer. | |
| di_int | di_div (di_int a, di_int b) |
| Divide two integers using floor division. | |
| di_int | di_mod (di_int a, di_int b) |
| Get remainder of integer division using floor modulo. | |
| di_int | di_negate (di_int a) |
| Negate an integer (change sign) | |
| di_int | di_abs (di_int a) |
| Get absolute value of an integer. | |
| di_int | di_pow (di_int base, uint32_t exp) |
| Raise integer to a power. | |
Basic arithmetic operations for arbitrary precision integers.
Get absolute value of an integer.
| a | Integer to get absolute value of (may be NULL) |
Definition at line 2047 of file dynamic_int.h.
Add two integers.
| a | First integer (may be NULL) |
| b | Second integer (may be NULL) |
Definition at line 1523 of file dynamic_int.h.
Add an integer and a 32-bit signed integer.
| a | Integer operand (may be NULL) |
| b | 32-bit signed integer operand |
Definition at line 1602 of file dynamic_int.h.
Divide two integers using floor division.
| a | Dividend integer (must not be NULL) |
| b | Divisor integer (must not be NULL) |
Uses floor division semantics where the result is rounded towards negative infinity, ensuring consistent behavior with signed operands.
Definition at line 1887 of file dynamic_int.h.
Get remainder of integer division using floor modulo.
| a | Dividend integer (must not be NULL) |
| b | Divisor integer (must not be NULL) |
Uses floor modulo semantics where the remainder always has the same sign as the divisor, consistent with floor division behavior.
Definition at line 2025 of file dynamic_int.h.
Multiply two integers.
| a | First integer (may be NULL) |
| b | Second integer (may be NULL) |
Definition at line 1803 of file dynamic_int.h.
Multiply an integer by a 32-bit signed integer.
| a | Integer operand (may be NULL) |
| b | 32-bit signed integer operand |
Definition at line 1877 of file dynamic_int.h.
Negate an integer (change sign)
| a | Integer to negate (may be NULL) |
Definition at line 1639 of file dynamic_int.h.
Raise integer to a power.
| base | Base integer (may be NULL) |
| exp | Exponent (32-bit unsigned integer) |
Subtract two integers.
| a | First integer (minuend, may be NULL) |
| b | Second integer (subtrahend, may be NULL) |
Definition at line 1614 of file dynamic_int.h.
Subtract a 32-bit signed integer from an integer.
| a | Integer operand (may be NULL) |
| b | 32-bit signed integer operand |
Definition at line 1627 of file dynamic_int.h.