Ruby 1.9.2p136(2010-12-25revision30365)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Defines | Functions

# ext/bigdecimal/bigdecimal.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | Real
## Defines
#define | SZ_NaN "NaN"
#define | SZ_INF "Infinity"
#define | SZ_PINF "+Infinity"
#define | SZ_NINF "-Infinity"
#define | VP_EXPORT static
#define | U_LONG unsigned long
#define | S_LONG long
#define | U_INT unsigned int
#define | S_INT int
#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)
#define | VP_EXCEPTION_ZERODIVIDE ((unsigned short)0x0010)
#define | VP_EXCEPTION_OP ((unsigned short)0x0020)
#define | VP_EXCEPTION_MEMORY ((unsigned short)0x0040)
#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 | VP_SIGN_NaN 0
#define | VP_SIGN_POSITIVE_ZERO 1
#define | VP_SIGN_NEGATIVE_ZERO -1
#define | VP_SIGN_POSITIVE_FINITE 2
#define | VP_SIGN_NEGATIVE_FINITE -2
#define | VP_SIGN_POSITIVE_INFINITE 3
#define | VP_SIGN_NEGATIVE_INFINITE -3
#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((S_LONG)(a)->sign);else (a)->sign=-(short)Abs((S_LONG)(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)->frac[0]=(a)->Prec=(a)->exponent=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) ( ((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) ( ((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 (U_LONG mx, char *str, VALUE klass)
VP_EXPORT Real * | VpCreateRbObject (U_LONG mx, const char *str)
VP_EXPORT U_LONG | VpBaseFig (void)
VP_EXPORT U_LONG | VpDblFig (void)
VP_EXPORT U_LONG | VpBaseVal (void)
VP_EXPORT double | VpGetDoubleNaN (void)
VP_EXPORT double | VpGetDoublePosInf (void)
VP_EXPORT double | VpGetDoubleNegInf (void)
VP_EXPORT double | VpGetDoubleNegZero (void)
VP_EXPORT U_LONG | VpGetPrecLimit (void)
VP_EXPORT U_LONG | VpSetPrecLimit (U_LONG n)
VP_EXPORT int | VpIsRoundMode (unsigned long n)
VP_EXPORT unsigned long | VpGetRoundMode (void)
VP_EXPORT unsigned long | VpSetRoundMode (unsigned long n)
VP_EXPORT int | VpException (unsigned short f, const char *str, int always)
VP_EXPORT U_LONG | VpNumOfChars (Real *vp, const char *pszFmt)
VP_EXPORT U_LONG | VpInit (U_LONG BaseVal)
VP_EXPORT void * | VpMemAlloc (U_LONG mb)
VP_EXPORT void | VpFree (Real *pv)
VP_EXPORT Real * | VpAlloc (U_LONG mx, const char *szVal)
VP_EXPORT U_LONG | VpAsgn (Real *c, Real *a, int isw)
VP_EXPORT U_LONG | VpAddSub (Real *c, Real *a, Real *b, int operation)
VP_EXPORT U_LONG | VpMult (Real *c, Real *a, Real *b)
VP_EXPORT U_LONG | VpDivd (Real *c, Real *r, Real *a, Real *b)
VP_EXPORT int | VpComp (Real *a, Real *b)
VP_EXPORT S_LONG | 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, int fFmt, int fPlus)
VP_EXPORT void | VpToFString (Real *a, char *psz, int fFmt, int fPlus)
VP_EXPORT int | VpCtoV (Real *a, const char *int_chr, U_LONG ni, const char *frac, U_LONG nf, const char *exp_chr, U_LONG ne)
VP_EXPORT int | VpVtoD (double *d, S_LONG *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, int f, S_LONG il)
VP_EXPORT int | VpMidRound (Real *y, int f, S_LONG nf)
VP_EXPORT int | VpLeftRound (Real *y, int f, S_LONG nf)
VP_EXPORT void | VpFrac (Real *y, Real *x)
VP_EXPORT int | VpPower (Real *y, Real *x, S_INT n)
VP_EXPORT Real * | VpOne (void)

