Ruby  2.5.0dev(2017-10-22revision60238)
Data Structures | Macros | Functions | Variables
bigdecimal.h File Reference
#include "ruby/ruby.h"
#include <float.h>

Go to the source code of this file.

Data Structures

struct  Real
 

Macros

#define RUBY_NO_OLD_COMPATIBILITY
 
#define BDIGIT   uint16_t
 
#define BDIGIT_DBL   uint32_t
 
#define BDIGIT_DBL_SIGNED   int32_t
 
#define SIZEOF_BDIGITS   2
 
#define PRI_BDIGIT_PREFIX   "h"
 
#define PRI_BDIGIT_DBL_PREFIX   ""
 
#define PRIdBDIGIT   PRI_BDIGIT_PREFIX"d"
 
#define PRIiBDIGIT   PRI_BDIGIT_PREFIX"i"
 
#define PRIoBDIGIT   PRI_BDIGIT_PREFIX"o"
 
#define PRIuBDIGIT   PRI_BDIGIT_PREFIX"u"
 
#define PRIxBDIGIT   PRI_BDIGIT_PREFIX"x"
 
#define PRIXBDIGIT   PRI_BDIGIT_PREFIX"X"
 
#define PRIdBDIGIT_DBL   PRI_BDIGIT_DBL_PREFIX"d"
 
#define PRIiBDIGIT_DBL   PRI_BDIGIT_DBL_PREFIX"i"
 
#define PRIoBDIGIT_DBL   PRI_BDIGIT_DBL_PREFIX"o"
 
#define PRIuBDIGIT_DBL   PRI_BDIGIT_DBL_PREFIX"u"
 
#define PRIxBDIGIT_DBL   PRI_BDIGIT_DBL_PREFIX"x"
 
#define PRIXBDIGIT_DBL   PRI_BDIGIT_DBL_PREFIX"X"
 
#define vabs   abs
 
#define RMPD_COMPONENT_FIGURES   4
 
#define RMPD_BASE   ((BDIGIT)10000U)
 
#define SZ_NaN   "NaN"
 
#define SZ_INF   "Infinity"
 
#define SZ_PINF   "+Infinity"
 
#define SZ_NINF   "-Infinity"
 
#define VP_EXPORT   static
 
#define VP_EXCEPTION_ALL   ((unsigned short)0x00FF)
 
#define VP_EXCEPTION_INFINITY   ((unsigned short)0x0001)
 
#define VP_EXCEPTION_NaN   ((unsigned short)0x0002)
 
#define VP_EXCEPTION_UNDERFLOW   ((unsigned short)0x0004)
 
#define VP_EXCEPTION_OVERFLOW   ((unsigned short)0x0001) /* 0x0008) */
 
#define VP_EXCEPTION_ZERODIVIDE   ((unsigned short)0x0010)
 
#define VP_EXCEPTION_OP   ((unsigned short)0x0020)
 
#define VP_EXCEPTION_MEMORY   ((unsigned short)0x0040)
 
#define RMPD_EXCEPTION_MODE_DEFAULT   0U
 
#define VP_ROUND_MODE   ((unsigned short)0x0100)
 
#define VP_ROUND_UP   1
 
#define VP_ROUND_DOWN   2
 
#define VP_ROUND_HALF_UP   3
 
#define VP_ROUND_HALF_DOWN   4
 
#define VP_ROUND_CEIL   5
 
#define VP_ROUND_FLOOR   6
 
#define VP_ROUND_HALF_EVEN   7
 
#define RMPD_ROUNDING_MODE_DEFAULT   VP_ROUND_HALF_UP
 
#define VP_SIGN_NaN   0 /* NaN */
 
#define VP_SIGN_POSITIVE_ZERO   1 /* Positive zero */
 
#define VP_SIGN_NEGATIVE_ZERO   -1 /* Negative zero */
 
#define VP_SIGN_POSITIVE_FINITE   2 /* Positive finite number */
 
#define VP_SIGN_NEGATIVE_FINITE   -2 /* Negative finite number */
 
#define VP_SIGN_POSITIVE_INFINITE   3 /* Positive infinite number */
 
#define VP_SIGN_NEGATIVE_INFINITE   -3 /* Negative infinite number */
 
#define FLEXIBLE_ARRAY_SIZE   1
 
#define VpBaseFig()   rmpd_component_figures()
 
#define VpDblFig()   rmpd_double_figures()
 
