HPGCC3 Documentation 3.0 R003

ZINT functions

Defines

#define sat3_zintdigits(zint)   (sat3_strsize(zint)-1)
 Get the number of digits in a ZINT.

Functions

SAT_OBJECT sat3_createzint_xreal (SAT_OBJECT where, XREAL *value)
 Create a ZINT from extended precision real numbers (XREAL).
BOOL sat3_convertzint_xreal (SAT_OBJECT zint, XREAL *value)
 Convert a zint into an extended precision real (XREAL).
SAT_OBJECT sat3_createzint_decn (SAT_OBJECT where, decNumber *value)
 Create a zint from variable precision real numbers (decNumber).
BOOL sat3_convertzint_decn (SAT_OBJECT zint, decNumber **result)
 Convert a zint into an variable precision real (decNumber).
SAT_OBJECT sat3_createzint_dbl (SAT_OBJECT where, double value)
 Create a zint from double precision real numbers.
double sat3_convertzint_dbl (SAT_OBJECT zint)
 Convert a zint into a double precision real.
SAT_OBJECT sat3_createzint_int (SAT_OBJECT where, int value)
 Create a zint from an int.
int sat3_convertzint_int (SAT_OBJECT zint)
 Convert a zint into a 32-bit int.
SAT_OBJECT sat3_createzint_llong (SAT_OBJECT where, LONGLONG value)
 Create a zint from a LONGLONG.
LONGLONG sat3_convertzint_llong (SAT_OBJECT zint)
 Convert a zint into a 64-bit integer.

Detailed Description

This group includes all functions used to create/convert zints.


Define Documentation

#define sat3_zintdigits (   zint)    (sat3_strsize(zint)-1)

Get the number of digits in a ZINT.

Obtain the number of digits in a zint, not including the sign digit.

Parameters:
zintA ZINT integer.
Returns:
Number of digits in the given zint, or 0 if not a zint.

Definition at line 1778 of file sat3.h.


Function Documentation

double sat3_convertzint_dbl ( SAT_OBJECT  zint)

Convert a zint into a double precision real.

This function converts a zint object to a double

Parameters:
zintA SAT_OBJECT zint number.
Returns:
double with value if conversion was successful. When conversion fails it returns 0.0
See also:
sat3_convertzint_decn sat3_convertzint_xreal sat3_convertzint_int sat3_convertzint_llong Object creation and manipulation
BOOL sat3_convertzint_decn ( SAT_OBJECT  zint,
decNumber **  result 
)

Convert a zint into an variable precision real (decNumber).

This function converts a zint object to decNumber. Due to the variable precision nature of zints, a decNumber of the proper size will be allocated from the heap.

Parameters:
zintA SAT_OBJECT zint number.
resultPointer to a decNumber pointer that will receive the address of a newly allocated decNumber.
Returns:
BOOL with TRUE if conversion was successful. When conversion fails it returns FALSE.
See also:
sat3_convertzint_xreal sat3_convertzint_dbl sat3_convertzint_int sat3_convertzint_llong Object creation and manipulation
int sat3_convertzint_int ( SAT_OBJECT  zint)

Convert a zint into a 32-bit int.

This function converts a zint object to an int. If the number is greater than (2**31-1), the largest possible integer is returned (2**31-1), similar thing for negatives.

Parameters:
zintA SAT_OBJECT zint number.
Returns:
int with the given number. When conversion fails (invalid object) it returns 0.
See also:
sat3_convertzint_decn sat3_convertzint_dbl sat3_convertzint_llong sat3_convertzint_xreal Object creation and manipulation
LONGLONG sat3_convertzint_llong ( SAT_OBJECT  zint)

Convert a zint into a 64-bit integer.

This function converts a real object to an int. If the number is greater than (2**63-1), the largest possible integer is returned (2**63-1), similar thing for negatives.

Parameters:
zintA SAT_OBJECT zint number.
Returns:
LONGLONG with the given number. When conversion fails (invalid object) it returns 0.
See also:
sat3_convertzint_decn sat3_convertzint_dbl sat3_convertzint_int sat3_convertzint_xreal Object creation and manipulation
BOOL sat3_convertzint_xreal ( SAT_OBJECT  zint,
XREAL value 
)

Convert a zint into an extended precision real (XREAL).

This function converts a zint object to XREAL.

