LibreOffice: rtl::math Namespace Reference

LibreOffice LibreOffice 25.8 SDK C/C++ API Reference

Loading...
Searching...
No Matches
rtl::math Namespace Reference

## Functions
rtl::OString | doubleToString (double fValue, rtl_math_StringFormat eFormat, sal_Int32 nDecPlaces, char cDecSeparator, sal_Int32 const *pGroups, char cGroupSeparator, bool bEraseTrailingDecZeros=false)
| A wrapper around rtl_math_doubleToString.
rtl::OString | doubleToString (double fValue, rtl_math_StringFormat eFormat, sal_Int32 nDecPlaces, char cDecSeparator, bool bEraseTrailingDecZeros=false)
| A wrapper around rtl_math_doubleToString, with no grouping.
void | doubleToStringBuffer (rtl::OStringBuffer &rBuffer, double fValue, rtl_math_StringFormat eFormat, sal_Int32 nDecPlaces, char cDecSeparator, sal_Int32 const *pGroups, char cGroupSeparator, bool bEraseTrailingDecZeros=false)
| A wrapper around rtl_math_doubleToString that appends to an rtl::OStringBuffer.
void | doubleToStringBuffer (rtl::OStringBuffer &rBuffer, double fValue, rtl_math_StringFormat eFormat, sal_Int32 nDecPlaces, char cDecSeparator, bool bEraseTrailingDecZeros=false)
| A wrapper around rtl_math_doubleToString that appends to an rtl::OStringBuffer, with no grouping.
rtl::OUString | doubleToUString (double fValue, rtl_math_StringFormat eFormat, sal_Int32 nDecPlaces, sal_Unicode cDecSeparator, sal_Int32 const *pGroups, sal_Unicode cGroupSeparator, bool bEraseTrailingDecZeros=false)
| A wrapper around rtl_math_doubleToUString.
rtl::OUString | doubleToUString (double fValue, rtl_math_StringFormat eFormat, sal_Int32 nDecPlaces, sal_Unicode cDecSeparator, bool bEraseTrailingDecZeros=false)
| A wrapper around rtl_math_doubleToUString, with no grouping.
void | doubleToUStringBuffer (rtl::OUStringBuffer &rBuffer, double fValue, rtl_math_StringFormat eFormat, sal_Int32 nDecPlaces, sal_Unicode cDecSeparator, sal_Int32 const *pGroups, sal_Unicode cGroupSeparator, bool bEraseTrailingDecZeros=false)
| A wrapper around rtl_math_doubleToUString that appends to an rtl::OUStringBuffer.
void | doubleToUStringBuffer (rtl::OUStringBuffer &rBuffer, double fValue, rtl_math_StringFormat eFormat, sal_Int32 nDecPlaces, sal_Unicode cDecSeparator, bool bEraseTrailingDecZeros=false)
| A wrapper around rtl_math_doubleToUString that appends to an rtl::OUStringBuffer, with no grouping.
double | stringToDouble (rtl::OString const &rString, char cDecSeparator, char cGroupSeparator, rtl_math_ConversionStatus *pStatus=NULL, sal_Int32 *pParsedEnd=NULL)
| A wrapper around rtl_math_stringToDouble.
double | stringToDouble (rtl::OUString const &rString, sal_Unicode cDecSeparator, sal_Unicode cGroupSeparator, rtl_math_ConversionStatus *pStatus=NULL, sal_Int32 *pParsedEnd=NULL)
| A wrapper around rtl_math_uStringToDouble.
double | round (double fValue, int nDecPlaces=0, rtl_math_RoundingMode eMode=rtl_math_RoundingMode_Corrected)
| A wrapper around rtl_math_round.
double | pow10Exp (double fValue, int nExp)
| A wrapper around rtl_math_pow10Exp.
double | approxValue (double fValue)
| A wrapper around rtl_math_approxValue.
double | expm1 (double fValue)
| A wrapper around rtl_math_expm1.
double | log1p (double fValue)
| A wrapper around rtl_math_log1p.
double | atanh (double fValue)
| A wrapper around rtl_math_atanh.
double | erf (double fValue)
| A wrapper around rtl_math_erf.
double | erfc (double fValue)
| A wrapper around rtl_math_erfc.
double | asinh (double fValue)
| A wrapper around rtl_math_asinh.
double | acosh (double fValue)
| A wrapper around rtl_math_acosh.
bool | approxEqual (double a, double b)
| A wrapper around rtl_math_approxEqual.
bool | approxEqual (double a, double b, sal_Int16 nPrec)
| Test equality of two values with an accuracy defined by nPrec.
double | approxAdd (double a, double b)
| Add two values.
double | approxSub (double a, double b)
| Subtract two values (a-b).
double | approxFloor (double a)
| floor() method taking approxValue() into account.
double | approxCeil (double a)
| ceil() method taking approxValue() into account.
bool | isFinite (double d)
| Tests whether a value is neither INF nor NAN.
bool | isInf (double d)
| If a value represents +INF or -INF.
bool | isNan (double d)
| Test on any QNAN or SNAN.
bool | isSignBitSet (double d)
| If the sign bit is set.
void | setInf (double *pd, bool bNegative)
| Set to +INF if bNegative==false or -INF if bNegative==true.
void | setNan (double *pd)
| Set a QNAN.
bool | isValidArcArg (double d)
| If a value is a valid argument for sin(), cos(), tan().
double | sin (double d)
| Safe sin(), returns NAN if not valid.
double | cos (double d)
| Safe cos(), returns NAN if not valid.
double | tan (double d)
| Safe tan(), returns NAN if not valid.