## Define Documentation

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

Definition at line 169 of file bigdecimal.h.

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

Definition at line 170 of file bigdecimal.h.

Referenced by VpAlloc(), and VpSetPTR().

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

Definition at line 171 of file bigdecimal.h.

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

#define S_INT int

Definition at line 40 of file bigdecimal.h.

Referenced by AddExponent(), BigDecimal_abs(), BigDecimal_add2(), BigDecimal_div2(), BigDecimal_DoDivmod(), BigDecimal_mult2(), BigDecimal_power(), BigDecimal_sub2(), BigDecimal_to_s(), BigDecimalCmp(), GetAddSubPrec(), GetPositiveInt(), Init_bigdecimal(), VpAddSub(), VpCtoV(), VpDtoV(), VpFormatSt(), VpMidRound(), VpNmlz(), VpNumOfChars(), VpPower(), VpSqrt(), and VpVtoD().

#define S_LONG long

Definition at line 38 of file bigdecimal.h.

Referenced by BigDecimal_exponent(), BigDecimal_global_new(), BigDecimal_new(), BigDecimal_power(), BigDecimal_split(), BigDecimal_to_f(), BigDecimal_to_i(), BigDecimal_to_r(), VpCtoV(), VpExponent10(), VpLimitRound(), VpMidRound(), VpPower(), VpSqrt(), VpToFString(), and VpToString().

#define SZ_INF "Infinity"

Definition at line 27 of file bigdecimal.h.

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

#define SZ_NaN "NaN"

Definition at line 26 of file bigdecimal.h.

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

#define SZ_NINF "-Infinity"

Definition at line 29 of file bigdecimal.h.

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

#define SZ_PINF "+Infinity"

Definition at line 28 of file bigdecimal.h.

Referenced by VpAlloc().

#define U_INT unsigned int

Definition at line 39 of file bigdecimal.h.

#define U_LONG unsigned long

Definition at line 37 of file bigdecimal.h.

Referenced by BigDecimal_abs(), BigDecimal_add(), BigDecimal_add2(), BigDecimal_ceil(), BigDecimal_div2(), BigDecimal_divide(), BigDecimal_divremain(), BigDecimal_DoDivmod(), BigDecimal_fix(), BigDecimal_floor(), BigDecimal_frac(), BigDecimal_hash(), BigDecimal_inspect(), BigDecimal_memsize(), BigDecimal_mult(), BigDecimal_mult2(), BigDecimal_round(), BigDecimal_sqrt(), BigDecimal_sub(), BigDecimal_sub2(), BigDecimal_to_s(), BigDecimal_truncate(), GetAddSubPrec(), Init_bigdecimal(), VpAddAbs(), VpAddSub(), VpAlloc(), VpAsgn(), VpComp(), VpCtoV(), VpDivd(), VpDtoV(), VpExponent10(), VpFormatSt(), VpFrac(), VpInit(), VpLeftRound(), VpLimitRound(), VpMidRound(), VpMult(), VpNmlz(), VpNumOfChars(), VpPower(), VpRdup(), VpSetPrecLimit(), VpSetPTR(), VpSqrt(), VpSubAbs(), VpSzMantissa(), VpToFString(), VpToString(), and VpVtoD().

#define VP_EXCEPTION_ALL ((unsigned short)0x00FF)

Definition at line 43 of file bigdecimal.h.

Referenced by BigDecimal_mode(), and Init_bigdecimal().

#define VP_EXCEPTION_INFINITY ((unsigned short)0x0001)

Definition at line 44 of file bigdecimal.h.

Referenced by BigDecimal_check_num(), BigDecimal_mode(), GetAddSubPrec(), Init_bigdecimal(), ToValue(), VpCtoV(), VpException(), and VpIsDefOP().

