Dynamic Fraction Library 1.0.0
Reference-counted arbitrary precision rational number library (MIT OR Unlicense)
Loading...
Searching...
No Matches
Functions
Comparison Operations

Functions for comparing arbitrary precision integers. More...

Functions

int di_compare (di_int a, di_int b)
 Compare two integers.
 
bool di_eq (di_int a, di_int b)
 Test if two integers are equal.
 
bool di_lt (di_int a, di_int b)
 Test if first integer is less than second.
 
bool di_le (di_int a, di_int b)
 Test if first integer is less than or equal to second.
 
bool di_gt (di_int a, di_int b)
 Test if first integer is greater than second.
 
bool di_ge (di_int a, di_int b)
 Test if first integer is greater than or equal to second.
 
bool di_is_zero (di_int big)
 Test if integer is zero.
 
bool di_is_negative (di_int big)
 Test if integer is negative.
 
bool di_is_positive (di_int big)
 Test if integer is positive (> 0)
 
bool di_is_one (di_int big)
 Test if integer equals one.
 

Detailed Description

Functions for comparing arbitrary precision integers.

Function Documentation

◆ di_compare()

int di_compare ( di_int  a,
di_int  b 
)

Compare two integers.

Parameters
aFirst integer (may be NULL)
bSecond integer (may be NULL)
Returns
-1 if a < b, 0 if a == b, 1 if a > b
Since
1.0.0
Note
NULL values are treated as zero for comparison

Definition at line 1305 of file dynamic_int.h.

◆ di_eq()

bool di_eq ( di_int  a,
di_int  b 
)

Test if two integers are equal.

Parameters
aFirst integer (may be NULL)
bSecond integer (may be NULL)
Returns
true if a == b, false otherwise
Since
1.0.0

Definition at line 1333 of file dynamic_int.h.

◆ di_ge()

bool di_ge ( di_int  a,
di_int  b 
)

Test if first integer is greater than or equal to second.

Parameters
aFirst integer (may be NULL)
bSecond integer (may be NULL)
Returns
true if a >= b, false otherwise
Since
1.0.0

Definition at line 1349 of file dynamic_int.h.

◆ di_gt()

bool di_gt ( di_int  a,
di_int  b 
)

Test if first integer is greater than second.

Parameters
aFirst integer (may be NULL)
bSecond integer (may be NULL)
Returns
true if a > b, false otherwise
Since
1.0.0

Definition at line 1345 of file dynamic_int.h.

◆ di_is_negative()

bool di_is_negative ( di_int  big)

Test if integer is negative.

Parameters
bigInteger to test (may be NULL)
Returns
true if integer is negative, false otherwise
Since
1.0.0
Note
NULL is considered zero (not negative)

Definition at line 1358 of file dynamic_int.h.

◆ di_is_one()

bool di_is_one ( di_int  big)

Test if integer equals one.

Parameters
bigInteger to test (may be NULL)
Returns
true if integer equals 1, false otherwise
Since
1.1.0
Note
NULL is considered zero (not one)

Definition at line 1368 of file dynamic_int.h.

◆ di_is_positive()

bool di_is_positive ( di_int  big)

Test if integer is positive (> 0)

Parameters
bigInteger to test (may be NULL)
Returns
true if integer is positive, false otherwise
Since
1.0.0
Note
NULL is considered zero (not positive)

Definition at line 1363 of file dynamic_int.h.

◆ di_is_zero()

bool di_is_zero ( di_int  big)

Test if integer is zero.

Parameters
bigInteger to test (may be NULL)
Returns
true if integer is zero, false otherwise
Since
1.0.0
Note
NULL is considered zero

Definition at line 1353 of file dynamic_int.h.

◆ di_le()

bool di_le ( di_int  a,
di_int  b 
)

Test if first integer is less than or equal to second.

Parameters
aFirst integer (may be NULL)
bSecond integer (may be NULL)
Returns
true if a <= b, false otherwise
Since
1.0.0

Definition at line 1341 of file dynamic_int.h.

◆ di_lt()

bool di_lt ( di_int  a,
di_int  b 
)

Test if first integer is less than second.

Parameters
aFirst integer (may be NULL)
bSecond integer (may be NULL)
Returns
true if a < b, false otherwise
Since
1.0.0

Definition at line 1337 of file dynamic_int.h.