## Function Documentation

## ◆ acosh()

double rtl::math::acosh | ( | double | fValue | ) |
| inline

A wrapper around rtl_math_acosh.

## ◆ approxAdd()

double rtl::math::approxAdd | ( | double | a,
|  | double | b )
| inline

Add two values.

If signs differ and the absolute values are equal according to approxEqual() the method returns 0.0 instead of calculating the sum.

If you wanted to sum up multiple values it would be convenient not to call approxAdd() for each value but instead remember the first value not equal to 0.0, add all other values using normal + operator, and with the result and the remembered value call approxAdd().

## ◆ approxCeil()

double rtl::math::approxCeil | ( | double | a | ) |
| inline

ceil() method taking approxValue() into account.

Use for expected integer values being calculated by double functions.

## ◆ approxEqual() [1/2]

bool rtl::math::approxEqual | ( | double | a,
|  | double | b )
| inline

A wrapper around rtl_math_approxEqual.

## ◆ approxEqual() [2/2]

bool rtl::math::approxEqual | ( | double | a,
|  | double | b,
|  | sal_Int16 | nPrec )
| inline

Test equality of two values with an accuracy defined by nPrec.

Attention
  approxEqual( value!=0.0, 0.0 ) never yields true.

## ◆ approxFloor()

double rtl::math::approxFloor | ( | double | a | ) |
| inline

floor() method taking approxValue() into account.

Use for expected integer values being calculated by double functions.

## ◆ approxSub()

double rtl::math::approxSub | ( | double | a,
|  | double | b )
| inline

Subtract two values (a-b).

If signs are identical and the values are equal according to approxEqual() the method returns 0.0 instead of calculating the subtraction.

## ◆ approxValue()

double rtl::math::approxValue | ( | double | fValue | ) |
| inline

A wrapper around rtl_math_approxValue.

## ◆ asinh()

double rtl::math::asinh | ( | double | fValue | ) |
| inline

A wrapper around rtl_math_asinh.

## ◆ atanh()

double rtl::math::atanh | ( | double | fValue | ) |
| inline

A wrapper around rtl_math_atanh.

## ◆ cos()

double rtl::math::cos | ( | double | d | ) |
| inline

Safe cos(), returns NAN if not valid.

## ◆ doubleToString() [1/2]

rtl::OString rtl::math::doubleToString | ( | double | fValue,
|  | rtl_math_StringFormat | eFormat,
|  | sal_Int32 | nDecPlaces,
|  | char | cDecSeparator,
|  | bool | bEraseTrailingDecZeros = false )
| inline

A wrapper around rtl_math_doubleToString, with no grouping.

## ◆ doubleToString() [2/2]

rtl::OString rtl::math::doubleToString | ( | double | fValue,
|  | rtl_math_StringFormat | eFormat,
|  | sal_Int32 | nDecPlaces,
|  | char | cDecSeparator,
|  | sal_Int32 const * | pGroups,
|  | char | cGroupSeparator,
|  | bool | bEraseTrailingDecZeros = false )
| inline

A wrapper around rtl_math_doubleToString.

## ◆ doubleToStringBuffer() [1/2]

void rtl::math::doubleToStringBuffer | ( | rtl::OStringBuffer & | rBuffer,
|  | double | fValue,
|  | rtl_math_StringFormat | eFormat,
|  | sal_Int32 | nDecPlaces,
|  | char | cDecSeparator,
|  | bool | bEraseTrailingDecZeros = false )
| inline

A wrapper around rtl_math_doubleToString that appends to an rtl::OStringBuffer, with no grouping.

Since
  LibreOffice 5.4

## ◆ doubleToStringBuffer() [2/2]

void rtl::math::doubleToStringBuffer | ( | rtl::OStringBuffer & | rBuffer,
|  | double | fValue,
|  | rtl_math_StringFormat | eFormat,
|  | sal_Int32 | nDecPlaces,
|  | char | cDecSeparator,
|  | sal_Int32 const * | pGroups,
|  | char | cGroupSeparator,
|  | bool | bEraseTrailingDecZeros = false )
| inline

A wrapper around rtl_math_doubleToString that appends to an rtl::OStringBuffer.

Since
  LibreOffice 5.4

## ◆ doubleToUString() [1/2]

rtl::OUString rtl::math::doubleToUString | ( | double | fValue,
|  | rtl_math_StringFormat | eFormat,
|  | sal_Int32 | nDecPlaces,
|  | sal_Unicode | cDecSeparator,
|  | bool | bEraseTrailingDecZeros = false )
| inline

A wrapper around rtl_math_doubleToUString, with no grouping.