#define VP_EXCEPTION_MEMORY ((unsigned short)0x0040)

Definition at line 52 of file bigdecimal.h.

Referenced by VpException(), and VpMemAlloc().

#define VP_EXCEPTION_NaN ((unsigned short)0x0002)

Definition at line 45 of file bigdecimal.h.

Referenced by BigDecimal_check_num(), BigDecimal_mode(), Init_bigdecimal(), ToValue(), VpDivd(), VpException(), and VpIsDefOP().

#define VP_EXCEPTION_OP ((unsigned short)0x0020)

Definition at line 51 of file bigdecimal.h.

Referenced by VpException(), and VpSqrt().

#define VP_EXCEPTION_OVERFLOW ((unsigned short)0x0001)

Definition at line 47 of file bigdecimal.h.

Referenced by AddExponent(), BigDecimal_to_f(), and Init_bigdecimal().

#define VP_EXCEPTION_UNDERFLOW ((unsigned short)0x0004)

Definition at line 46 of file bigdecimal.h.

Referenced by AddExponent(), BigDecimal_mode(), Init_bigdecimal(), and VpException().

#define VP_EXCEPTION_ZERODIVIDE ((unsigned short)0x0010)

Definition at line 48 of file bigdecimal.h.

Referenced by BigDecimal_mode(), Init_bigdecimal(), VpDivd(), and VpException().

#define VP_EXPORT static

Definition at line 35 of file bigdecimal.h.

#define VP_ROUND_CEIL 5

Definition at line 60 of file bigdecimal.h.

Referenced by BigDecimal_ceil(), Init_bigdecimal(), VpInternalRound(), VpIsRoundMode(), and VpMidRound().

#define VP_ROUND_DOWN 2

Definition at line 57 of file bigdecimal.h.

Referenced by BigDecimal_divremain(), BigDecimal_DoDivmod(), BigDecimal_fix(), BigDecimal_truncate(), Init_bigdecimal(), VpInternalRound(), VpIsRoundMode(), and VpMidRound().

#define VP_ROUND_FLOOR 6

Definition at line 61 of file bigdecimal.h.

Referenced by BigDecimal_floor(), Init_bigdecimal(), VpInternalRound(), VpIsRoundMode(), and VpMidRound().

#define VP_ROUND_HALF_DOWN 4

Definition at line 59 of file bigdecimal.h.

Referenced by Init_bigdecimal(), VpInternalRound(), VpIsRoundMode(), and VpMidRound().

#define VP_ROUND_HALF_EVEN 7

Definition at line 62 of file bigdecimal.h.

Referenced by Init_bigdecimal(), VpInternalRound(), VpIsRoundMode(), and VpMidRound().

#define VP_ROUND_HALF_UP 3

Definition at line 58 of file bigdecimal.h.

Referenced by Init_bigdecimal(), VpInternalRound(), VpIsRoundMode(), and VpMidRound().

#define VP_ROUND_MODE ((unsigned short)0x0100)

Definition at line 55 of file bigdecimal.h.

Referenced by BigDecimal_mode(), and Init_bigdecimal().

#define VP_ROUND_UP 1

Definition at line 56 of file bigdecimal.h.

Referenced by Init_bigdecimal(), VpInternalRound(), VpIsRoundMode(), and VpMidRound().

#define VP_SIGN_NaN 0

Definition at line 64 of file bigdecimal.h.

Referenced by Init_bigdecimal().

#define VP_SIGN_NEGATIVE_FINITE -2

Definition at line 68 of file bigdecimal.h.

Referenced by Init_bigdecimal().

#define VP_SIGN_NEGATIVE_INFINITE -3

Definition at line 70 of file bigdecimal.h.

Referenced by Init_bigdecimal().

#define VP_SIGN_NEGATIVE_ZERO -1

Definition at line 66 of file bigdecimal.h.

Referenced by Init_bigdecimal().

#define VP_SIGN_POSITIVE_FINITE 2

