Language

The Free and Open Productivity Suite
Released: Apache OpenOffice 4.1.15

API

SDK

Tips ‘n’ Tricks

Miscellaneous


Global Functions in Global Namespace C++
in Sourcefile math.h


rtl_math_acosh
extern "C"
double rtl_math_acosh(
double fValue );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Returns values of the inverse hyperbolic cosine.
Description
acosh is part of the C99 standard, but not provided by some compilers.
Parameters
fValue
    The value x in the term acosh(x).
  

rtl_math_approxValue
extern "C"
double rtl_math_approxValue(
double fValue );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Rounds value to 15 significant decimal digits.
Parameters
fValue
    The value to be rounded.
  

rtl_math_asinh
extern "C"
double rtl_math_asinh(
double fValue );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Returns values of the inverse hyperbolic sine.
Description
asinh is part of the C99 standard, but not provided by some compilers.
Parameters
fValue
    The value x in the term asinh(x).
  

rtl_math_atanh
extern "C"
double rtl_math_atanh(
double fValue );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Returns more accurate atanh(x) for x near 0 than calculating 0.5*log((1+x)/(1-x)).
Description
atanh is part of the C99 standard, but not provided by some compilers.
Parameters
fValue
The value x in the term atanh(x).

rtl_math_doubleToString
extern "C"
void rtl_math_doubleToString(
rtl_String * * pResult,
sal_Int32 * pResultCapacity,
sal_Int32 nResultOffset,
double fValue,
rtl_math_StringFormat eFormat,
sal_Int32 nDecPlaces,
sal_Char cDecSeparator,
const sal_Int32 * pGroups,
sal_Char cGroupSeparator,
sal_Bool bEraseTrailingDecZeros );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Conversions analogous to sprintf() using internal rounding.
Description
+/-HUGE_VAL are converted to "INF" and "-INF", NAN values are converted to "NaN".
Parameters
pResult
    Returns the resulting byte string.  Must itself not be null, and must point
    to either null or a valid string.

    
pResultCapacity
    If null, pResult is considered to point to immutable strings, and a new
    string will be allocated in pResult.
    If non-null, it points to the current capacity of pResult, which is
    considered to point to a string buffer (pResult must not itself be null in
    this case, and must point to a string that has room for the given capacity).
    The string representation of the given double value is inserted into pResult
    at position nResultOffset.  If pResult's current capacity is too small, a
    new string buffer will be allocated in pResult as necessary, and
    pResultCapacity will contain the new capacity on return.

    
nResultOffset
    If pResult is used as a string buffer (i.e., pResultCapacity is non-null),
    nResultOffset specifies the insertion offset within the buffer.  Ignored
    otherwise.

    
fValue
    The value to convert.

    
eFormat
    The format to use, one of rtl_math_StringFormat.

    
nDecPlaces
    The number of decimals to be generated.  Effectively fValue is rounded at
    this position, specifying nDecPlaces <= 0 accordingly rounds the value
    before the decimal point and fills with zeros.
    If eFormat == rtl_math_StringFormat_Automatic and nDecPlaces ==
    rtl_math_DecimalPlaces_Max, the highest number of significant decimals
    possible is generated.
    If eFormat == rtl_math_StringFormat_G, nDecPlaces specifies the number of
    significant digits instead.  If nDecPlaces ==
    rtl_math_DecimalPlaces_DefaultSignificance, the default number (currently 6
    as implemented by most libraries) of significant digits is generated.
    According to the ANSI C90 standard the E style will be used only if the
    exponent resulting from the conversion is less than -4 or greater than or
    equal to the precision.  However, as opposed to the ANSI standard, trailing
    zeros are not necessarily removed from the fractional portion of the result
    unless bEraseTrailingDecZeros == true was specified.

    
cDecSeparator
    The decimal separator.

    
pGroups
    Either null (no grouping is used), or a null-terminated list of group
    lengths.  Each group length must be strictly positive.  If the number of
    digits in a conversion exceeds the specified range, the last (highest) group
    length is repeated as needed.  Values are applied from right to left, for a
    grouping of 1,00,00,000 you'd have to specify pGroups={3,2,0}.

    
cGroupSeparator
    The group separator.  Ignored if pGroups is null.

    
