|
Dynamic Fraction Library 1.0.0
Reference-counted arbitrary precision rational number library (MIT OR Unlicense)
|
Functions for creating and destroying fractions. More...
Functions | |
| df_frac | df_from_ints (int64_t numerator, int64_t denominator) |
| Create a fraction from numerator and denominator. | |
| df_frac | df_from_di (di_int numerator, di_int denominator) |
| Create a fraction from a di_int numerator and denominator. | |
| df_frac | df_from_int (int64_t value) |
| Create a fraction from an integer. | |
| df_frac | df_from_double (double value, int64_t max_denominator) |
| Create a fraction from a double. | |
| df_frac | df_copy (df_frac f) |
| Create a copy of a fraction. | |
| df_frac | df_retain (df_frac f) |
| Increase reference count. | |
| void | df_release (df_frac *f) |
| Decrease reference count and free if zero. | |
Functions for creating and destroying fractions.
Create a copy of a fraction.
| f | Fraction to copy (may be NULL) |
Definition at line 678 of file dynamic_fraction.h.
Create a fraction from a di_int numerator and denominator.
| numerator | Numerator as di_int |
| denominator | Denominator as di_int (must not be 0) |
Definition at line 624 of file dynamic_fraction.h.
| df_frac df_from_double | ( | double | value, |
| int64_t | max_denominator | ||
| ) |
Create a fraction from a double.
| value | Double value |
| max_denominator | Maximum denominator for approximation |
Definition at line 645 of file dynamic_fraction.h.
| df_frac df_from_int | ( | int64_t | value | ) |
Create a fraction from an integer.
| value | Integer value |
Definition at line 640 of file dynamic_fraction.h.
| df_frac df_from_ints | ( | int64_t | numerator, |
| int64_t | denominator | ||
| ) |
Create a fraction from numerator and denominator.
| numerator | Numerator value |
| denominator | Denominator value (must not be 0) |
The fraction is automatically reduced to lowest terms.
Definition at line 602 of file dynamic_fraction.h.
| void df_release | ( | df_frac * | f | ) |
Decrease reference count and free if zero.
| f | Pointer to fraction (will be set to NULL) |
Definition at line 696 of file dynamic_fraction.h.
Increase reference count.
| f | Fraction to retain (may be NULL) |
Definition at line 689 of file dynamic_fraction.h.