#define VpBaseVal()   rmpd_base_value()
 
#define Abs(a)   (((a)>= 0)?(a):(-(a)))
 
#define Max(a, b)   (((a)>(b))?(a):(b))
 
#define Min(a, b)   (((a)>(b))?(b):(a))
 
#define VpMaxPrec(a)   ((a)->MaxPrec)
 
#define VpPrec(a)   ((a)->Prec)
 
#define VpGetFlag(a)   ((a)->flag)
 
#define VpGetSign(a)   (((a)->sign>0)?1:(-1))
 
#define VpChangeSign(a, s)   {if((s)>0) (a)->sign=(short)Abs((ssize_t)(a)->sign);else (a)->sign=-(short)Abs((ssize_t)(a)->sign);}
 
#define VpSetSign(a, s)   {if((s)>0) (a)->sign=(short)VP_SIGN_POSITIVE_FINITE;else (a)->sign=(short)VP_SIGN_NEGATIVE_FINITE;}
 
#define VpSetOne(a)   {(a)->Prec=(a)->exponent=(a)->frac[0]=1;(a)->sign=VP_SIGN_POSITIVE_FINITE;}
 
#define VpIsPosZero(a)   ((a)->sign==VP_SIGN_POSITIVE_ZERO)
 
#define VpIsNegZero(a)   ((a)->sign==VP_SIGN_NEGATIVE_ZERO)
 
#define VpIsZero(a)   (VpIsPosZero(a) || VpIsNegZero(a))
 
#define VpSetPosZero(a)   ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_POSITIVE_ZERO)
 
#define VpSetNegZero(a)   ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_NEGATIVE_ZERO)
 
#define VpSetZero(a, s)   (void)(((s)>0)?VpSetPosZero(a):VpSetNegZero(a))
 
#define VpIsNaN(a)   ((a)->sign==VP_SIGN_NaN)
 
#define VpSetNaN(a)   ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_NaN)
 
#define VpIsPosInf(a)   ((a)->sign==VP_SIGN_POSITIVE_INFINITE)
 
#define VpIsNegInf(a)   ((a)->sign==VP_SIGN_NEGATIVE_INFINITE)
 
#define VpIsInf(a)   (VpIsPosInf(a) || VpIsNegInf(a))
 
#define VpIsDef(a)   ( !(VpIsNaN(a)||VpIsInf(a)) )
 
#define VpSetPosInf(a)   ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_POSITIVE_INFINITE)
 
#define VpSetNegInf(a)   ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_NEGATIVE_INFINITE)
 
#define VpSetInf(a, s)   (void)(((s)>0)?VpSetPosInf(a):VpSetNegInf(a))
 
#define VpHasVal(a)   (a->frac[0])
 
#define VpIsOne(a)   ((a->Prec==1)&&(a->frac[0]==1)&&(a->exponent==1))
 
#define VpExponent(a)   (a->exponent)
 

Functions

VP_EXPORT RealVpNewRbClass (size_t mx, char const *str, VALUE klass)
 
VP_EXPORT RealVpCreateRbObject (size_t mx, const char *str)
 
VP_EXPORT double VpGetDoubleNaN (void)
 
VP_EXPORT double VpGetDoublePosInf (void)
 
VP_EXPORT double VpGetDoubleNegInf (void)
 
VP_EXPORT double VpGetDoubleNegZero (void)
 
VP_EXPORT size_t VpGetPrecLimit (void)
 
VP_EXPORT size_t VpSetPrecLimit (size_t n)
 
VP_EXPORT int VpIsRoundMode (unsigned short n)
 
VP_EXPORT unsigned short VpGetRoundMode (void)
 
VP_EXPORT unsigned short VpSetRoundMode (unsigned short n)
 
VP_EXPORT int VpException (unsigned short f, const char *str, int always)
 
VP_EXPORT size_t VpNumOfChars (Real *vp, const char *pszFmt)
 
VP_EXPORT size_t VpInit (BDIGIT BaseVal)
 
VP_EXPORT void * VpMemAlloc (size_t mb)
 
VP_EXPORT void * VpMemRealloc (void *ptr, size_t mb)
 
VP_EXPORT void VpFree (Real *pv)
 
VP_EXPORT RealVpAlloc (size_t mx, const char *szVal)
 
VP_EXPORT size_t VpAsgn (Real *c, Real *a, int isw)
 
VP_EXPORT size_t VpAddSub (Real *c, Real *a, Real *b, int operation)
 
