|
Dynamic Fraction Library 1.0.0
Reference-counted arbitrary precision rational number library (MIT OR Unlicense)
|
Additional mathematical functions for language interpreters. More...
Functions | |
| df_frac | df_pow (df_frac base, int64_t exponent) |
| Raise fraction to integer power. | |
| df_frac | df_floor (df_frac f) |
| Floor function - greatest integer ≤ f. | |
| df_frac | df_ceil (df_frac f) |
| Ceiling function - smallest integer ≥ f. | |
| df_frac | df_trunc (df_frac f) |
| Truncate towards zero. | |
| df_frac | df_round (df_frac f) |
| Round to nearest integer. | |
| int | df_sign (df_frac f) |
| Get sign of fraction. | |
| df_frac | df_min (df_frac a, df_frac b) |
| Minimum of two fractions. | |
| df_frac | df_max (df_frac a, df_frac b) |
| Maximum of two fractions. | |
| uint64_t | df_hash (df_frac f) |
| Hash function for fractions. | |
| bool | df_fits_int32 (df_frac f) |
| Check if fraction fits in int32_t. | |
| bool | df_fits_int64 (df_frac f) |
| Check if fraction fits in int64_t. | |
| bool | df_fits_double (df_frac f) |
| Check if fraction fits in double without precision loss. | |
| di_int | df_whole_part (df_frac f) |
| Get integer (whole) part of fraction. | |
| df_frac | df_fractional_part (df_frac f) |
| Get fractional part of fraction. | |
Additional mathematical functions for language interpreters.
Ceiling function - smallest integer ≥ f.
| f | Input fraction |
Definition at line 1096 of file dynamic_fraction.h.
| bool df_fits_double | ( | df_frac | f | ) |
Check if fraction fits in double without precision loss.
| f | Input fraction |
Definition at line 1281 of file dynamic_fraction.h.
| bool df_fits_int32 | ( | df_frac | f | ) |
Check if fraction fits in int32_t.
| f | Input fraction |
Definition at line 1263 of file dynamic_fraction.h.
| bool df_fits_int64 | ( | df_frac | f | ) |
Check if fraction fits in int64_t.
| f | Input fraction |
Definition at line 1272 of file dynamic_fraction.h.
Floor function - greatest integer ≤ f.
| f | Input fraction |
Definition at line 1078 of file dynamic_fraction.h.
Get fractional part of fraction.
| f | Input fraction |
Definition at line 1315 of file dynamic_fraction.h.
| uint64_t df_hash | ( | df_frac | f | ) |
Hash function for fractions.
| f | Input fraction |
Definition at line 1236 of file dynamic_fraction.h.
Maximum of two fractions.
| a | First fraction |
| b | Second fraction |
Definition at line 1227 of file dynamic_fraction.h.
Minimum of two fractions.
| a | First fraction |
| b | Second fraction |
Definition at line 1219 of file dynamic_fraction.h.
Raise fraction to integer power.
| base | Base fraction |
| exponent | Integer exponent |
Definition at line 1031 of file dynamic_fraction.h.
Round to nearest integer.
| f | Input fraction |
Definition at line 1135 of file dynamic_fraction.h.
| int df_sign | ( | df_frac | f | ) |
Get sign of fraction.
| f | Input fraction |
Definition at line 1210 of file dynamic_fraction.h.
Truncate towards zero.
| f | Input fraction |
Definition at line 1118 of file dynamic_fraction.h.
Get integer (whole) part of fraction.
| f | Input fraction |
Definition at line 1296 of file dynamic_fraction.h.