HPGCC3 Documentation 3.0 R003
|
Go to the source code of this file.
Data Structures | |
struct | XREAL |
Extended real type that can contain a calculator real. More... | |
struct | conversion_data |
Data structure used to convert an XREAL number to string. More... | |
Defines | |
#define | xr_xr2uint(num) ((unsigned int)xr_xr2ullong(num)) |
#define | LN2_LN10 1292913987LL |
Constant LN(2)/LN(10) expressed as a 64-bit integer in fixed point, for internal use. | |
Functions | |
void | xr_10pow (int exp10, XREAL *value) |
Power of 10 as an XREAL number. | |
char * | xr_atoxr (const char *str, XREAL *res) |
Convert a string to an XREAL number. | |
char * | xr_xrtoa (XREAL *number, struct conversion_data *data) |
Convert an XREAL number to string format. | |
void | xr_base2 (XREAL *base10, XREAL *res) |
Change internal representation to a base-2 system. | |
void | xr_base10 (XREAL *base2, XREAL *res) |
Change internal representation to a base-10 system. | |
void | xr_div (XREAL *num, XREAL *div, XREAL *result) |
Basic operator: division. | |
void | xr_mul (XREAL *num1, XREAL *num2, XREAL *result) |
Basic operator: multiplication. | |
void | xr_add (XREAL *num1, XREAL *num2, XREAL *result) |
Basic operator: addition. | |
void | xr_sub (XREAL *num1, XREAL *num2, XREAL *result) |
Basic operator: Subtraction. | |
void | xr_double2xr (double val, XREAL *num) |
Convert a double to an XREAL number. | |
void | xr_int2xr (int val, XREAL *num) |
Convert a 32-bit integer to an XREAL number. | |
void | xr_llong2xr (long long val, XREAL *num) |
Convert a 64-bit integer to an XREAL number. | |
void | xr_uint2xr (unsigned int val, XREAL *num) |
Convert a 32-bit unsigned integer to an XREAL number. | |
void | xr_ullong2xr (unsigned long long val, XREAL *num) |
Convert a 64-bit integer to an XREAL number. | |
double | xr_xr2double (XREAL *num) |
Convert an XREAL number to 'double' format. | |
long long | xr_xr2llong (XREAL *num) |
Convert an XREAL number to 64-bit integer in 'long long' format. | |
int | xr_xr2int (XREAL *num) |
Convert an XREAL number to 32-bit integer. | |
unsigned long long | xr_xr2ullong (XREAL *num) |
Convert an XREAL number to unsigned 64-bit integer in 'unsigned long long' format. | |
int | xr_getbasedigit (char num, int base) |
Internal use. | |
unsigned long long | xr_getbaselimit (int base) |
Internal use. | |
int | xr_getdigits10 (XREAL *xr, char *buffer) |
Internal use. | |
int | xr_getdigits (XREAL *num, char *buffer, int base) |
Internal use. | |
int | xr_getnumbits (int number) |
Internal use. |
#define LN2_LN10 1292913987LL |
#define xr_xr2uint | ( | num | ) | ((unsigned int)xr_xr2ullong(num)) |
void xr_10pow | ( | int | exp10, |
XREAL * | value | ||
) |
Basic operator: addition.
This function calculates num1 + num2 and stores the result.
num1 | Pointer to an XREAL number |
num2 | Pointer to an XREAL number |
result | Pointer to an XREAL to be filled with the result. Can be the same as one of the operands. |
char* xr_atoxr | ( | const char * | str, |
XREAL * | res | ||
) |
Convert a string to an XREAL number.
This function converts a number stored in text format to the extended real format.
str | String with a valid number |
res | Pointer to an XREAL to be filled with the result. |
Change internal representation to a base-10 system.
This function converts a number stored in base-2 format to the base-10 format.
base2 | Pointer to an XREAL number stored in base-2 format |
res | Pointer to an XREAL to be filled with the result. |
Change internal representation to a base-2 system.
This function converts a number stored in base-10 format to the base-2 format.
base10 | Pointer to an XREAL number stored in base-10 format |
res | Pointer to an XREAL to be filled with the result. |
Basic operator: division.
This function calculates numerator / denominator and stores the result.
num | Pointer to an XREAL number (numerator) |
div | Pointer to an XREAL number (denominator) |
result | Pointer to an XREAL to be filled with the result. Can be the same as one of the operands. |
void xr_double2xr | ( | double | val, |
XREAL * | num | ||
) |
Convert a double to an XREAL number.
This function converts a number stored in 'double' format to the extended real format.
val | Number to convert |
num | Pointer to an XREAL to be filled with the result. |
int xr_getbasedigit | ( | char | num, |
int | base | ||
) |
Internal use.
unsigned long long xr_getbaselimit | ( | int | base | ) |
Internal use.
int xr_getdigits | ( | XREAL * | num, |
char * | buffer, | ||
int | base | ||
) |
Internal use.
int xr_getdigits10 | ( | XREAL * | xr, |
char * | buffer | ||
) |
Internal use.
int xr_getnumbits | ( | int | number | ) |
Internal use.
void xr_int2xr | ( | int | val, |
XREAL * | num | ||
) |
Convert a 32-bit integer to an XREAL number.
This function converts a number stored in 'int' format to the extended real format.
val | Number to convert |
num | Pointer to an XREAL to be filled with the result. |
void xr_llong2xr | ( | long long | val, |
XREAL * | num | ||
) |
Convert a 64-bit integer to an XREAL number.
This function converts a number stored in 'int' format to the extended real format.
val | Number to convert |
num | Pointer to an XREAL to be filled with the result. |
Basic operator: multiplication.
This function calculates num1 * num2 and stores the result.
num1 | Pointer to an XREAL number |
num2 | Pointer to an XREAL number |
result | Pointer to an XREAL to be filled with the result. Can be the same as one of the operands. |
Basic operator: Subtraction.
This function calculates num1 - num2 and stores the result.
num1 | Pointer to an XREAL number |
num2 | Pointer to an XREAL number |
result | Pointer to an XREAL to be filled with the result. Can be the same as one of the operands. |
void xr_uint2xr | ( | unsigned int | val, |
XREAL * | num | ||
) |
Convert a 32-bit unsigned integer to an XREAL number.
This function converts a number stored in 'unsigned int' format to the extended real format.
val | Number to convert |
num | Pointer to an XREAL to be filled with the result. |
void xr_ullong2xr | ( | unsigned long long | val, |
XREAL * | num | ||
) |
Convert a 64-bit integer to an XREAL number.
This function converts a number stored in 'long long' format to the extended real format.
val | Number to convert |
num | Pointer to an XREAL to be filled with the result. |
double xr_xr2double | ( | XREAL * | num | ) |
Convert an XREAL number to 'double' format.
This function converts an XREAL number to the standard C 'double' format.
num | Number to convert |
int xr_xr2int | ( | XREAL * | num | ) |
Convert an XREAL number to 32-bit integer.
This function converts an XREAL number to the standard C 'int' format.
num | Number to convert |
long long xr_xr2llong | ( | XREAL * | num | ) |
Convert an XREAL number to 64-bit integer in 'long long' format.
This function converts an XREAL number to the standard C 'long long' format.
num | Number to convert |
unsigned long long xr_xr2ullong | ( | XREAL * | num | ) |
Convert an XREAL number to unsigned 64-bit integer in 'unsigned long long' format.
This function converts an XREAL number to the standard C 'unsigned long long' format.
num | Number to convert |
char* xr_xrtoa | ( | XREAL * | number, |
struct conversion_data * | data | ||
) |
Convert an XREAL number to string format.
This function converts a number in XREAL format into a string.
number | The number to be converted |
data | Pointer to a structure with all formatting options needed for the conversion. |