VP_EXPORT size_t VpMult (Real *c, Real *a, Real *b)
 
VP_EXPORT size_t VpDivd (Real *c, Real *r, Real *a, Real *b)
 
VP_EXPORT int VpComp (Real *a, Real *b)
 
VP_EXPORT ssize_t VpExponent10 (Real *a)
 
VP_EXPORT void VpSzMantissa (Real *a, char *psz)
 
VP_EXPORT int VpToSpecialString (Real *a, char *psz, int fPlus)
 
VP_EXPORT void VpToString (Real *a, char *psz, size_t fFmt, int fPlus)
 
VP_EXPORT void VpToFString (Real *a, char *psz, size_t fFmt, int fPlus)
 
VP_EXPORT int VpCtoV (Real *a, const char *int_chr, size_t ni, const char *frac, size_t nf, const char *exp_chr, size_t ne)
 
VP_EXPORT int VpVtoD (double *d, SIGNED_VALUE *e, Real *m)
 
VP_EXPORT void VpDtoV (Real *m, double d)
 
VP_EXPORT int VpSqrt (Real *y, Real *x)
 
VP_EXPORT int VpActiveRound (Real *y, Real *x, unsigned short f, ssize_t il)
 
VP_EXPORT int VpMidRound (Real *y, unsigned short f, ssize_t nf)
 
VP_EXPORT int VpLeftRound (Real *y, unsigned short f, ssize_t nf)
 
VP_EXPORT void VpFrac (Real *y, Real *x)
 
VP_EXPORT int VpPower (Real *y, Real *x, SIGNED_VALUE n)
 
VP_EXPORT RealVpOne (void)
 

Variables

VALUE rb_cBigDecimal
 

Macro Definition Documentation

◆ Abs

#define Abs (   a)    (((a)>= 0)?(a):(-(a)))

Definition at line 335 of file bigdecimal.h.

◆ BDIGIT

#define BDIGIT   uint16_t

◆ BDIGIT_DBL

#define BDIGIT_DBL   uint32_t

Definition at line 49 of file bigdecimal.h.

Referenced by rb_big_even_p(), VpDivd(), VpMult(), and VpSzMantissa().

◆ BDIGIT_DBL_SIGNED

#define BDIGIT_DBL_SIGNED   int32_t

Definition at line 50 of file bigdecimal.h.

◆ FLEXIBLE_ARRAY_SIZE

#define FLEXIBLE_ARRAY_SIZE   1

Definition at line 227 of file bigdecimal.h.

◆ Max

#define Max (   a,
 
)    (((a)>(b))?(a):(b))

Definition at line 336 of file bigdecimal.h.

Referenced by VpAlloc().

◆ Min

#define Min (   a,
 
)    (((a)>(b))?(b):(a))

Definition at line 337 of file bigdecimal.h.

Referenced by VpFrac(), VpSqrt(), and VpVtoD().

◆ PRI_BDIGIT_DBL_PREFIX

#define PRI_BDIGIT_DBL_PREFIX   ""

Definition at line 53 of file bigdecimal.h.

◆ PRI_BDIGIT_PREFIX

#define PRI_BDIGIT_PREFIX   "h"

Definition at line 52 of file bigdecimal.h.

◆ PRIdBDIGIT

#define PRIdBDIGIT   PRI_BDIGIT_PREFIX"d"

Definition at line 56 of file bigdecimal.h.

◆ PRIdBDIGIT_DBL

#define PRIdBDIGIT_DBL   PRI_BDIGIT_DBL_PREFIX"d"

Definition at line 63 of file bigdecimal.h.

◆ PRIiBDIGIT

#define PRIiBDIGIT   PRI_BDIGIT_PREFIX"i"

Definition at line 57 of file bigdecimal.h.

◆ PRIiBDIGIT_DBL

#define PRIiBDIGIT_DBL   PRI_BDIGIT_DBL_PREFIX"i"

Definition at line 64 of file bigdecimal.h.

◆ PRIoBDIGIT

#define PRIoBDIGIT   PRI_BDIGIT_PREFIX"o"

Definition at line 58 of file bigdecimal.h.

◆ PRIoBDIGIT_DBL

#define PRIoBDIGIT_DBL   PRI_BDIGIT_DBL_PREFIX"o"

Definition at line 65 of file bigdecimal.h.

◆ PRIuBDIGIT

#define PRIuBDIGIT   PRI_BDIGIT_PREFIX"u"