Definition at line 67 of file bigdecimal.h.

Referenced by Init_bigdecimal().

#define VP_SIGN_POSITIVE_INFINITE 3

Definition at line 69 of file bigdecimal.h.

Referenced by Init_bigdecimal().

#define VP_SIGN_POSITIVE_ZERO 1

Definition at line 65 of file bigdecimal.h.

Referenced by Init_bigdecimal().

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

Definition at line 182 of file bigdecimal.h.

Referenced by BigDecimal_abs(), and VpSqrt().

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

Definition at line 211 of file bigdecimal.h.

Referenced by VpLeftRound().

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

Definition at line 175 of file bigdecimal.h.

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

Definition at line 180 of file bigdecimal.h.

Referenced by AddExponent(), BigDecimal_add(), BigDecimal_DoDivmod(), BigDecimal_sub(), BigDecimal_to_i(), BigDecimal_to_r(), VpAddSub(), VpAsgn(), VpComp(), VpDivd(), VpFrac(), VpInternalRound(), VpIsDefOP(), VpMidRound(), VpMult(), VpNmlz(), VpPower(), VpSqrt(), VpSzMantissa(), VpToFString(), VpToString(), and VpVtoD().

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

Definition at line 209 of file bigdecimal.h.

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

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

Definition at line 205 of file bigdecimal.h.

Referenced by BigDecimal_power(), GetAddSubPrec(), VpComp(), VpNmlz(), and VpNumOfChars().

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

Definition at line 204 of file bigdecimal.h.

Referenced by BigDecimal_DoDivmod(), BigDecimal_IsFinite(), VpAsgn(), VpIsDefOP(), and VpPower().

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

Definition at line 198 of file bigdecimal.h.

Referenced by BigDecimal_add(), BigDecimal_check_num(), BigDecimal_DoDivmod(), BigDecimal_IsFinite(), BigDecimal_IsNaN(), BigDecimal_sub(), ToValue(), VpAsgn(), VpComp(), VpIsDefOP(), VpPower(), VpSzMantissa(), VpToSpecialString(), and VpVtoD().

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

Definition at line 203 of file bigdecimal.h.

Referenced by BigDecimal_check_num(), BigDecimal_IsInfinite(), ToValue(), VpSzMantissa(), VpToSpecialString(), and VpVtoD().

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

Definition at line 191 of file bigdecimal.h.

Referenced by VpVtoD().

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

Definition at line 210 of file bigdecimal.h.

Referenced by VpDivd(), VpMult(), and VpSqrt().

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

Definition at line 202 of file bigdecimal.h.

Referenced by BigDecimal_check_num(), BigDecimal_IsInfinite(), ToValue(), VpPower(), VpSzMantissa(), VpToSpecialString(), and VpVtoD().

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

Definition at line 190 of file bigdecimal.h.

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

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

Definition at line 192 of file bigdecimal.h.

Referenced by BigDecimal_DoDivmod(), BigDecimal_nonzero(), BigDecimal_zero(), VpAddSub(), VpAsgn(), VpComp(), VpDivd(), VpIsDefOP(), VpMult(), VpNmlz(), VpPower(), VpSqrt(), VpSzMantissa(), and VpToSpecialString().

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

Definition at line 173 of file bigdecimal.h.

Referenced by BigDecimal_dump(), and BigDecimal_inspect().

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

Definition at line 174 of file bigdecimal.h.

Referenced by BigDecimal_inspect().

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

Definition at line 208 of file bigdecimal.h.

Referenced by AddExponent(), BigDecimal_add(), BigDecimal_DoDivmod(), BigDecimal_sub(), VpAsgn(), VpCtoV(), VpDivd(), VpIsDefOP(), and VpPower().

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

Definition at line 199 of file bigdecimal.h.

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

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

Definition at line 207 of file bigdecimal.h.

Referenced by VpAlloc(), and VpDtoV().

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

