20 #ifndef INCLUDED_RTL_MATH_HXX
21 #define INCLUDED_RTL_MATH_HXX
41 sal_Int32
const * pGroups,
43 bool bEraseTrailingDecZeros =
false)
47 cDecSeparator, pGroups, cGroupSeparator,
48 bEraseTrailingDecZeros);
57 bool bEraseTrailingDecZeros =
false)
61 cDecSeparator, 0, 0, bEraseTrailingDecZeros);
71 sal_Int32
const * pGroups,
73 bool bEraseTrailingDecZeros =
false)
77 cDecSeparator, pGroups, cGroupSeparator,
78 bEraseTrailingDecZeros);
88 bool bEraseTrailingDecZeros =
false)
92 cDecSeparator, 0, 0, bEraseTrailingDecZeros);
101 sal_Int32 nDecPlaces,
103 sal_Int32
const * pGroups,
105 bool bEraseTrailingDecZeros =
false)
107 rtl_uString ** pData;
108 sal_Int32 * pCapacity;
111 eFormat, nDecPlaces, cDecSeparator, pGroups,
112 cGroupSeparator, bEraseTrailingDecZeros);
120 sal_Int32 nDecPlaces,
122 bool bEraseTrailingDecZeros =
false)
124 rtl_uString ** pData;
125 sal_Int32 * pCapacity;
128 eFormat, nDecPlaces, cDecSeparator, 0, 0,
129 bEraseTrailingDecZeros);
137 sal_Int32 * pParsedEnd = 0)
143 cDecSeparator, cGroupSeparator,
146 *pParsedEnd = (sal_Int32)(pEnd - pBegin);
156 sal_Int32 * pParsedEnd = 0)
162 cDecSeparator, cGroupSeparator,
165 *pParsedEnd = (sal_Int32)(pEnd - pBegin);
172 double fValue,
int nDecPlaces = 0,
215 inline double erf(
double fValue)
222 inline double erfc(
double fValue)
253 return (x < 0.0 ? -x : x)
254 < ((a < 0.0 ? -a : a) * (1.0 / (16777216.0 * 16777216.0)));
267 return (x < 0.0 ? -x : x)
268 < ((a < 0.0 ? -a : a) * (1.0 / (pow(static_cast<double>(2.0), nPrec))));
282 if ( ((a < 0.0 && b > 0.0) || (b < 0.0 && a > 0.0))
295 if ( ((a < 0.0 && b < 0.0) || (a > 0.0 && b > 0.0)) &&
approxEqual( a, b ) )
322 return SAL_MATH_FINITE(d);
334 return !SAL_MATH_FINITE(d) &&
335 (
reinterpret_cast< sal_math_Double *
>(&d)->inf_parts.fraction_hi == 0)
336 && (
reinterpret_cast< sal_math_Double *
>(&d)->inf_parts.fraction_lo
345 return !SAL_MATH_FINITE(d) && (
346 (
reinterpret_cast< sal_math_Double *
>(&d)->inf_parts.fraction_hi != 0)
347 || (
reinterpret_cast< sal_math_Double *
>(&d)->inf_parts.fraction_lo
355 return reinterpret_cast< sal_math_Double *
>(&d)->inf_parts.sign != 0;
360 inline void setInf(
double * pd,
bool bNegative)
367 md.w32_parts.msw = bNegative ? 0xFFF00000 : 0x7FF00000;
368 md.w32_parts.lsw = 0;
381 md.w32_parts.msw = 0x7FFFFFFF;
382 md.w32_parts.lsw = 0xFFFFFFFF;
398 <= (
static_cast< double >(
static_cast< unsigned long >(0x80000000))
399 *
static_cast< double >(
static_cast< unsigned long >(0x80000000))
405 inline double sin(
double d)
415 inline double cos(
double d)
425 inline double tan(
double d)
437 #endif // INCLUDED_RTL_MATH_HXX
double tan(double d)
Safe tan(), returns NAN if not valid.
Definition: math.hxx:425
void setNan(double *pd)
Set a QNAN.
Definition: math.hxx:374
double approxValue(double fValue)
A wrapper around rtl_math_approxValue.
Definition: math.hxx:187
SAL_DLLPUBLIC void rtl_math_doubleToUString(rtl_uString **pResult, sal_Int32 *pResultCapacity, sal_Int32 nResultOffset, double fValue, enum rtl_math_StringFormat eFormat, sal_Int32 nDecPlaces, sal_Unicode cDecSeparator, sal_Int32 const *pGroups, sal_Unicode cGroupSeparator, sal_Bool bEraseTrailingDecZeros) SAL_THROW_EXTERN_C()
Conversions analogous to sprintf() using internal rounding.
SAL_DLLPUBLIC double rtl_math_expm1(double fValue) SAL_THROW_EXTERN_C()
Returns more accurate e^x-1 for x near 0 than calculating directly.
bool isSignBitSet(double d)
If the sign bit is set.
Definition: math.hxx:353
const sal_Char * getStr() const SAL_THROW(())
Returns a pointer to the characters of this string.
Definition: string.hxx:353
SAL_DLLPUBLIC double rtl_math_erf(double fValue) SAL_THROW_EXTERN_C()
Returns values of the Errorfunction erf.
rtl::OString doubleToString(double fValue, rtl_math_StringFormat eFormat, sal_Int32 nDecPlaces, sal_Char cDecSeparator, sal_Int32 const *pGroups, sal_Char cGroupSeparator, bool bEraseTrailingDecZeros=false)
A wrapper around rtl_math_doubleToString.
Definition: math.hxx:38
Definition: bootstrap.hxx:24
bool isNan(double d)
Test on any QNAN or SNAN.
Definition: math.hxx:342
double expm1(double fValue)
A wrapper around rtl_math_expm1.
Definition: math.hxx:194
double acosh(double fValue)
A wrapper around rtl_math_acosh.
Definition: math.hxx:236
SAL_DLLPUBLIC double rtl_math_log1p(double fValue) SAL_THROW_EXTERN_C()
Returns more accurate log(1+x) for x near 0 than calculating directly.
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. ...
Definition: math.hxx:99
SAL_DLLPUBLIC double rtl_math_atanh(double fValue) SAL_THROW_EXTERN_C()
Returns more accurate atanh(x) for x near 0 than calculating 0.5*log((1+x)/(1-x)).
const sal_Unicode * getStr() const SAL_THROW(())
Returns a pointer to the Unicode character buffer for this string.
Definition: ustring.hxx:408
double erf(double fValue)
A wrapper around rtl_math_erf.
Definition: math.hxx:215
SAL_DLLPUBLIC double rtl_math_approxValue(double fValue) SAL_THROW_EXTERN_C()
Rounds value to 15 significant decimal digits.
bool approxEqual(double a, double b)
Test equality of two values with an accuracy of the magnitude of the given values scaled by 2^-48 (4 ...
Definition: math.hxx:248
SAL_DLLPUBLIC double rtl_math_pow10Exp(double fValue, int nExp) SAL_THROW_EXTERN_C()
Scales fVal to a power of 10 without calling pow() or div() for nExp values between -16 and +16...
bool isInf(double d)
If a value represents +INF or -INF.
Definition: math.hxx:331
char sal_Char
A legacy synonym for char.
Definition: types.h:128
double log1p(double fValue)
A wrapper around rtl_math_log1p.
Definition: math.hxx:201
double stringToDouble(rtl::OString const &rString, sal_Char cDecSeparator, sal_Char cGroupSeparator, rtl_math_ConversionStatus *pStatus=0, sal_Int32 *pParsedEnd=0)
A wrapper around rtl_math_stringToDouble.
Definition: math.hxx:134
sal_Int32 getLength() const SAL_THROW(())
Returns the length of this string.
Definition: string.hxx:327
double approxCeil(double a)
ceil() method taking approxValue() into account.
Definition: math.hxx:313
void setInf(double *pd, bool bNegative)
Set to +INF if bNegative==false or -INF if bNegative==true.
Definition: math.hxx:360
sal_Int32 getLength() const
Returns the length (character count) of this string buffer.
Definition: ustrbuf.hxx:247
double approxFloor(double a)
floor() method taking approxValue() into account.
Definition: math.hxx:304
double approxSub(double a, double b)
Subtract two values (a-b).
Definition: math.hxx:293
SAL_DLLPUBLIC double rtl_math_acosh(double fValue) SAL_THROW_EXTERN_C()
Returns values of the inverse hyperbolic cosine.
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:89
double atanh(double fValue)
A wrapper around rtl_math_atanh.
Definition: math.hxx:208
SAL_DLLPUBLIC double rtl_math_stringToDouble(sal_Char const *pBegin, sal_Char const *pEnd, sal_Char cDecSeparator, sal_Char cGroupSeparator, enum rtl_math_ConversionStatus *pStatus, sal_Char const **pParsedEnd) SAL_THROW_EXTERN_C()
Conversion analogous to strtod(), convert a string representing a decimal number into a double value...
double round(double fValue, int nDecPlaces=0, rtl_math_RoundingMode eMode=rtl_math_RoundingMode_Corrected)
A wrapper around rtl_math_round.
Definition: math.hxx:171
double pow10Exp(double fValue, int nExp)
A wrapper around rtl_math_pow10Exp.
Definition: math.hxx:180
SAL_DLLPUBLIC void rtl_math_doubleToString(rtl_String **pResult, sal_Int32 *pResultCapacity, sal_Int32 nResultOffset, double fValue, enum rtl_math_StringFormat eFormat, sal_Int32 nDecPlaces, sal_Char cDecSeparator, sal_Int32 const *pGroups, sal_Char cGroupSeparator, sal_Bool bEraseTrailingDecZeros) SAL_THROW_EXTERN_C()
Conversions analogous to sprintf() using internal rounding.
A string buffer implements a mutable sequence of characters.
Definition: ustrbuf.hxx:92
SAL_DLLPUBLIC double rtl_math_round(double fValue, int nDecPlaces, enum rtl_math_RoundingMode eMode) SAL_THROW_EXTERN_C()
Rounds a double value.
rtl_math_StringFormat
Formatting modes for rtl_math_doubleToString and rtl_math_doubleToUString and rtl_math_doubleToUStrin...
Definition: math.h:36
bool isFinite(double d)
Tests whether a value is neither INF nor NAN.
Definition: math.hxx:320
rtl_math_ConversionStatus
Status for rtl_math_stringToDouble and rtl_math_uStringToDouble.
Definition: math.h:63
double cos(double d)
Safe cos(), returns NAN if not valid.
Definition: math.hxx:415
SAL_DLLPUBLIC double rtl_math_uStringToDouble(sal_Unicode const *pBegin, sal_Unicode const *pEnd, sal_Unicode cDecSeparator, sal_Unicode cGroupSeparator, enum rtl_math_ConversionStatus *pStatus, sal_Unicode const **pParsedEnd) SAL_THROW_EXTERN_C()
Conversion analogous to strtod(), convert a string representing a decimal number into a double value...
double erfc(double fValue)
A wrapper around rtl_math_erfc.
Definition: math.hxx:222
SAL_DLLPUBLIC double rtl_math_erfc(double fValue) SAL_THROW_EXTERN_C()
Returns values of the complement Errorfunction erfc.
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.
Definition: math.hxx:67
sal_Int32 getLength() const SAL_THROW(())
Returns the length of this string.
Definition: ustring.hxx:386
double approxAdd(double a, double b)
Add two values.
Definition: math.hxx:280
rtl_math_RoundingMode
Rounding modes for rtl_math_round.
Definition: math.h:80
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:82
sal_uInt16 sal_Unicode
Definition: types.h:150
double asinh(double fValue)
A wrapper around rtl_math_asinh.
Definition: math.hxx:229
SAL_DLLPUBLIC double rtl_math_asinh(double fValue) SAL_THROW_EXTERN_C()
Returns values of the inverse hyperbolic sine.
double sin(double d)
Safe sin(), returns NAN if not valid.
Definition: math.hxx:405
Like HalfUp, but corrects roundoff errors, preferred.
Definition: math.h:84
bool isValidArcArg(double d)
If a value is a valid argument for sin(), cos(), tan().
Definition: math.hxx:395
void accessInternals(rtl_uString ***pInternalData, sal_Int32 **pInternalCapacity)
Allows access to the internal data of this OUStringBuffer, for effective manipulation.
Definition: ustrbuf.hxx:1097