Definition at line 59 of file bigdecimal.h.

Referenced by VpInit(), and VpPower().

◆ PRIuBDIGIT_DBL

#define PRIuBDIGIT_DBL   PRI_BDIGIT_DBL_PREFIX"u"

Definition at line 66 of file bigdecimal.h.

◆ PRIxBDIGIT

#define PRIxBDIGIT   PRI_BDIGIT_PREFIX"x"

Definition at line 60 of file bigdecimal.h.

◆ PRIXBDIGIT

#define PRIXBDIGIT   PRI_BDIGIT_PREFIX"X"

Definition at line 61 of file bigdecimal.h.

◆ PRIxBDIGIT_DBL

#define PRIxBDIGIT_DBL   PRI_BDIGIT_DBL_PREFIX"x"

Definition at line 67 of file bigdecimal.h.

◆ PRIXBDIGIT_DBL

#define PRIXBDIGIT_DBL   PRI_BDIGIT_DBL_PREFIX"X"

Definition at line 68 of file bigdecimal.h.

◆ RMPD_BASE

#define RMPD_BASE   ((BDIGIT)10000U)

Definition at line 169 of file bigdecimal.h.

◆ RMPD_COMPONENT_FIGURES

#define RMPD_COMPONENT_FIGURES   4

Definition at line 168 of file bigdecimal.h.

Referenced by VpComp().

◆ RMPD_EXCEPTION_MODE_DEFAULT

#define RMPD_EXCEPTION_MODE_DEFAULT   0U

Definition at line 202 of file bigdecimal.h.

◆ RMPD_ROUNDING_MODE_DEFAULT

#define RMPD_ROUNDING_MODE_DEFAULT   VP_ROUND_HALF_UP

Definition at line 214 of file bigdecimal.h.

◆ RUBY_NO_OLD_COMPATIBILITY

#define RUBY_NO_OLD_COMPATIBILITY

Definition at line 12 of file bigdecimal.h.

◆ SIZEOF_BDIGITS

#define SIZEOF_BDIGITS   2

Definition at line 51 of file bigdecimal.h.

◆ SZ_INF

#define SZ_INF   "Infinity"

Definition at line 180 of file bigdecimal.h.

Referenced by VpAlloc(), VpComp(), VpSzMantissa(), and VpToSpecialString().

◆ SZ_NaN

#define SZ_NaN   "NaN"

Definition at line 179 of file bigdecimal.h.

Referenced by VpAlloc(), VpComp(), VpSzMantissa(), and VpToSpecialString().

◆ SZ_NINF

#define SZ_NINF   "-Infinity"

Definition at line 182 of file bigdecimal.h.

Referenced by VpAlloc(), VpComp(), VpSzMantissa(), and VpToSpecialString().

◆ SZ_PINF

#define SZ_PINF   "+Infinity"

Definition at line 181 of file bigdecimal.h.

Referenced by VpAlloc().

◆ vabs

#define vabs   abs

Definition at line 149 of file bigdecimal.h.

◆ VP_EXCEPTION_ALL

#define VP_EXCEPTION_ALL   ((unsigned short)0x00FF)

Definition at line 191 of file bigdecimal.h.

◆ VP_EXCEPTION_INFINITY

#define VP_EXCEPTION_INFINITY   ((unsigned short)0x0001)

Definition at line 192 of file bigdecimal.h.

◆ VP_EXCEPTION_MEMORY

#define VP_EXCEPTION_MEMORY   ((unsigned short)0x0040)

Definition at line 200 of file bigdecimal.h.

Referenced by VpMemAlloc(), and VpMemRealloc().

◆ VP_EXCEPTION_NaN

#define VP_EXCEPTION_NaN   ((unsigned short)0x0002)

Definition at line 193 of file bigdecimal.h.

◆ VP_EXCEPTION_OP

#define VP_EXCEPTION_OP   ((unsigned short)0x0020)

Definition at line 199 of file bigdecimal.h.

Referenced by VpSqrt().

◆ VP_EXCEPTION_OVERFLOW

#define VP_EXCEPTION_OVERFLOW   ((unsigned short)0x0001) /* 0x0008) */

Definition at line 195 of file bigdecimal.h.

◆ VP_EXCEPTION_UNDERFLOW

#define VP_EXCEPTION_UNDERFLOW   ((unsigned short)0x0004)

Definition at line 194 of file bigdecimal.h.

◆ VP_EXCEPTION_ZERODIVIDE