Definition at line 194 of file bigdecimal.h.

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

Definition at line 187 of file bigdecimal.h.

Referenced by VpMidRound(), VpPower(), and VpSqrt().

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

Definition at line 206 of file bigdecimal.h.

Referenced by VpAlloc(), and VpDtoV().

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

Definition at line 193 of file bigdecimal.h.

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

Referenced by VpAddSub(), VpAsgn(), VpCtoV(), VpDivd(), VpDtoV(), VpFrac(), VpMidRound(), VpMult(), and VpPower().

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

Definition at line 195 of file bigdecimal.h.

Referenced by AddExponent(), VpAddSub(), VpAlloc(), VpAsgn(), VpCtoV(), VpDivd(), VpDtoV(), VpFrac(), VpIsDefOP(), VpMidRound(), VpMult(), VpNmlz(), and VpPower().

## Function Documentation

VP_EXPORT int VpActiveRound | ( | Real * | y,
|  | Real * | x,
|  | int | f,
|  | S_LONG | il
| ) |  |

Definition at line 4589 of file bigdecimal.c.

References VpAsgn(), and VpMidRound().

Referenced by BigDecimal_ceil(), BigDecimal_divremain(), BigDecimal_DoDivmod(), BigDecimal_fix(), BigDecimal_floor(), BigDecimal_round(), and BigDecimal_truncate().

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

Definition at line 2782 of file bigdecimal.c.

References BASE_FIG, Real::exponent, Real::frac, Min, Real::Prec, S_INT, U_LONG, VpAddAbs(), VpAsgn(), VpGetSign, VpInternalRound(), VpIsDefOP(), VpIsZero, VpSetSign, VpSetZero, and VpSubAbs().

Referenced by BigDecimal_add(), BigDecimal_divremain(), BigDecimal_DoDivmod(), BigDecimal_sub(), and VpSqrt().

VP_EXPORT Real* VpAlloc | ( | U_LONG | mx,
|  | const char * | szVal
| ) |  |

Definition at line 2589 of file bigdecimal.c.

References BASE_FIG, buf, ISDIGIT, ISSPACE, Max, Real::MaxPrec, ne, NULL, rb_str_resize(), rb_str_tmp_new(), RSTRING_PTR, StrCmp, SZ_INF, SZ_NaN, SZ_NINF, SZ_PINF, U_LONG, VpCtoV(), VpGetPrecLimit(), VpMemAlloc(), VpSetNaN, VpSetNegInf, VpSetPosInf, and VpSetZero.

Referenced by VpCreateRbObject(), VpInit(), VpMult(), VpNewRbClass(), VpPower(), and VpSqrt().

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

Definition at line 2740 of file bigdecimal.c.

References BASE_FIG, Real::exponent, Real::frac, Real::MaxPrec, Real::Prec, U_LONG, VpGetSign, VpInternalRound(), VpIsInf, VpIsNaN, VpIsZero, VpLimitRound(), VpSetInf, VpSetNaN, VpSetSign, and VpSetZero.

Referenced by BigDecimal_abs(), BigDecimal_neg(), VpActiveRound(), VpAddAbs(), VpAddSub(), VpDivd(), VpFrac(), VpMult(), VpPower(), VpSqrt(), and VpSubAbs().

VP_EXPORT U_LONG VpBaseFig | ( | void |  | ) |

Definition at line 2235 of file bigdecimal.c.

References BASE_FIG.

Referenced by BigDecimal_abs(), BigDecimal_add(), BigDecimal_ceil(), BigDecimal_div2(), BigDecimal_divide(), BigDecimal_divremain(), BigDecimal_DoDivmod(), BigDecimal_dump(), BigDecimal_fix(), BigDecimal_floor(), BigDecimal_frac(), BigDecimal_inspect(), BigDecimal_load(), BigDecimal_mult(), BigDecimal_neg(), BigDecimal_power(), BigDecimal_prec(), BigDecimal_round(), BigDecimal_sqrt(), BigDecimal_sub(), BigDecimal_to_i(), BigDecimal_truncate(), and GetVpValue().

