XBinder  Version 2.6.x
Functions
rtxBigFloat.h File Reference
#include "rtxsrc/rtxBigInt.h"

Go to the source code of this file.

Functions

EXTERNRT void rtxBigFloatInit (OSBigFloat *pFloat)
 This function initializes a big float structure. More...
 
EXTERNRT void rtxBigFloatFree (OSCTXT *pctxt, OSBigFloat *pFloat)
 This function frees internal memory within the big float structure. More...
 
EXTERNRT int rtxBigFloatSetStr (OSCTXT *pctxt, OSBigFloat *pFloat, const char *value)
 This function sets an OSBigFloat from a null-terminated decimal string. More...
 
EXTERNRT int rtxBigFloatSetStrn (OSCTXT *pctxt, OSBigFloat *pFloat, const char *value, OSSIZE len)
 This function sets an OSBigFloat from a character string using the given number of characters. More...
 
EXTERNRT OSSIZE rtxBigFloatStringSize (OSBigFloat *pFloat)
 Return an approximate size for the string returned by rtxBigFloatToString. More...
 
EXTERNRT OSBOOL rtxBigFloatToReal (const OSBigFloat *pFloat, OSREAL *pvalue)
 This function converts the given floating point number, which must be base 2, into an OSREAL, if this can be done exactly, without rounding. More...
 
EXTERNRT int rtxBigFloatToString (OSCTXT *pctxt, const OSBigFloat *pFloat, char *str, OSSIZE strSize)
 This function is used to convert a floating point number to a string. More...
 

Function Documentation

◆ rtxBigFloatFree()

EXTERNRT void rtxBigFloatFree ( OSCTXT pctxt,
OSBigFloat *  pFloat 
)

This function frees internal memory within the big float structure.

Parameters
pctxtPointer to a context structure.
pIntPointer to big float structure in which memory is to be freed.

◆ rtxBigFloatInit()

EXTERNRT void rtxBigFloatInit ( OSBigFloat *  pFloat)

This function initializes a big float structure.

It must be called prior to working with the structure.

Parameters
pIntPointer to big float data structure.

◆ rtxBigFloatSetStr()

EXTERNRT int rtxBigFloatSetStr ( OSCTXT pctxt,
OSBigFloat *  pFloat,
const char *  value 
)

This function sets an OSBigFloat from a null-terminated decimal string.

Parameters
pctxtPointer to a context structure.
pFloatPointer to big float structure to receive converted value. pFloat->base10 will be set TRUE.
valueNumeric string to convert. It must be in the following format: [-] integer [.fraction] [E|e [-] integer] There must be at least one integer digit before the optional fraction. Use of an exponent is optional. The exponent has an optional sign. Leading and trailing whitespace are acceptable and ignored; no other whitespace is allowed.
Returns
Status of the operation, 0 = success, negative code if error.

◆ rtxBigFloatSetStrn()

EXTERNRT int rtxBigFloatSetStrn ( OSCTXT pctxt,
OSBigFloat *  pFloat,
const char *  value,
OSSIZE  len 
)

This function sets an OSBigFloat from a character string using the given number of characters.

Parameters
pctxtPointer to a context structure.
pFloatPointer to big float structure to receive converted value. pFloat->base10 will be set TRUE.
valueNumeric string to convert. It must be in the following format: [-] integer [.fraction] [E|e [-] integer] There must be at least one integer digit before the optional fraction. Use of an exponent is optional. The exponent has an optional sign. Leading and trailing whitespace are acceptable and ignored; no other whitespace is allowed.
lenNumber of characters from character string to use.
Returns
Status of the operation, 0 = success, negative code if error.

◆ rtxBigFloatStringSize()

EXTERNRT OSSIZE rtxBigFloatStringSize ( OSBigFloat *  pFloat)

Return an approximate size for the string returned by rtxBigFloatToString.

The value returned will be at least as large as needed to hold the result of using rtxBigFloatToString to convert to a string.

◆ rtxBigFloatToReal()

EXTERNRT OSBOOL rtxBigFloatToReal ( const OSBigFloat *  pFloat,
OSREAL *  pvalue 
)

This function converts the given floating point number, which must be base 2, into an OSREAL, if this can be done exactly, without rounding.

Returns
FALSE if the conversion cannot be done exactly.

◆ rtxBigFloatToString()

EXTERNRT int rtxBigFloatToString ( OSCTXT pctxt,
const OSBigFloat *  pFloat,
char *  str,
OSSIZE  strSize 
)

This function is used to convert a floating point number to a string.

If pFloat->base10 is true, the format of the string will be: [-]ddd[E[-]ddd] That is, an integer mantissa, followed by an optional integer exponent, either of which may have a negative sign.

If pFloat->base10 is false, the result depends on whether the OSBigFloat can be converted exactly to a double (see rtxBigFloatToReal). If exact conversion can be done, the result is as for fprint using G. Otherwise, the result is inspired by fprint's A format: [-]0xHHHHHP{+/-]d,

Parameters
pctxtPointer to a context structure.
pFloatPointer to OSBigFloat structure to convert.
strCharacter string buffer to receive converted value.
strSizeSize, in bytes, of the character string buffer.
Returns
Status of the operation, 0 = success, negative code if error.