#define VP_EXCEPTION_ZERODIVIDE   ((unsigned short)0x0010)

Definition at line 196 of file bigdecimal.h.

◆ VP_EXPORT

#define VP_EXPORT   static

◆ VP_ROUND_CEIL

#define VP_ROUND_CEIL   5

Definition at line 210 of file bigdecimal.h.

Referenced by VpIsRoundMode(), and VpMidRound().

◆ VP_ROUND_DOWN

#define VP_ROUND_DOWN   2

Definition at line 207 of file bigdecimal.h.

Referenced by VpIsRoundMode(), and VpMidRound().

◆ VP_ROUND_FLOOR

#define VP_ROUND_FLOOR   6

Definition at line 211 of file bigdecimal.h.

Referenced by VpIsRoundMode(), and VpMidRound().

◆ VP_ROUND_HALF_DOWN

#define VP_ROUND_HALF_DOWN   4

Definition at line 209 of file bigdecimal.h.

Referenced by VpIsRoundMode(), and VpMidRound().

◆ VP_ROUND_HALF_EVEN

#define VP_ROUND_HALF_EVEN   7

Definition at line 212 of file bigdecimal.h.

Referenced by VpIsRoundMode(), and VpMidRound().

◆ VP_ROUND_HALF_UP

#define VP_ROUND_HALF_UP   3

Definition at line 208 of file bigdecimal.h.

Referenced by VpIsRoundMode(), and VpMidRound().

◆ VP_ROUND_MODE

#define VP_ROUND_MODE   ((unsigned short)0x0100)

Definition at line 205 of file bigdecimal.h.

◆ VP_ROUND_UP

#define VP_ROUND_UP   1

Definition at line 206 of file bigdecimal.h.

Referenced by VpIsRoundMode(), and VpMidRound().

◆ VP_SIGN_NaN

#define VP_SIGN_NaN   0 /* NaN */

Definition at line 216 of file bigdecimal.h.

◆ VP_SIGN_NEGATIVE_FINITE

#define VP_SIGN_NEGATIVE_FINITE   -2 /* Negative finite number */

Definition at line 220 of file bigdecimal.h.

◆ VP_SIGN_NEGATIVE_INFINITE

#define VP_SIGN_NEGATIVE_INFINITE   -3 /* Negative infinite number */

Definition at line 222 of file bigdecimal.h.

◆ VP_SIGN_NEGATIVE_ZERO

#define VP_SIGN_NEGATIVE_ZERO   -1 /* Negative zero */

Definition at line 218 of file bigdecimal.h.

◆ VP_SIGN_POSITIVE_FINITE

#define VP_SIGN_POSITIVE_FINITE   2 /* Positive finite number */

Definition at line 219 of file bigdecimal.h.

◆ VP_SIGN_POSITIVE_INFINITE

#define VP_SIGN_POSITIVE_INFINITE   3 /* Positive infinite number */

Definition at line 221 of file bigdecimal.h.

◆ VP_SIGN_POSITIVE_ZERO

#define VP_SIGN_POSITIVE_ZERO   1 /* Positive zero */

Definition at line 217 of file bigdecimal.h.

◆ VpBaseFig

#define VpBaseFig ( )    rmpd_component_figures()

Definition at line 275 of file bigdecimal.h.

◆ VpBaseVal

#define VpBaseVal ( )    rmpd_base_value()

Definition at line 277 of file bigdecimal.h.

◆ VpChangeSign

#define VpChangeSign (   a,
 
)    {if((s)>0) (a)->sign=(short)Abs((ssize_t)(a)->sign);else (a)->sign=-(short)Abs((ssize_t)(a)->sign);}

Definition at line 348 of file bigdecimal.h.

Referenced by VpSqrt().

◆ VpDblFig

#define VpDblFig ( )    rmpd_double_figures()

Definition at line 276 of file bigdecimal.h.

◆ VpExponent

#define VpExponent (   a)    (a->exponent)

Definition at line 377 of file bigdecimal.h.

Referenced by VpLeftRound().

◆ VpGetFlag

#define VpGetFlag (   a)    ((a)->flag)

Definition at line 341 of file bigdecimal.h.

◆ VpGetSign

#define VpGetSign (   a)    (((a)->sign>0)?1:(-1))

Definition at line 346 of file bigdecimal.h.

Referenced by VpAsgn(), VpComp(), VpFrac(), VpMidRound(), VpPower(), and VpVtoD().

