24#ifndef INCLUDED_RTL_MATH_HXX 
   25#define INCLUDED_RTL_MATH_HXX 
   47                                   sal_Int32 
const * pGroups,
 
   49                                   bool bEraseTrailingDecZeros = 
false)
 
   53                            cDecSeparator, pGroups, cGroupSeparator,
 
   54                            bEraseTrailingDecZeros);
 
 
   63                                   bool bEraseTrailingDecZeros = 
false)
 
   67                            cDecSeparator, NULL, 0, bEraseTrailingDecZeros);
 
 
   78    sal_Int32 nDecPlaces, 
char cDecSeparator, sal_Int32 
const * pGroups,
 
   79    char cGroupSeparator, 
bool bEraseTrailingDecZeros = 
false)
 
   82    sal_Int32 * pCapacity;
 
   85        pData, pCapacity, rBuffer.
getLength(), fValue, eFormat, nDecPlaces,
 
   86        cDecSeparator, pGroups, cGroupSeparator, bEraseTrailingDecZeros);
 
 
   96    sal_Int32 nDecPlaces, 
char cDecSeparator,
 
   97    bool bEraseTrailingDecZeros = 
false)
 
  100    sal_Int32 * pCapacity;
 
  103        pData, pCapacity, rBuffer.
getLength(), fValue, eFormat, nDecPlaces,
 
  104        cDecSeparator, NULL, 0, bEraseTrailingDecZeros);
 
 
  111                                     sal_Int32 nDecPlaces,
 
  113                                     sal_Int32 
const * pGroups,
 
  115                                     bool bEraseTrailingDecZeros = 
false)
 
  119                             cDecSeparator, pGroups, cGroupSeparator,
 
  120                             bEraseTrailingDecZeros);
 
 
  128                                     sal_Int32 nDecPlaces,
 
  130                                     bool bEraseTrailingDecZeros = 
false)
 
  134                             cDecSeparator, NULL, 0, bEraseTrailingDecZeros);
 
 
  143                                   sal_Int32 nDecPlaces,
 
  145                                   sal_Int32 
const * pGroups,
 
  147                                   bool bEraseTrailingDecZeros = 
false)
 
  149    rtl_uString ** pData;
 
  150    sal_Int32 * pCapacity;
 
  153                              eFormat, nDecPlaces, cDecSeparator, pGroups,
 
  154                              cGroupSeparator, bEraseTrailingDecZeros);
 
 
  162                                   sal_Int32 nDecPlaces,
 
  164                                   bool bEraseTrailingDecZeros = 
false)
 
  166    rtl_uString ** pData;
 
  167    sal_Int32 * pCapacity;
 
  170                              eFormat, nDecPlaces, cDecSeparator, NULL, 0,
 
  171                              bEraseTrailingDecZeros);
 
 
  176#ifdef LIBO_INTERNAL_ONLY 
  178                             char cDecSeparator, 
char cGroupSeparator,
 
  180                             sal_Int32 * pParsedEnd = NULL)
 
  182    char const * pBegin = aString.data();
 
  185                                             pBegin + aString.size(),
 
  186                                             cDecSeparator, cGroupSeparator,
 
  188    if (pParsedEnd != NULL)
 
  189        *pParsedEnd = 
static_cast<sal_Int32
>(pEnd - pBegin);
 
  194                             char cDecSeparator, 
char cGroupSeparator,
 
  196                             sal_Int32 * pParsedEnd = NULL)
 
  198    char const * pBegin = rString.
getStr();
 
  202                                             cDecSeparator, cGroupSeparator,
 
  204    if (pParsedEnd != NULL)
 
  205        *pParsedEnd = 
static_cast<sal_Int32
>(pEnd - pBegin);
 
 
  213#ifdef LIBO_INTERNAL_ONLY 
  218                             sal_Int32 * pParsedEnd = NULL)
 
  223                                              pBegin + aString.size(),
 
  224                                              cDecSeparator, cGroupSeparator,
 
  226    if (pParsedEnd != NULL)
 
  227        *pParsedEnd = 
static_cast<sal_Int32
>(pEnd - pBegin);
 
  235                             sal_Int32 * pParsedEnd = NULL)
 
  241                                              cDecSeparator, cGroupSeparator,
 
  243    if (pParsedEnd != NULL)
 
  244        *pParsedEnd = 
static_cast<sal_Int32
>(pEnd - pBegin);
 
 
  252    double fValue, 