bEraseTrailingDecZeros
    Trailing zeros in decimal places are erased.
 

rtl_math_doubleToUString
extern "C"
void rtl_math_doubleToUString(
rtl_uString * * pResult,
sal_Int32 * pResultCapacity,
sal_Int32 nResultOffset,
double fValue,
rtl_math_StringFormat eFormat,
sal_Int32 nDecPlaces,
sal_Unicode cDecSeparator,
const sal_Int32 * pGroups,
sal_Unicode cGroupSeparator,
sal_Bool bEraseTrailingDecZeros );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Conversions analogous to sprintf() using internal rounding.
Description
+/-HUGE_VAL are converted to "INF" and "-INF", NAN values are converted to "NaN".
Parameters
pResult
    Returns the resulting Unicode string.  Must itself not be null, and must
    point to either null or a valid string.

    
pResultCapacity
    If null, pResult is considered to point to immutable strings, and a new
    string will be allocated in pResult.
    If non-null, it points to the current capacity of pResult, which is
    considered to point to a string buffer (pResult must not itself be null in
    this case, and must point to a string that has room for the given capacity).
    The string representation of the given double value is inserted into pResult
    at position nResultOffset.  If pResult's current capacity is too small, a
    new string buffer will be allocated in pResult as necessary, and
    pResultCapacity will contain the new capacity on return.

    
nResultOffset
    If pResult is used as a string buffer (i.e., pResultCapacity is non-null),
    nResultOffset specifies the insertion offset within the buffer.  Ignored
    otherwise.

    
fValue
    The value to convert.

    
eFormat
    The format to use, one of rtl_math_StringFormat.

    
nDecPlaces
    The number of decimals to be generated.  Effectively fValue is rounded at
    this position, specifying nDecPlaces <= 0 accordingly rounds the value
    before the decimal point and fills with zeros.
    If eFormat == rtl_math_StringFormat_Automatic and nDecPlaces ==
    rtl_math_DecimalPlaces_Max, the highest number of significant decimals
    possible is generated.
    If eFormat == rtl_math_StringFormat_G, nDecPlaces specifies the number of
    significant digits instead.  If nDecPlaces ==
    rtl_math_DecimalPlaces_DefaultSignificance, the default number (currently 6
    as implemented by most libraries) of significant digits is generated.
    According to the ANSI C90 standard the E style will be used only if the
    exponent resulting from the conversion is less than -4 or greater than or
    equal to the precision.  However, as opposed to the ANSI standard, trailing
    zeros are not necessarily removed from the fractional portion of the result
    unless bEraseTrailingDecZeros == true was specified.

    
cDecSeparator
    The decimal separator.

    
pGroups
    Either null (no grouping is used), or a null-terminated list of group
    lengths.  Each group length must be strictly positive.  If the number of
    digits in a conversion exceeds the specified range, the last (highest) group
    length is repeated as needed.  Values are applied from right to left, for a
    grouping of 1,00,00,000 you'd have to specify pGroups={3,2,0}.

    
cGroupSeparator
    The group separator.  Ignored if pGroups is null.

    
bEraseTrailingDecZeros
    Trailing zeros in decimal places are erased.
 

rtl_math_erf
extern "C"
double rtl_math_erf(
double fValue );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Returns values of the Errorfunction erf.
Description
erf is part of the C99 standard, but not provided by some compilers.
Parameters
fValue
    The value x in the term erf(x).
  

rtl_math_erfc
extern "C"
double rtl_math_erfc(
double fValue );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Returns values of the complement Errorfunction erfc.
Description
erfc is part of the C99 standard, but not provided by some compilers.
Parameters
fValue
    The value x in the term erfc(x).
  

rtl_math_expm1
extern "C"
double rtl_math_expm1(
double fValue );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Returns more accurate e^x-1 for x near 0 than calculating directly.
Description
expm1 is part of the C99 standard, but not provided by some compilers.
Parameters
fValue
    The value x in the term e^x-1.
  

rtl_math_log1p
extern "C"
double rtl_math_log1p(
double fValue );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Returns more accurate log(1+x) for x near 0 than calculating directly.
Description
log1p is part of the C99 standard, but not provided by some compilers.
Parameters
fValue
    The value x in the term log(1+x).
  