◆ VpHasVal

#define VpHasVal (   a)    (a->frac[0])

Definition at line 375 of file bigdecimal.h.

Referenced by VpExponent10(), VpFrac(), and VpLeftRound().

◆ VpIsDef

#define VpIsDef (   a)    ( !(VpIsNaN(a)||VpIsInf(a)) )

Definition at line 371 of file bigdecimal.h.

Referenced by VpComp(), and VpNumOfChars().

◆ VpIsInf

#define VpIsInf (   a)    (VpIsPosInf(a) || VpIsNegInf(a))

Definition at line 370 of file bigdecimal.h.

Referenced by VpAsgn(), and VpPower().

◆ VpIsNaN

#define VpIsNaN (   a)    ((a)->sign==VP_SIGN_NaN)

Definition at line 364 of file bigdecimal.h.

Referenced by VpAsgn(), VpComp(), VpPower(), VpSqrt(), VpSzMantissa(), VpToSpecialString(), and VpVtoD().

◆ VpIsNegInf

#define VpIsNegInf (   a)    ((a)->sign==VP_SIGN_NEGATIVE_INFINITE)

Definition at line 369 of file bigdecimal.h.

Referenced by VpComp(), VpSzMantissa(), VpToSpecialString(), and VpVtoD().

◆ VpIsNegZero

#define VpIsNegZero (   a)    ((a)->sign==VP_SIGN_NEGATIVE_ZERO)

Definition at line 357 of file bigdecimal.h.

Referenced by VpVtoD().

◆ VpIsOne

#define VpIsOne (   a)    ((a->Prec==1)&&(a->frac[0]==1)&&(a->exponent==1))

Definition at line 376 of file bigdecimal.h.

Referenced by VpSqrt().

◆ VpIsPosInf

#define VpIsPosInf (   a)    ((a)->sign==VP_SIGN_POSITIVE_INFINITE)

Definition at line 368 of file bigdecimal.h.

Referenced by VpComp(), VpPower(), VpSqrt(), VpSzMantissa(), VpToSpecialString(), and VpVtoD().

◆ VpIsPosZero

#define VpIsPosZero (   a)    ((a)->sign==VP_SIGN_POSITIVE_ZERO)

Definition at line 356 of file bigdecimal.h.

Referenced by VpSzMantissa(), VpToSpecialString(), and VpVtoD().

◆ VpIsZero

#define VpIsZero (   a)    (VpIsPosZero(a) || VpIsNegZero(a))

Definition at line 358 of file bigdecimal.h.

Referenced by VpAsgn(), VpComp(), VpPower(), VpSqrt(), VpSzMantissa(), and VpToSpecialString().

◆ VpMaxPrec

#define VpMaxPrec (   a)    ((a)->MaxPrec)

Definition at line 339 of file bigdecimal.h.

◆ VpPrec

#define VpPrec (   a)    ((a)->Prec)

Definition at line 340 of file bigdecimal.h.

◆ VpSetInf

#define VpSetInf (   a,
 
)    (void)(((s)>0)?VpSetPosInf(a):VpSetNegInf(a))

Definition at line 374 of file bigdecimal.h.

Referenced by VpAsgn(), and VpPower().

◆ VpSetNaN

#define VpSetNaN (   a)    ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_NaN)

Definition at line 365 of file bigdecimal.h.

Referenced by VpAlloc(), VpAsgn(), VpDivd(), VpDtoV(), VpPower(), and VpSqrt().

◆ VpSetNegInf

#define VpSetNegInf (   a)    ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_NEGATIVE_INFINITE)

Definition at line 373 of file bigdecimal.h.

Referenced by VpAlloc(), and VpDtoV().

◆ VpSetNegZero

#define VpSetNegZero (   a)    ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_NEGATIVE_ZERO)

Definition at line 360 of file bigdecimal.h.

◆ VpSetOne

#define VpSetOne (   a)    {(a)->Prec=(a)->exponent=(a)->frac[0]=1;(a)->sign=VP_SIGN_POSITIVE_FINITE;}

Definition at line 353 of file bigdecimal.h.

Referenced by VpPower(), and VpSqrt().

◆ VpSetPosInf

#define VpSetPosInf (   a)    ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_POSITIVE_INFINITE)

Definition at line 372 of file bigdecimal.h.

Referenced by VpAlloc(), and VpDtoV().

◆ VpSetPosZero

#define VpSetPosZero (   a)    ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_POSITIVE_ZERO)