VP_EXPORT U_LONG VpBaseVal | ( | void |  | ) |

Definition at line 2247 of file bigdecimal.c.

References BASE.

Referenced by BigDecimal_div(), and Init_bigdecimal().

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

Definition at line 3586 of file bigdecimal.c.

References Real::exponent, Real::frac, Real::Prec, Real::sign, U_LONG, VpGetSign, VpIsDef, VpIsNaN, and VpIsZero.

Referenced by BigDecimalCmp().

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

Definition at line 426 of file bigdecimal.c.

References Real::obj, rb_cBigDecimal, TypedData_Wrap_Struct, and VpAlloc().

Referenced by BigDecimal_abs(), BigDecimal_add(), BigDecimal_ceil(), BigDecimal_div2(), BigDecimal_divide(), BigDecimal_divremain(), BigDecimal_DoDivmod(), BigDecimal_fix(), BigDecimal_floor(), BigDecimal_frac(), BigDecimal_global_new(), BigDecimal_mult(), BigDecimal_neg(), BigDecimal_power(), BigDecimal_round(), BigDecimal_sqrt(), BigDecimal_sub(), BigDecimal_truncate(), and GetVpValue().

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

Definition at line 4010 of file bigdecimal.c.

References BASE_FIG, Real::exponent, Real::frac, Real::MaxPrec, ne, Real::Prec, rb_warn(), S_INT, S_LONG, U_LONG, VP_EXCEPTION_INFINITY, VpException(), VpNmlz(), VpSetInf, VpSetSign, VpSetZero, and zero().

Referenced by VpAlloc().

VP_EXPORT U_LONG VpDblFig | ( | void |  | ) |

Definition at line 2241 of file bigdecimal.c.

References DBLE_FIG.

Referenced by BigDecimal_double_fig(), and BigDecimal_sqrt().

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

Definition at line 3338 of file bigdecimal.c.

References AddExponent(), BASE, BASE_FIG, Real::exponent, Real::frac, Real::MaxPrec, Min, Real::Prec, rb_bug(), U_LONG, VP_EXCEPTION_NaN, VP_EXCEPTION_ZERODIVIDE, VpAsgn(), VpException(), VpGetSign, VpIsDefOP(), VpIsOne, VpIsZero, VpNmlz(), VpSetInf, VpSetNaN, VpSetSign, and VpSetZero.

Referenced by BigDecimal_div2(), BigDecimal_divide(), BigDecimal_divremain(), BigDecimal_DoDivmod(), VpPower(), and VpSqrt().

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

Definition at line 4223 of file bigdecimal.c.

References BASE, Real::exponent, Real::frac, isinf(), isnan, Real::MaxPrec, ne, Real::Prec, S_INT, U_LONG, VpInternalRound(), VpSetNaN, VpSetNegInf, VpSetPosInf, VpSetSign, and VpSetZero.

Referenced by VpSqrt().

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

Definition at line 2308 of file bigdecimal.c.

References gfDoException, rb_eFloatDomainError, rb_fatal(), rb_raise(), VP_EXCEPTION_INFINITY, VP_EXCEPTION_MEMORY, VP_EXCEPTION_NaN, VP_EXCEPTION_OP, VP_EXCEPTION_UNDERFLOW, and VP_EXCEPTION_ZERODIVIDE.

Referenced by AddExponent(), BigDecimal_check_num(), BigDecimal_to_f(), GetAddSubPrec(), ToValue(), VpCtoV(), VpDivd(), VpIsDefOP(), VpMemAlloc(), and VpSqrt().

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

Definition at line 3803 of file bigdecimal.c.

References BASE1, BASE_FIG, Real::exponent, Real::frac, S_LONG, U_LONG, and VpHasVal.

