Functions | |
void | double2hp (double number, SatAddr dst) |
Convert a C double to an HP 64 bit real number. | |
void | double2hpereal (double number, SatAddr dst) |
Convert a C double to an HP 21 nibble extended real number. | |
int | ll2bcd (unsigned long long src, SatAddr dst, int numDigits) |
Convert a long long to Binary Coded Decimal (BCD), one digit per nibble, LSB stored first. | |
int | str2bcd (const char *src, SatAddr dst, int numDigits) |
Convert a null terminated string of digits to BCD, one digit per nibble, LSB stored first. | |
int | llDigits (unsigned long long src) |
Return the number of digits in a long long. | |
void | doubledecode (double number, int *ex, double *mantissa) |
Extract the base-10 exponent and mantissa from a double. Store the exponent in ex. 1 <= abs(mantissa) < 10. | |
void | doubledecodell (double number, long long *mantissa, long long *exponent) |
decode a C double into mantissa and exponent. | |
long long | llabs (long long src) |
Absolute value of a long long. | |
void | sat_memset (SatAddr dst, int val, int nibbles) |
Like memset(), but works in the saturn domain and sets a specified number of nibbles, not bytes. | |
int | lngrealNibbles (SatAddr src) |
implementation of LNGREALnibbles() but doesn't check prolog This function is also used LNGCOMPnibbles(). | |
bool | lngrealDigits (SatAddr src, int *mDigits, int *eDigits) |
implementation of LNGREALdigits() but doesn't check prolog This function is also used LNGCOMPdigits(). | |
char * | prolog2Name (SatAddr prolog) |
Given a prolog, return its name, or "unknown". | |
SatAddr | name2Prolog (const char *name) |
Return a prolog from a name. |
void double2hp | ( | double | number, | |
SatAddr | dst | |||
) |
Convert a C double to an HP 64 bit real number.
Note that this does NOT convert it to the 21 nibble DOREAL object, it just converts the binary formats. This is the inverse of sat_real2double(), except it always writes to the Saturn address space.
number | The double to convert | |
dst | Saturn address where the HP REAL body should be written |
void double2hpereal | ( | double | number, | |
SatAddr | dst | |||
) |
Convert a C double to an HP 21 nibble extended real number.
Note that this does NOT convert it to the 26 nibble DOEREL object, it just converts the binary formats. This is the inverse of ereal2double(), except it always writes to the Saturn address space.
number | The double to convert | |
dst | Saturn address where the HP EREL body should be written |
void doubledecodell | ( | double | number, | |
long long * | mantissa, | |||
long long * | exponent | |||
) |
decode a C double into mantissa and exponent.
number | The number to decode | |
mantissa | Pointer to a long long where the mantissa will be stored | |
exponent | Pointer to a long long where the exponent will be stored. Although this could have been an int or even a short, I'm using a long long so the programmer doesn't have to worry about which type is needed for which param. |
int ll2bcd | ( | unsigned long long | src, | |
SatAddr | dst, | |||
int | numDigits | |||
) |
Convert a long long to Binary Coded Decimal (BCD), one digit per nibble, LSB stored first.
src | The input number. | |
dst | Saturn address where the BCD should be written | |
numDigits | The number of digits/nibbles to write. -1 means as many as required. |
SatAddr name2Prolog | ( | const char * | name | ) |
Return a prolog from a name.
Given a prolog name like "DOBINT", return it's prolog or zero if unknown. The name is case insensitive and may optionally omit the "DO" prefix. I.E. "DOBINT", "dobint", "bint" and "BINT" will all return SAT_DOBINT
char* prolog2Name | ( | SatAddr | prolog | ) |
Given a prolog, return its name, or "unknown".
prolog | the Prolog value |
int str2bcd | ( | const char * | src, | |
SatAddr | dst, | |||
int | numDigits | |||
) |
Convert a null terminated string of digits to BCD, one digit per nibble, LSB stored first.
src | The input number. | |
dst | Where to store the BCD. | |
numDigits | The number of digits to write. -1 means as many as required). |