Parameters:
zintA SAT_OBJECT zint number.
valuePointer to a previously allocated XREAL that will receive the real part.
Returns:
BOOL with TRUE if conversion was successful. When conversion fails it returns FALSE.
See also:
sat3_convertzint_decn sat3_convertzint_dbl sat3_convertzint_int sat3_convertzint_llong Object creation and manipulation
SAT_OBJECT sat3_createzint_dbl ( SAT_OBJECT  where,
double  value 
)

Create a zint from double precision real numbers.

This function creates a zint object from a double.

Parameters:
whereDefines where to allocate memory from. Can be one of the following constants: ALLOC_HEAP Allocates from the C-heap using malloc() ALLOC_TEMPOB Allocates memory from the TEMPOB calculator area or... it can be an element (SAT_OBJECT) within a composite object, (array, list or any other).
valueValue to assign to the newly created number.
Returns:
SAT_OBJECT with the new zint number, or zero if it fails. When a SAT_OBJECT is given to the 'where' parameter, the same SAT_OBJECT is returned, or zero if it fails.
See also:
sat3_createzint_xreal sat3_createzint_decn sat3_createzint_int sat3_createzint_llong Object creation and manipulation
SAT_OBJECT sat3_createzint_decn ( SAT_OBJECT  where,
decNumber value 
)

Create a zint from variable precision real numbers (decNumber).

This function creates a zint object from a decNumber.

Parameters:
whereDefines where to allocate memory from. Can be one of the following constants: ALLOC_HEAP Allocates from the C-heap using malloc() ALLOC_TEMPOB Allocates memory from the TEMPOB calculator area or... it can be an element (SAT_OBJECT) within a composite object, (array, list or any other).
valuePointer to the value to assign to the newly created number.
Returns:
SAT_OBJECT with the new zint number, or zero if it fails. When a SAT_OBJECT is given to the 'where' parameter, the same SAT_OBJECT is returned, or zero if it fails.
See also:
sat3_createzint_xreal sat3_createzint_dbl sat3_createzint_int sat3_createzint_llong Object creation and manipulation
SAT_OBJECT sat3_createzint_int ( SAT_OBJECT  where,
int  value 
)

Create a zint from an int.

This function creates a zint object from a 32-bit integer.

Parameters:
whereDefines where to allocate memory from. Can be one of the following constants: ALLOC_HEAP Allocates from the C-heap using malloc() ALLOC_TEMPOB Allocates memory from the TEMPOB calculator area or... it can be an element (SAT_OBJECT) within a composite object, (array, list or any other).
valueValue to assign to the newly created zint.
Returns:
SAT_OBJECT with the new zint number, or zero if it fails. When a SAT_OBJECT is given to the 'where' parameter, the same SAT_OBJECT is returned or 0 if error.
See also:
sat3_createzint_decn sat3_createzint_dbl sat3_createzint_llong sat3_createzint_xreal Object creation and manipulation
SAT_OBJECT sat3_createzint_llong ( SAT_OBJECT  where,
LONGLONG  value 
)

Create a zint from a LONGLONG.

This function creates a zint object from a 64-bit integer.

Parameters:
whereDefines where to allocate memory from. Can be one of the following constants: ALLOC_HEAP Allocates from the C-heap using malloc() ALLOC_TEMPOB Allocates memory from the TEMPOB calculator area or... it can be an element (SAT_OBJECT) within a composite object, (array, list or any other).
valueValue to assign to the newly created zint.
Returns:
SAT_OBJECT with the new zint number, or zero if it fails. When a SAT_OBJECT is given to the 'where' parameter, the same SAT_OBJECT is returned or 0 if error.
See also:
sat3_createzint_decn sat3_createzint_dbl sat3_createzint_int sat3_createzint_xreal Object creation and manipulation
SAT_OBJECT sat3_createzint_xreal ( SAT_OBJECT  where,
XREAL value 
)

Create a ZINT from extended precision real numbers (XREAL).

This function creates a zint object from an XREAL number.

Parameters:
whereDefines where to allocate memory from. Can be one of the following constants: ALLOC_HEAP Allocates from the C-heap using malloc() ALLOC_TEMPOB Allocates memory from the TEMPOB calculator area or... it can be an element (SAT_OBJECT) within a composite object, (array, list or any other).
valuePointer to the value to assign to the newly created number.
Returns:
SAT_OBJECT with the new zint number, or zero if it fails. When a SAT_OBJECT is given to the 'where' parameter, the same SAT_OBJECT is returned, or zero if it fails.
See also:
sat3_createzint_decn sat3_createzint_dbl sat3_createzint_int sat3_createzint_llong Object creation and manipulation