Referenced by BigDecimal_exponent(), BigDecimal_split(), BigDecimal_to_i(), and BigDecimal_to_r().

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

Definition at line 4674 of file bigdecimal.c.

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

Referenced by BigDecimal_divremain(), and BigDecimal_frac().

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

Definition at line 2138 of file bigdecimal.c.

References getchar, NULL, and xfree().

Referenced by BigDecimal_delete(), VpMult(), VpPower(), and VpSqrt().

VP_EXPORT double VpGetDoubleNaN | ( | void |  | ) |

Definition at line 2267 of file bigdecimal.c.

References Zero().

Referenced by VpInit(), and VpVtoD().

VP_EXPORT double VpGetDoubleNegInf | ( | void |  | ) |

Definition at line 2283 of file bigdecimal.c.

References One(), and Zero().

Referenced by BigDecimal_to_f(), VpGetDoubleNegZero(), VpInit(), and VpVtoD().

VP_EXPORT double VpGetDoubleNegZero | ( | void |  | ) |

Definition at line 2291 of file bigdecimal.c.

References One(), and VpGetDoubleNegInf().

Referenced by VpInit(), and VpVtoD().

VP_EXPORT double VpGetDoublePosInf | ( | void |  | ) |

Definition at line 2275 of file bigdecimal.c.

References One(), and Zero().

Referenced by BigDecimal_to_f(), VpInit(), and VpVtoD().

VP_EXPORT U_LONG VpGetPrecLimit | ( | void |  | ) |

Definition at line 2175 of file bigdecimal.c.

References gnPrecLimit.

Referenced by BigDecimal_limit(), VpAlloc(), and VpLimitRound().

VP_EXPORT unsigned long VpGetRoundMode | ( | void |  | ) |

Definition at line 2189 of file bigdecimal.c.

References gfRoundMode.

Referenced by BigDecimal_add2(), BigDecimal_div2(), BigDecimal_mode(), BigDecimal_mult2(), BigDecimal_round(), BigDecimal_sub2(), and VpLimitRound().

VP_EXPORT U_LONG VpInit | ( | U_LONG | BaseVal | ) |

Definition at line 2487 of file bigdecimal.c.

References BASE, BASE1, BASE_FIG, DBLE_FIG, HALF_BASE, U_LONG, VpAlloc(), VpGetDoubleNaN(), VpGetDoubleNegInf(), VpGetDoubleNegZero(), and VpGetDoublePosInf().

Referenced by Init_bigdecimal().

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

Definition at line 2195 of file bigdecimal.c.

References 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 BigDecimal_mode(), BigDecimal_round(), and VpSetRoundMode().

VP_EXPORT int VpLeftRound | ( | Real * | y,
|  | int | f,
|  | S_LONG | nf
| ) |  |

Definition at line 4574 of file bigdecimal.c.

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

Referenced by BigDecimal_add2(), BigDecimal_div2(), BigDecimal_mult2(), BigDecimal_sub2(), and VpLimitRound().

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

Definition at line 2124 of file bigdecimal.c.

References VP_EXCEPTION_MEMORY, VpException(), and xmalloc.

Referenced by VpAlloc().

VP_EXPORT int VpMidRound | ( | Real * | y,
|  | int | f,
|  | S_LONG | nf
| ) |  |

Definition at line 4465 of file bigdecimal.c.

References BASE, BASE_FIG, div, Real::exponent, Real::frac, Real::Prec, S_INT, S_LONG, U_LONG, 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, VpNmlz(), VpRdup(), VpSetOne, VpSetSign, and VpSetZero.

Referenced by VpActiveRound(), and VpLeftRound().

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

Definition at line 3211 of file bigdecimal.c.

References AddExponent(), BASE, BASE_FIG, Real::exponent, Real::frac, Real::MaxPrec, NULL, Real::Prec, U_LONG, VpAlloc(), VpAsgn(), VpFree(), VpGetSign, VpIsDefOP(), VpIsOne, VpIsZero, VpLimitRound(), VpNmlz(), VpSetSign, and VpSetZero.