Definition at line 359 of file bigdecimal.h.

◆ VpSetSign

#define VpSetSign (   a,
 
)    {if((s)>0) (a)->sign=(short)VP_SIGN_POSITIVE_FINITE;else (a)->sign=(short)VP_SIGN_NEGATIVE_FINITE;}

Definition at line 350 of file bigdecimal.h.

Referenced by VpAsgn(), VpDtoV(), VpFrac(), and VpPower().

◆ VpSetZero

#define VpSetZero (   a,
 
)    (void)(((s)>0)?VpSetPosZero(a):VpSetNegZero(a))

Definition at line 361 of file bigdecimal.h.

Referenced by VpAlloc(), VpDtoV(), VpFrac(), VpMidRound(), and VpPower().

Function Documentation

◆ VpActiveRound()

VP_EXPORT int VpActiveRound ( Real y,
Real x,
unsigned short  f,
ssize_t  il 
)

Definition at line 6141 of file bigdecimal.c.

References VpAsgn(), and VpMidRound().

◆ VpAddSub()

VP_EXPORT size_t VpAddSub ( Real c,
Real a,
Real b,
int  operation 
)

Definition at line 4224 of file bigdecimal.c.

References BDIGIT.

Referenced by VpSqrt().

◆ VpAlloc()

VP_EXPORT Real* VpAlloc ( size_t  mx,
const char *  szVal 
)

◆ VpAsgn()

VP_EXPORT size_t VpAsgn ( Real c,
Real a,
int  isw 
)

◆ VpComp()

VP_EXPORT int VpComp ( Real a,
Real b 
)

◆ VpCreateRbObject()

VP_EXPORT Real* VpCreateRbObject ( size_t  mx,
const char *  str 
)

Definition at line 670 of file bigdecimal.c.

References rb_cBigDecimal, and VpNewRbClass().

◆ VpCtoV()

VP_EXPORT int VpCtoV ( Real a,
const char *  int_chr,
size_t  ni,
const char *  frac,
size_t  nf,
const char *  exp_chr,
size_t  ne 
)

Definition at line 5499 of file bigdecimal.c.

Referenced by VpAlloc().

◆ VpDivd()

VP_EXPORT size_t VpDivd ( Real c,
Real r,
Real a,
Real b 
)

Definition at line 4808 of file bigdecimal.c.

References BDIGIT, BDIGIT_DBL, and VpSetNaN.

Referenced by VpPower(), and VpSqrt().

◆ VpDtoV()

VP_EXPORT void VpDtoV ( Real m,
double  d 
)

◆ VpException()

VP_EXPORT int VpException ( unsigned short  f,
const char *  str,
int  always 
)

Definition at line 3755 of file bigdecimal.c.

Referenced by VpMemAlloc(), VpMemRealloc(), and VpSqrt().

◆ VpExponent10()

VP_EXPORT ssize_t VpExponent10 ( Real a)

Definition at line 5286 of file bigdecimal.c.

References BASE1, BASE_FIG, Real::exponent, Real::frac, VP_EXPORT, and VpHasVal.

Referenced by VpComp().

◆ VpFrac()

VP_EXPORT void VpFrac ( Real y,
Real x 
)

◆ VpFree()

VP_EXPORT void VpFree ( Real pv)

Definition at line 3533 of file bigdecimal.c.

References NULL, and xfree().

Referenced by VpPower(), and VpSqrt().

◆ VpGetDoubleNaN()

VP_EXPORT double VpGetDoubleNaN ( void  )

Definition at line 3714 of file bigdecimal.c.

Referenced by VpInit(), and VpVtoD().

◆ VpGetDoubleNegInf()

VP_EXPORT double VpGetDoubleNegInf ( void  )

Definition at line 3730 of file bigdecimal.c.

Referenced by VpInit(), and VpVtoD().

◆ VpGetDoubleNegZero()

VP_EXPORT double VpGetDoubleNegZero ( void  )

Definition at line 3738 of file bigdecimal.c.

Referenced by VpInit(), and VpVtoD().

◆ VpGetDoublePosInf()

VP_EXPORT double VpGetDoublePosInf ( void  )

Definition at line 3722 of file bigdecimal.c.

Referenced by VpInit(), and VpVtoD().

◆ VpGetPrecLimit()

VP_EXPORT size_t VpGetPrecLimit ( void  )

Definition at line 3598 of file bigdecimal.c.

References rb_thread_current(), and rb_thread_local_aref().