rtl_math_pow10Exp
extern "C"
double rtl_math_pow10Exp(
double fValue,
int nExp );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Scales fVal to a power of 10 without calling pow() or div() for nExp values between -16 and +16, providing a faster method.
Parameters
fValue
The value to be raised.

nExp
The exponent.

Return
fVal * pow(10.0, nExp)

rtl_math_round
extern "C"
double rtl_math_round(
double fValue,
int nDecPlaces,
rtl_math_RoundingMode eMode );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Rounds a double value.
Parameters
fValue
    Specifies the value to be rounded.

    
nDecPlaces
    Specifies the decimal place where rounding occurs.  Must be in the range
    -20 to +20, inclusive.  Negative if rounding occurs before the decimal
    point.

    
eMode
    Specifies the rounding mode.
 

rtl_math_stringToDouble
extern "C"
double rtl_math_stringToDouble(
const sal_Char * pBegin,
const sal_Char * pEnd,
sal_Char cDecSeparator,
sal_Char cGroupSeparator,
rtl_math_ConversionStatus * pStatus,
const sal_Char * * pParsedEnd );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Conversion analogous to strtod(), convert a string representing a decimal number into a double value.
Description
Leading tabs (0x09) and spaces (0x20) are eaten. Overflow returns +/-HUGE_VAL, underflow 0. In both cases pStatus is set to rtl_math_ConversionStatus_OutOfRange, otherwise to rtl_math_ConversionStatus_Ok. "INF", "-INF" and "+/-1.#INF" are recognized as +/-HUGE_VAL, pStatus is set to rtl_math_ConversionStatus_OutOfRange. "NaN" and "+/-1.#NAN" are recognized and the value is set to +/-NAN, pStatus is set to rtl_math_ConversionStatus_Ok.
Parameters
pBegin
Points to the start of the byte string to convert.  Must not be null.

pEnd
Points one past the end of the byte string to convert.  The condition
pEnd >= pBegin must hold.

cDecSeparator
The decimal separator.

cGroupSeparator
The group (aka thousands) separator.

pStatus
If non-null, returns the status of the conversion.

pParsedEnd
If non-null, returns one past the position of the last character parsed
away.  Thus if [pBegin..pEnd) only contains the numerical string to be
parsed, *pParsedEnd == pEnd on return.  If no numerical (sub-)string is
found, *pParsedEnd == pBegin on return, even if there was leading
whitespace.

rtl_math_uStringToDouble
extern "C"
double rtl_math_uStringToDouble(
const sal_Unicode * pBegin,
const sal_Unicode * pEnd,
sal_Unicode cDecSeparator,
sal_Unicode cGroupSeparator,
rtl_math_ConversionStatus * pStatus,
const sal_Unicode * * pParsedEnd );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Conversion analogous to strtod(), convert a string representing a decimal number into a double value.
Description
Leading tabs (U+0009) and spaces (U+0020) are eaten. Overflow returns +/-HUGE_VAL, underflow 0. In both cases pStatus is set to rtl_math_ConversionStatus_OutOfRange, otherwise to rtl_math_ConversionStatus_Ok. "INF", "-INF" and "+/-1.#INF" are recognized as +/-HUGE_VAL, pStatus is set to rtl_math_ConversionStatus_OutOfRange. "NaN" and "+/-1.#NAN" are recognized and the value is set to +/-NAN, pStatus is set to rtl_math_ConversionStatus_Ok.
Parameters
pBegin
Points to the start of the Unicode string to convert.  Must not be null.

pEnd
Points one past the end of the Unicode string to convert.  The condition
pEnd >= pBegin must hold.

cDecSeparator
The decimal separator.

cGroupSeparator
The group (aka thousands) separator.

pStatus
If non-null, returns the status of the conversion.

pParsedEnd
If non-null, returns one past the position of the last character parsed
away.  Thus if [pBegin..pEnd) only contains the numerical string to be
parsed, *pParsedEnd == pEnd on return.  If no numerical (sub-)string is
found, *pParsedEnd == pBegin on return, even if there was leading
whitespace.

Top of Page

Apache Software Foundation

Copyright & License | Privacy | Contact Us | Donate | Thanks

Apache, OpenOffice, OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. The Apache feather logo is a trademark of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.