Referenced by BigDecimal_divremain(), BigDecimal_DoDivmod(), BigDecimal_mult(), VpPower(), and VpSqrt().

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

Definition at line 418 of file bigdecimal.c.

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

Referenced by BigDecimal_load(), and BigDecimal_new().

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

Definition at line 2444 of file bigdecimal.c.

References BASE_FIG, Real::exponent, NULL, Real::Prec, S_INT, U_LONG, and VpIsDef.

Referenced by BigDecimal_dump(), BigDecimal_inspect(), BigDecimal_split(), BigDecimal_to_f(), and BigDecimal_to_s().

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

Definition at line 2539 of file bigdecimal.c.

References VpConstOne.

Referenced by BigDecimal_DoDivmod().

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

Definition at line 4719 of file bigdecimal.c.

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

Referenced by BigDecimal_power().

VP_EXPORT U_LONG VpSetPrecLimit | ( | U_LONG | n | ) |

Definition at line 2181 of file bigdecimal.c.

References gnPrecLimit, and U_LONG.

Referenced by BigDecimal_add2(), BigDecimal_ceil(), BigDecimal_div2(), BigDecimal_floor(), BigDecimal_limit(), BigDecimal_mult2(), BigDecimal_round(), BigDecimal_sub2(), and BigDecimal_truncate().

VP_EXPORT unsigned long VpSetRoundMode | ( | unsigned long | n | ) |

Definition at line 2206 of file bigdecimal.c.

References gfRoundMode, and VpIsRoundMode().

Referenced by BigDecimal_mode().

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

Definition at line 4356 of file bigdecimal.c.

References BASE, BASE_FIG, DBLE_FIG, Real::exponent, maxnr, Real::MaxPrec, Min, NULL, S_INT, S_LONG, U_LONG, VP_EXCEPTION_OP, VpAddSub(), VpAlloc(), VpAsgn(), VpChangeSign, VpDivd(), VpDtoV(), VpException(), VpFree(), VpGetSign, VpHasVal, VpIsOne, VpIsZero, VpMult(), VpSetNaN, VpSetOne, and VpVtoD().

Referenced by BigDecimal_sqrt().

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

Definition at line 3820 of file bigdecimal.c.

References BASE1, Real::frac, Real::Prec, SZ_INF, SZ_NaN, SZ_NINF, U_LONG, VpGetSign, VpIsNaN, VpIsNegInf, VpIsPosInf, VpIsPosZero, and VpIsZero.

Referenced by BigDecimal_split().

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

Definition at line 3945 of file bigdecimal.c.

References BASE, BASE1, BASE_FIG, Real::exponent, Real::frac, Real::Prec, S_LONG, U_LONG, VpFormatSt(), VpGetSign, and VpToSpecialString().

Referenced by BigDecimal_to_s().

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

Definition at line 3866 of file bigdecimal.c.

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

Referenced by VpToFString(), and VpToString().

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

Definition at line 3899 of file bigdecimal.c.

References BASE1, BASE_FIG, Real::exponent, Real::frac, Real::Prec, S_LONG, U_LONG, VpFormatSt(), VpGetSign, and VpToSpecialString().

Referenced by BigDecimal_dump(), BigDecimal_inspect(), BigDecimal_to_f(), and BigDecimal_to_s().

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

Definition at line 4159 of file bigdecimal.c.

References BASE, BASE_FIG, DBLE_FIG, div, Real::exponent, Real::frac, Min, Real::Prec, S_INT, U_LONG, VpGetDoubleNaN(), VpGetDoubleNegInf(), VpGetDoubleNegZero(), VpGetDoublePosInf(), VpGetSign, VpIsNaN, VpIsNegInf, VpIsNegZero, VpIsPosInf, and VpIsPosZero.

Referenced by BigDecimal_to_f(), and VpSqrt().