Referenced by VpAlloc(), and VpSetPrecLimit().

◆ VpGetRoundMode()

VP_EXPORT unsigned short VpGetRoundMode ( void  )

Definition at line 3633 of file bigdecimal.c.

References rb_thread_current(), and rb_thread_local_aref().

Referenced by VpSetRoundMode().

◆ VpInit()

VP_EXPORT size_t VpInit ( BDIGIT  BaseVal)

◆ VpIsRoundMode()

VP_EXPORT int VpIsRoundMode ( unsigned short  n)

◆ VpLeftRound()

VP_EXPORT int VpLeftRound ( Real y,
unsigned short  f,
ssize_t  nf 
)

Definition at line 6126 of file bigdecimal.c.

References BASE_FIG, BDIGIT, Real::frac, VP_EXPORT, VpExponent, VpHasVal, and VpMidRound().

◆ VpMemAlloc()

VP_EXPORT void* VpMemAlloc ( size_t  mb)

Definition at line 3509 of file bigdecimal.c.

References VP_EXCEPTION_MEMORY, VP_EXPORT, VpException(), and xmalloc.

◆ VpMemRealloc()

VP_EXPORT void* VpMemRealloc ( void *  ptr,
size_t  mb 
)

Definition at line 3523 of file bigdecimal.c.

References VP_EXCEPTION_MEMORY, VP_EXPORT, VpException(), and xrealloc.

◆ VpMidRound()

VP_EXPORT int VpMidRound ( Real y,
unsigned short  f,
ssize_t  nf 
)

◆ VpMult()

VP_EXPORT size_t VpMult ( Real c,
Real a,
Real b 
)

Definition at line 4679 of file bigdecimal.c.

References BDIGIT, and BDIGIT_DBL.

Referenced by VpPower(), and VpSqrt().

◆ VpNewRbClass()

VP_EXPORT Real* VpNewRbClass ( size_t  mx,
char const str,
VALUE  klass 
)

Definition at line 660 of file bigdecimal.c.

References Real::obj, RTYPEDDATA_DATA, TypedData_Wrap_Struct, VP_EXPORT, and VpAlloc().

Referenced by VpCreateRbObject().

◆ VpNumOfChars()

VP_EXPORT size_t VpNumOfChars ( Real vp,
const char *  pszFmt 
)

Definition at line 3882 of file bigdecimal.c.

References BASE_FIG, Real::exponent, NULL, Real::Prec, SIGNED_VALUE, VP_EXPORT, and VpIsDef.

◆ VpOne()

VP_EXPORT Real* VpOne ( void  )

Definition at line 3957 of file bigdecimal.c.

◆ VpPower()

VP_EXPORT int VpPower ( Real y,
Real x,
SIGNED_VALUE  n 
)

◆ VpSetPrecLimit()

VP_EXPORT size_t VpSetPrecLimit ( size_t  n)

Definition at line 3614 of file bigdecimal.c.

References rmpd_set_thread_local_precision_limit, and VpGetPrecLimit().

◆ VpSetRoundMode()

VP_EXPORT unsigned short VpSetRoundMode ( unsigned short  n)

◆ VpSqrt()

VP_EXPORT int VpSqrt ( Real y,
Real x 
)

◆ VpSzMantissa()

VP_EXPORT void VpSzMantissa ( Real a,
char *  psz 
)

◆ VpToFString()

VP_EXPORT void VpToFString ( Real a,
char *  psz,
size_t  fFmt,
int  fPlus 
)

◆ VpToSpecialString()

VP_EXPORT int VpToSpecialString ( Real a,
char *  psz,
int  fPlus 
)

Definition at line 5350 of file bigdecimal.c.

References SZ_INF, SZ_NaN, SZ_NINF, VP_EXPORT, VpIsNaN, VpIsNegInf, VpIsPosInf, VpIsPosZero, and VpIsZero.

Referenced by VpToFString().

◆ VpToString()

VP_EXPORT void VpToString ( Real a,
char *  psz,
size_t  fFmt,
int  fPlus 
)

Definition at line 5385 of file bigdecimal.c.

References BDIGIT.

◆ VpVtoD()

VP_EXPORT int VpVtoD ( double *  d,
SIGNED_VALUE e,
Real m 
)

Variable Documentation

◆ rb_cBigDecimal

VALUE rb_cBigDecimal

Definition at line 45 of file bigdecimal.c.

Referenced by VpCreateRbObject().