Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

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 | 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 | 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 Real * | VpNewRbClass (size_t mx, char const *str, VALUE klass)
VP_EXPORT Real * | VpCreateRbObject (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 Real * | VpAlloc (size_t mx, const char *szVal, int strict_p, int exc)
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 Real * | VpOne (void)

## Variables
VALUE | rb_cBigDecimal

## Macro Definition Documentation

## ◆ Abs

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

Definition at line 343 of file bigdecimal.h.

## ◆ BDIGIT

#define BDIGIT uint16_t

Definition at line 48 of file bigdecimal.h.

## ◆ BDIGIT_DBL

#define BDIGIT_DBL uint32_t

Definition at line 49 of file bigdecimal.h.

## ◆ 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 235 of file bigdecimal.h.

## ◆ Max

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

Definition at line 344 of file bigdecimal.h.

## ◆ Min

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

Definition at line 345 of file bigdecimal.h.

## ◆ 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.

## ◆ 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 175 of file bigdecimal.h.

## ◆ RMPD_COMPONENT_FIGURES

#define RMPD_COMPONENT_FIGURES 4

Definition at line 174 of file bigdecimal.h.

## ◆ RMPD_EXCEPTION_MODE_DEFAULT

#define RMPD_EXCEPTION_MODE_DEFAULT 0U

Definition at line 208 of file bigdecimal.h.

## ◆ RMPD_ROUNDING_MODE_DEFAULT

#define RMPD_ROUNDING_MODE_DEFAULT VP_ROUND_HALF_UP

Definition at line 220 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 186 of file bigdecimal.h.

## ◆ SZ_NaN

#define SZ_NaN "NaN"

Definition at line 185 of file bigdecimal.h.

## ◆ SZ_NINF

#define SZ_NINF "-Infinity"

Definition at line 188 of file bigdecimal.h.

## ◆ SZ_PINF

#define SZ_PINF "+Infinity"

Definition at line 187 of file bigdecimal.h.

## ◆ vabs

#define vabs abs

Definition at line 155 of file bigdecimal.h.

## ◆ VP_EXCEPTION_ALL

#define VP_EXCEPTION_ALL ((unsigned short)0x00FF)

Definition at line 197 of file bigdecimal.h.

## ◆ VP_EXCEPTION_INFINITY

#define VP_EXCEPTION_INFINITY ((unsigned short)0x0001)

Definition at line 198 of file bigdecimal.h.

## ◆ VP_EXCEPTION_MEMORY

#define VP_EXCEPTION_MEMORY ((unsigned short)0x0040)

Definition at line 206 of file bigdecimal.h.

## ◆ VP_EXCEPTION_NaN

#define VP_EXCEPTION_NaN ((unsigned short)0x0002)

Definition at line 199 of file bigdecimal.h.

## ◆ VP_EXCEPTION_OP

#define VP_EXCEPTION_OP ((unsigned short)0x0020)

Definition at line 205 of file bigdecimal.h.

## ◆ VP_EXCEPTION_OVERFLOW

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

Definition at line 201 of file bigdecimal.h.

## ◆ VP_EXCEPTION_UNDERFLOW

#define VP_EXCEPTION_UNDERFLOW ((unsigned short)0x0004)

Definition at line 200 of file bigdecimal.h.

## ◆ VP_EXCEPTION_ZERODIVIDE

#define VP_EXCEPTION_ZERODIVIDE ((unsigned short)0x0010)

Definition at line 202 of file bigdecimal.h.

## ◆ VP_EXPORT

#define VP_EXPORT static

Definition at line 194 of file bigdecimal.h.

## ◆ VP_ROUND_CEIL

#define VP_ROUND_CEIL 5

Definition at line 216 of file bigdecimal.h.

## ◆ VP_ROUND_DOWN

#define VP_ROUND_DOWN 2

Definition at line 213 of file bigdecimal.h.

## ◆ VP_ROUND_FLOOR

#define VP_ROUND_FLOOR 6

Definition at line 217 of file bigdecimal.h.

## ◆ VP_ROUND_HALF_DOWN

#define VP_ROUND_HALF_DOWN 4

Definition at line 215 of file bigdecimal.h.

## ◆ VP_ROUND_HALF_EVEN

#define VP_ROUND_HALF_EVEN 7

Definition at line 218 of file bigdecimal.h.

## ◆ VP_ROUND_HALF_UP

#define VP_ROUND_HALF_UP 3

Definition at line 214 of file bigdecimal.h.

## ◆ VP_ROUND_MODE

#define VP_ROUND_MODE ((unsigned short)0x0100)

Definition at line 211 of file bigdecimal.h.

## ◆ VP_ROUND_UP

#define VP_ROUND_UP 1

Definition at line 212 of file bigdecimal.h.

## ◆ VP_SIGN_NaN

#define VP_SIGN_NaN 0 /* NaN */

Definition at line 222 of file bigdecimal.h.

## ◆ VP_SIGN_NEGATIVE_FINITE

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

Definition at line 226 of file bigdecimal.h.

## ◆ VP_SIGN_NEGATIVE_INFINITE

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

Definition at line 228 of file bigdecimal.h.

## ◆ VP_SIGN_NEGATIVE_ZERO

#define VP_SIGN_NEGATIVE_ZERO -1 /* Negative zero */

Definition at line 224 of file bigdecimal.h.

## ◆ VP_SIGN_POSITIVE_FINITE

#define VP_SIGN_POSITIVE_FINITE 2 /* Positive finite number */

Definition at line 225 of file bigdecimal.h.

## ◆ VP_SIGN_POSITIVE_INFINITE

#define VP_SIGN_POSITIVE_INFINITE 3 /* Positive infinite number */

Definition at line 227 of file bigdecimal.h.

## ◆ VP_SIGN_POSITIVE_ZERO

#define VP_SIGN_POSITIVE_ZERO 1 /* Positive zero */

Definition at line 223 of file bigdecimal.h.

## ◆ VpBaseFig

#define VpBaseFig | ( |  | ) | rmpd_component_figures()

Definition at line 283 of file bigdecimal.h.

## ◆ VpBaseVal

#define VpBaseVal | ( |  | ) | rmpd_base_value()

Definition at line 285 of file bigdecimal.h.

## ◆ VpChangeSign

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

Definition at line 356 of file bigdecimal.h.

## ◆ VpDblFig

#define VpDblFig | ( |  | ) | rmpd_double_figures()

Definition at line 284 of file bigdecimal.h.

## ◆ VpExponent

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

Definition at line 385 of file bigdecimal.h.

## ◆ VpGetFlag

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

Definition at line 349 of file bigdecimal.h.

## ◆ VpGetSign

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

Definition at line 354 of file bigdecimal.h.

## ◆ VpHasVal

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

Definition at line 383 of file bigdecimal.h.

## ◆ VpIsDef

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

Definition at line 379 of file bigdecimal.h.

## ◆ VpIsInf

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

Definition at line 378 of file bigdecimal.h.

## ◆ VpIsNaN

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

Definition at line 372 of file bigdecimal.h.

## ◆ VpIsNegInf

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

Definition at line 377 of file bigdecimal.h.

## ◆ VpIsNegZero

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

Definition at line 365 of file bigdecimal.h.

## ◆ VpIsOne

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

Definition at line 384 of file bigdecimal.h.

## ◆ VpIsPosInf

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

Definition at line 376 of file bigdecimal.h.

## ◆ VpIsPosZero

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

Definition at line 364 of file bigdecimal.h.

## ◆ VpIsZero

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

Definition at line 366 of file bigdecimal.h.

## ◆ VpMaxPrec

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

Definition at line 347 of file bigdecimal.h.

## ◆ VpPrec

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

Definition at line 348 of file bigdecimal.h.

## ◆ VpSetInf

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

Definition at line 382 of file bigdecimal.h.

## ◆ VpSetNaN

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

Definition at line 373 of file bigdecimal.h.

## ◆ VpSetNegInf

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

Definition at line 381 of file bigdecimal.h.

## ◆ VpSetNegZero

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

Definition at line 368 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 361 of file bigdecimal.h.

## ◆ VpSetPosInf

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

Definition at line 380 of file bigdecimal.h.

## ◆ VpSetPosZero

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

Definition at line 367 of file bigdecimal.h.

## ◆ VpSetSign

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

Definition at line 358 of file bigdecimal.h.

## ◆ VpSetZero

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

Definition at line 369 of file bigdecimal.h.

## Function Documentation

## ◆ VpActiveRound()

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

Definition at line 6305 of file bigdecimal.c.

References f, VpAsgn(), and VpMidRound().

## ◆ VpAddSub()

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

Definition at line 4388 of file bigdecimal.c.

References BDIGIT, i, n, printf(), and stdout.

Referenced by VpSqrt().

## ◆ VpAlloc()

VP_EXPORT Real* VpAlloc | ( | size_t | mx,
|  | const char * | szVal,
|  | int | strict_p,
|  | int | exc
| ) |  |

Definition at line 4111 of file bigdecimal.c.

References BASE_FIG, buf, exc, i, ISDIGIT, ISSPACE, Max, Real::MaxPrec, ne, NULL, PRIsVALUE, rb_eArgError, rb_raise(), rb_str_new2, rb_str_resize(), rb_str_tmp_new(), rmpd_parse_special_string(), RSTRING_PTR, str, strlen(), v, VpAllocReal, VpCtoV(), VpGetPrecLimit(), and VpSetZero.

Referenced by VpPower(), and VpSqrt().

## ◆ VpAsgn()

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

Definition at line 4344 of file bigdecimal.c.

References BDIGIT, Real::exponent, Real::frac, Real::MaxPrec, memcpy(), n, Real::Prec, VpGetSign, VpIsInf, VpIsNaN, VpIsZero, VpSetInf, VpSetNaN, and VpSetSign.

Referenced by VpActiveRound(), VpFrac(), VpPower(), and VpSqrt().

## ◆ VpComp()

VP_EXPORT int VpComp | ( | Real * | a,
|  | Real * | b
| ) |  |

Definition at line 5225 of file bigdecimal.c.

References Real::exponent, Real::frac, Real::Prec, printf(), Real::sign, stdout, VpGetSign, VpIsDef, VpIsNaN, and VpIsZero.

## ◆ VpCreateRbObject()

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

Definition at line 655 of file bigdecimal.c.

References rb_cBigDecimal, str, 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 5663 of file bigdecimal.c.

Referenced by VpAlloc().

## ◆ VpDivd()

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

Definition at line 4972 of file bigdecimal.c.

References BDIGIT, BDIGIT_DBL, i, n, stdout, and VpSetNaN.

Referenced by VpPower(), and VpSqrt().

## ◆ VpDtoV()

VP_EXPORT void VpDtoV | ( | Real * | m,
|  | double | d
| ) |  |

Definition at line 5887 of file bigdecimal.c.

References BASE, BDIGIT, double, Real::exponent, Real::frac, i, isinf, isnan, Real::MaxPrec, memset(), ne, Real::Prec, SIGNED_VALUE, VpSetNaN, VpSetNegInf, VpSetPosInf, VpSetSign, and VpSetZero.

Referenced by VpSqrt().

## ◆ VpException()

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

Definition at line 3809 of file bigdecimal.c.

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

## ◆ VpExponent10()

VP_EXPORT ssize_t VpExponent10 | ( | Real * | a | ) |

Definition at line 5450 of file bigdecimal.c.

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

## ◆ VpFrac()

VP_EXPORT void VpFrac | ( | Real * | y,
|  | Real * | x
| ) |  |

Definition at line 6400 of file bigdecimal.c.

References Real::exponent, Real::frac, Real::MaxPrec, Min, Real::Prec, VpAsgn(), VpGetSign, VpHasVal, VpSetSign, and VpSetZero.

## ◆ VpFree()

VP_EXPORT void VpFree | ( | Real * | pv | ) |

Definition at line 3599 of file bigdecimal.c.

References NULL, printf(), and xfree.

## ◆ VpGetDoubleNaN()

VP_EXPORT double VpGetDoubleNaN | ( | void |  | ) |

Definition at line 3774 of file bigdecimal.c.

References nan().

Referenced by VpVtoD().

## ◆ VpGetDoubleNegInf()

VP_EXPORT double VpGetDoubleNegInf | ( | void |  | ) |

Definition at line 3786 of file bigdecimal.c.

References HUGE_VAL.

Referenced by VpVtoD().

## ◆ VpGetDoubleNegZero()

VP_EXPORT double VpGetDoubleNegZero | ( | void |  | ) |

Definition at line 3792 of file bigdecimal.c.

Referenced by VpInit(), and VpVtoD().

## ◆ VpGetDoublePosInf()

VP_EXPORT double VpGetDoublePosInf | ( | void |  | ) |

Definition at line 3780 of file bigdecimal.c.

References HUGE_VAL.

Referenced by VpVtoD().

## ◆ VpGetPrecLimit()

VP_EXPORT size_t VpGetPrecLimit | ( | void |  | ) |

Definition at line 3664 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 3699 of file bigdecimal.c.

References rb_thread_current(), and rb_thread_local_aref().

Referenced by VpSetRoundMode().

## ◆ VpInit()

VP_EXPORT size_t VpInit | ( | BDIGIT | BaseVal | ) |

Definition at line 3980 of file bigdecimal.c.

References VpGetDoubleNegZero().

## ◆ VpIsRoundMode()

VP_EXPORT int VpIsRoundMode | ( | unsigned short | n | ) |

Definition at line 3715 of file bigdecimal.c.

References n, VP_ROUND_CEIL, VP_ROUND_DOWN, VP_ROUND_FLOOR, VP_ROUND_HALF_DOWN, VP_ROUND_HALF_EVEN, VP_ROUND_HALF_UP, and VP_ROUND_UP.

Referenced by VpSetRoundMode().

## ◆ VpLeftRound()

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

Definition at line 6290 of file bigdecimal.c.

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

## ◆ VpMemAlloc()

VP_EXPORT void* VpMemAlloc | ( | size_t | mb | ) |

Definition at line 3575 of file bigdecimal.c.

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

## ◆ VpMemRealloc()

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

Definition at line 3589 of file bigdecimal.c.

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

## ◆ VpMidRound()

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

Definition at line 6128 of file bigdecimal.c.

References BASE, BASE_FIG, BDIGIT, BIGDECIMAL_NEGATIVE_P, BIGDECIMAL_POSITIVE_P, div(), Real::exponent, f, Real::frac, i, memset(), n, Real::Prec, v, VP_ROUND_CEIL, VP_ROUND_DOWN, VP_ROUND_FLOOR, VP_ROUND_HALF_DOWN, VP_ROUND_HALF_EVEN, VP_ROUND_HALF_UP, VP_ROUND_UP, VpGetSign, and VpSetZero.

Referenced by VpActiveRound(), and VpLeftRound().

## ◆ VpMult()

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

Definition at line 4843 of file bigdecimal.c.

References BDIGIT, BDIGIT_DBL, i, and stdout.

Referenced by VpPower(), and VpSqrt().

## ◆ VpNewRbClass()

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

Definition at line 644 of file bigdecimal.c.

References klass, obj, and TypedData_Wrap_Struct.

Referenced by VpCreateRbObject().

## ◆ VpNumOfChars()

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

Definition at line 3936 of file bigdecimal.c.

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

## ◆ VpOne()

VP_EXPORT Real* VpOne | ( | void |  | ) |

Definition at line 4008 of file bigdecimal.c.

## ◆ VpPower()

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

Definition at line 6448 of file bigdecimal.c.

References BASE_FIG, BIGDECIMAL_POSITIVE_P, Real::exponent, Real::frac, Real::MaxPrec, n, NULL, Real::Prec, SIGNED_VALUE, VpAlloc(), VpAsgn(), VpDivd(), VpGetSign, VpIsInf, VpIsNaN, VpIsPosInf, VpIsZero, VpMult(), VpSetInf, VpSetNaN, VpSetOne, VpSetSign, and VpSetZero.

## ◆ VpSetPrecLimit()

VP_EXPORT size_t VpSetPrecLimit | ( | size_t | n | ) |

Definition at line 3680 of file bigdecimal.c.

References n, rmpd_set_thread_local_precision_limit, and VpGetPrecLimit().

## ◆ VpSetRoundMode()

VP_EXPORT unsigned short VpSetRoundMode | ( | unsigned short | n | ) |

Definition at line 3733 of file bigdecimal.c.

References n, rmpd_set_thread_local_rounding_mode, VpGetRoundMode(), and VpIsRoundMode().

## ◆ VpSqrt()

VP_EXPORT int VpSqrt | ( | Real * | y,
|  | Real * | x
| ) |  |

Definition at line 6019 of file bigdecimal.c.

References BASE, BASE_FIG, BIGDECIMAL_NEGATIVE_P, DBLE_FIG, Real::exponent, f, if(), maxnr, Real::MaxPrec, Min, n, NULL, SIGNED_VALUE, sqrt(), VP_EXCEPTION_OP, VpAddSub(), VpAlloc(), VpAsgn(), VpDivd(), VpDtoV(), VpException(), VpIsNaN, VpIsOne, VpIsPosInf, VpIsZero, VpMult(), VpSetNaN, VpSetOne, and VpVtoD().

## ◆ VpSzMantissa()

VP_EXPORT void VpSzMantissa | ( | Real * | a,
|  | char * | psz
| ) |  |

Definition at line 5467 of file bigdecimal.c.

References BASE1, BDIGIT_DBL, BIGDECIMAL_NEGATIVE_P, Real::frac, i, n, Real::Prec, sprintf(), strlen(), SZ_INF, SZ_NaN, SZ_NINF, VpIsNaN, VpIsNegInf, VpIsPosInf, VpIsPosZero, and VpIsZero.

## ◆ VpToFString()

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

Definition at line 5597 of file bigdecimal.c.

References BASE, BASE1, BASE_FIG, BDIGIT, BIGDECIMAL_NEGATIVE_P, char, Real::exponent, Real::frac, i, n, Real::Prec, sprintf(), strlen(), and VpToSpecialString().

## ◆ VpToSpecialString()

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

Definition at line 5514 of file bigdecimal.c.

References sprintf(), SZ_INF, SZ_NaN, SZ_NINF, 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 5549 of file bigdecimal.c.

References BDIGIT, i, and n.

## ◆ VpVtoD()

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

Definition at line 5823 of file bigdecimal.c.

References BASE, BASE_FIG, DBLE_FIG, div(), double, Real::exponent, f, Real::frac, Min, Real::Prec, printf(), SIGNED_VALUE, stdout, VpGetDoubleNaN(), VpGetDoubleNegInf(), VpGetDoubleNegZero(), VpGetDoublePosInf(), VpGetSign, VpIsNaN, VpIsNegInf, VpIsNegZero, VpIsPosInf, and VpIsPosZero.

Referenced by VpSqrt().

## Variable Documentation

## ◆ rb_cBigDecimal

VALUE rb_cBigDecimal

Definition at line 45 of file bigdecimal.c.

Referenced by VpCreateRbObject().