int nDecPlaces = 0,
 
 
  295inline double erf(
double fValue)
 
 
  302inline double erfc(
double fValue)
 
 
  338    return (x < 0.0 ? -x : x)
 
  339        < ((a < 0.0 ? -a : a) * (1.0 / (pow(2.0, nPrec))));
 
 
  354    if ( ((a < 0.0 && b > 0.0) || (b < 0.0 && a > 0.0))
 
 
  367    if ( ((a < 0.0 && b < 0.0) || (a > 0.0 && b > 0.0)) && 
approxEqual( a, b ) )
 
 
  394    return SAL_MATH_FINITE(d);
 
 
  406    return !SAL_MATH_FINITE(d) &&
 
  407        (
reinterpret_cast< sal_math_Double * 
>(&d)->inf_parts.fraction_hi == 0)
 
  408        && (
reinterpret_cast< sal_math_Double * 
>(&d)->inf_parts.fraction_lo
 
 
  417    return !SAL_MATH_FINITE(d) && (
 
  418        (
reinterpret_cast< sal_math_Double * 
>(&d)->inf_parts.fraction_hi != 0)
 
  419        || (
reinterpret_cast< sal_math_Double * 
>(&d)->inf_parts.fraction_lo
 
 
  427    return reinterpret_cast< sal_math_Double * 
>(&d)->inf_parts.sign != 0;
 
 
  432inline void setInf(
double * pd, 
bool bNegative)
 
  434    sal_math_Double& md = *
reinterpret_cast<sal_math_Double*
>(pd);
 
  435    md.w32_parts.msw = bNegative ? 0xFFF00000 : 0x7FF00000;
 
  436    md.w32_parts.lsw = 0;
 
 
  443    sal_math_Double& md = *
reinterpret_cast<sal_math_Double*
>(pd);
 
  444    md.w32_parts.msw = 0x7FFFFFFF;
 
  445    md.w32_parts.lsw = 0xFFFFFFFF;
 
 
  460        <= (
static_cast< double >(
static_cast< unsigned long >(0x80000000))
 
  461            * 
static_cast< double >(
static_cast< unsigned long >(0x80000000))
 
 
  467inline double sin(
double d)
 
 
  477inline double cos(
double d)
 
 
  487inline double tan(
double d)
 
 
 
sal_uInt16 sal_Unicode
Definition types.h:123
SAL_DLLPUBLIC double rtl_math_erf(double fValue) SAL_THROW_EXTERN_C()
Returns values of the Errorfunction erf.
rtl_math_RoundingMode
Rounding modes for rtl_math_round.
Definition math.h:105
@ rtl_math_RoundingMode_Corrected
Like HalfUp, but corrects roundoff errors, preferred.
Definition math.h:108
rtl_math_ConversionStatus
Status for rtl_math_stringToDouble and rtl_math_uStringToDouble.
Definition math.h:88
SAL_DLLPUBLIC double rtl_math_round(double fValue, int nDecPlaces, enum rtl_math_RoundingMode eMode) SAL_THROW_EXTERN_C()
Rounds a double value.
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.
rtl_math_StringFormat
Formatting modes for rtl_math_doubleToString and rtl_math_doubleToUString and rtl_math_doubleToUStrin...
Definition math.h:41
SAL_DLLPUBLIC double rtl_math_asinh(double fValue) SAL_THROW_EXTERN_C()
Returns values of the inverse hyperbolic sine.
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, char cDecSeparator, sal_Int32 const *pGroups, char cGroupSeparator, sal_Bool bEraseTrailingDecZeros) SAL_THROW_EXTERN_C()
Conversions analogous to sprintf() using internal rounding.
SAL_DLLPUBLIC double rtl_math_erfc(double fValue) SAL_THROW_EXTERN_C()
Returns values of the complement Errorfunction erfc.
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)).
SAL_DLLPUBLIC double rtl_math_approxValue(double fValue) SAL_THROW_EXTERN_C()
Rounds value to 15 significant decimal digits.
SAL_DLLPUBLIC bool rtl_math_approxEqual(double a, double b) SAL_THROW_EXTERN_C()
Test equality of two values with an accuracy of the magnitude of the given values scaled by 2^-48 (4 ...
SAL_DLLPUBLIC double rtl_math_stringToDouble(char const *pBegin, char const *pEnd, char cDecSeparator, char cGroupSeparator, enum rtl_math_ConversionStatus *pStatus, char const **pParsedEnd) SAL_THROW_EXTERN_C()
Conversion analogous to strtod(), convert a string representing a decimal number into a double value.
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,...
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.
SAL_DLLPUBLIC double rtl_math_acosh(double fValue) SAL_THROW_EXTERN_C()
Returns values of the inverse hyperbolic cosine.
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.
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.
Definition bootstrap.hxx:34
bool approxEqual(double a, double b)
A wrapper around rtl_math_approxEqual.
Definition math.hxx:323
double approxAdd(double a, double b)
Add two values.
Definition math.hxx:352
bool isNan(double d)
Test on any QNAN or SNAN.
Definition math.hxx:414
double sin(double d)
Safe sin(), returns NAN if not valid.
Definition math.hxx:467
double log1p(double fValue)
A wrapper around rtl_math_log1p.
Definition math.hxx:281
double erf(double fValue)
A wrapper around rtl_math_erf.
Definition math.hxx:295
double approxSub(double a, double b)
Subtract two values (a-b).
Definition math.hxx:365
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.
Definition math.hxx:193
double approxFloor(double a)
floor() method taking approxValue() into account.
Definition math.hxx:376
double asinh(double fValue)
A wrapper around rtl_math_asinh.
Definition math.hxx:309
bool isValidArcArg(double d)
If a value is a valid argument for sin(), cos(), tan().
Definition math.hxx:457
void setNan(double *pd)
Set a QNAN.
Definition math.hxx:441
double expm1(double fValue)
A wrapper around rtl_math_expm1.
Definition math.hxx:274
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.
Definition math.hxx:44
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:141
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:109
double round(double fValue, int nDecPlaces=0, rtl_math_RoundingMode eMode=rtl_math_RoundingMode_Corrected)
A wrapper around rtl_math_round.
Definition math.hxx:251
bool isInf(double d)
If a value represents +INF or -INF.
Definition math.hxx:403
double erfc(double fValue)
A wrapper around rtl_math_erfc.
Definition math.hxx:302
double approxValue(double fValue)
A wrapper around rtl_math_approxValue.
Definition math.hxx:267
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.
Definition math.hxx:76
double atanh(double fValue)
A wrapper around rtl_math_atanh.
Definition math.hxx:288
bool isSignBitSet(double d)
If the sign bit is set.
Definition math.hxx:425
void setInf(double *pd, bool bNegative)
Set to +INF if bNegative==false or -INF if bNegative==true.
Definition math.hxx:432
double tan(double d)
Safe tan(), returns NAN if not valid.
Definition math.hxx:487
double acosh(double fValue)
A wrapper around rtl_math_acosh.
Definition math.hxx:316
double pow10Exp(double fValue, int nExp)
A wrapper around rtl_math_pow10Exp.
Definition math.hxx:260
bool isFinite(double d)
Tests whether a value is neither INF nor NAN.
Definition math.hxx:392
double approxCeil(double a)
ceil() method taking approxValue() into account.
Definition math.hxx:385
double cos(double d)
Safe cos(), returns NAN if not valid.
Definition math.hxx:477
A string buffer implements a mutable sequence of characters.
Definition strbuf.hxx:72
void accessInternals(rtl_String ***pInternalData, sal_Int32 **pInternalCapacity)
Allows access to the internal data of this OStringBuffer, for effective manipulation.
Definition strbuf.hxx:1067
sal_Int32 getLength() const
Returns the length (character count) of this string buffer.
Definition strbuf.hxx:377
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition string.hxx:193
const char * getStr() const SAL_RETURNS_NONNULL
Returns a pointer to the characters of this string.
Definition string.hxx:690
sal_Int32 getLength() const
Returns the length of this string.
Definition string.hxx:664
A string buffer implements a mutable sequence of characters.
Definition ustrbuf.hxx:73
sal_Int32 getLength() const
Returns the length (character count) of this string buffer.
Definition ustrbuf.hxx:398
void accessInternals(rtl_uString ***pInternalData, sal_Int32 **pInternalCapacity)
Allows access to the internal data of this OUStringBuffer, for effective manipulation.
Definition ustrbuf.hxx:1344
This String class provides base functionality for C++ like Unicode character array handling.
Definition ustring.hxx:172
const sal_Unicode * getStr() const SAL_RETURNS_NONNULL
Returns a pointer to the Unicode character buffer for this string.
Definition ustring.hxx:843
sal_Int32 getLength() const
Returns the length of this string.
Definition ustring.hxx:821