## ◆ doubleToUString() [2/2]

rtl::OUString rtl::math::doubleToUString | ( | double | fValue,
|  | rtl_math_StringFormat | eFormat,
|  | sal_Int32 | nDecPlaces,
|  | sal_Unicode | cDecSeparator,
|  | sal_Int32 const * | pGroups,
|  | sal_Unicode | cGroupSeparator,
|  | bool | bEraseTrailingDecZeros = false )
| inline

A wrapper around rtl_math_doubleToUString.

## ◆ doubleToUStringBuffer() [1/2]

void rtl::math::doubleToUStringBuffer | ( | rtl::OUStringBuffer & | rBuffer,
|  | double | fValue,
|  | rtl_math_StringFormat | eFormat,
|  | sal_Int32 | nDecPlaces,
|  | sal_Unicode | cDecSeparator,
|  | bool | bEraseTrailingDecZeros = false )
| inline

A wrapper around rtl_math_doubleToUString that appends to an rtl::OUStringBuffer, with no grouping.

## ◆ doubleToUStringBuffer() [2/2]

void rtl::math::doubleToUStringBuffer | ( | rtl::OUStringBuffer & | rBuffer,
|  | double | fValue,
|  | rtl_math_StringFormat | eFormat,
|  | sal_Int32 | nDecPlaces,
|  | sal_Unicode | cDecSeparator,
|  | sal_Int32 const * | pGroups,
|  | sal_Unicode | cGroupSeparator,
|  | bool | bEraseTrailingDecZeros = false )
| inline

A wrapper around rtl_math_doubleToUString that appends to an rtl::OUStringBuffer.

## ◆ erf()

double rtl::math::erf | ( | double | fValue | ) |
| inline

A wrapper around rtl_math_erf.

## ◆ erfc()

double rtl::math::erfc | ( | double | fValue | ) |
| inline

A wrapper around rtl_math_erfc.

## ◆ expm1()

double rtl::math::expm1 | ( | double | fValue | ) |
| inline

A wrapper around rtl_math_expm1.

## ◆ isFinite()

bool rtl::math::isFinite | ( | double | d | ) |
| inline

Tests whether a value is neither INF nor NAN.

## ◆ isInf()

bool rtl::math::isInf | ( | double | d | ) |
| inline

If a value represents +INF or -INF.

The sign bit may be queried with isSignBitSet().

If isFinite(d)==false and isInf(d)==false then NAN.

## ◆ isNan()

bool rtl::math::isNan | ( | double | d | ) |
| inline

Test on any QNAN or SNAN.

## ◆ isSignBitSet()

bool rtl::math::isSignBitSet | ( | double | d | ) |
| inline

If the sign bit is set.

## ◆ isValidArcArg()

bool rtl::math::isValidArcArg | ( | double | d | ) |
| inline

If a value is a valid argument for sin(), cos(), tan().

IEEE 754 specifies that absolute values up to 2^64 (=1.844e19) for the radian must be supported by trigonometric functions. Unfortunately, at least on x86 architectures, the FPU doesn't generate an error pattern for values >2^64 but produces erroneous results instead and sets only the "invalid operation" (IM) flag in the status word :-( Thus the application has to handle it itself.

## ◆ log1p()

double rtl::math::log1p | ( | double | fValue | ) |
| inline

A wrapper around rtl_math_log1p.

## ◆ pow10Exp()

double rtl::math::pow10Exp | ( | double | fValue,
|  | int | nExp )
| inline

A wrapper around rtl_math_pow10Exp.

## ◆ round()

double rtl::math::round | ( | double | fValue,
|  | int | nDecPlaces = 0,
|  | rtl_math_RoundingMode | eMode = rtl_math_RoundingMode_Corrected )
| inline

A wrapper around rtl_math_round.

## ◆ setInf()

void rtl::math::setInf | ( | double * | pd,
|  | bool | bNegative )
| inline

Set to +INF if bNegative==false or -INF if bNegative==true.

## ◆ setNan()

void rtl::math::setNan | ( | double * | pd | ) |
| inline

Set a QNAN.

## ◆ sin()

double rtl::math::sin | ( | double | d | ) |
| inline

Safe sin(), returns NAN if not valid.

## ◆ stringToDouble() [1/2]

double rtl::math::stringToDouble | ( | rtl::OString const & | rString,
|  | char | cDecSeparator,
|  | char | cGroupSeparator,
|  | rtl_math_ConversionStatus * | pStatus = NULL,
|  | sal_Int32 * | pParsedEnd = NULL )
| inline

A wrapper around rtl_math_stringToDouble.

## ◆ stringToDouble() [2/2]

double rtl::math::stringToDouble | ( | rtl::OUString const & | rString,
|  | sal_Unicode | cDecSeparator,
|  | sal_Unicode | cGroupSeparator,
|  | rtl_math_ConversionStatus * | pStatus = NULL,
|  | sal_Int32 * | pParsedEnd = NULL )
| inline

A wrapper around rtl_math_uStringToDouble.

## ◆ tan()

double rtl::math::tan | ( | double | d | ) |
| inline

Safe tan(), returns NAN if not valid.