Defines | Functions | Variables

ext/bigdecimal/bigdecimal.c File Reference

#include "ruby/ruby.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <float.h>
#include <math.h>
#include "bigdecimal.h"
Include dependency graph for bigdecimal.c:

Go to the source code of this file.

Defines

#define ENTER(n)   volatile VALUE vStack[n];int iStack=0
#define PUSH(x)   vStack[iStack++] = (unsigned long)(x);
#define SAVE(p)   PUSH(p->obj);
#define GUARD_OBJ(p, y)   {p=y;SAVE(p);}
#define DBLE_FIG   (DBL_DIG+1)
#define DoSomeOne(x, y, f)   rb_num_coerce_bin(x,y,f)
#define maxnr   100UL
#define MemCmp(x, y, z)   memcmp(x,y,z)
#define StrCmp(x, y)   strcmp(x,y)

Functions

static VALUE BigDecimal_version (VALUE self)
static unsigned short VpGetException (void)
static void VpSetException (unsigned short f)
static void VpInternalRound (Real *c, U_LONG ixDigit, U_LONG vPrev, U_LONG v)
static int VpLimitRound (Real *c, U_LONG ixDigit)
static void BigDecimal_delete (void *pv)
static size_t BigDecimal_memsize (const void *ptr)
static VALUE ToValue (Real *p)
static RealGetVpValue (VALUE v, int must)
static VALUE BigDecimal_double_fig (VALUE self)
static VALUE BigDecimal_prec (VALUE self)
static VALUE BigDecimal_hash (VALUE self)
static VALUE BigDecimal_dump (int argc, VALUE *argv, VALUE self)
static VALUE BigDecimal_load (VALUE self, VALUE str)
static VALUE BigDecimal_mode (int argc, VALUE *argv, VALUE self)
static U_LONG GetAddSubPrec (Real *a, Real *b)
static S_INT GetPositiveInt (VALUE v)
VP_EXPORT RealVpNewRbClass (U_LONG mx, char *str, VALUE klass)
VP_EXPORT RealVpCreateRbObject (U_LONG mx, const char *str)
static VALUE BigDecimal_IsNaN (VALUE self)
static VALUE BigDecimal_IsInfinite (VALUE self)
static VALUE BigDecimal_IsFinite (VALUE self)
static void BigDecimal_check_num (Real *p)
static VALUE BigDecimal_split (VALUE self)
static VALUE BigDecimal_to_i (VALUE self)
static VALUE BigDecimal_to_f (VALUE self)
static VALUE BigDecimal_to_r (VALUE self)
static VALUE BigDecimal_coerce (VALUE self, VALUE other)
static VALUE BigDecimal_uplus (VALUE self)
static VALUE BigDecimal_add (VALUE self, VALUE r)
static VALUE BigDecimal_sub (VALUE self, VALUE r)
static VALUE BigDecimalCmp (VALUE self, VALUE r, char op)
static VALUE BigDecimal_zero (VALUE self)
static VALUE BigDecimal_nonzero (VALUE self)
static VALUE BigDecimal_comp (VALUE self, VALUE r)
static VALUE BigDecimal_eq (VALUE self, VALUE r)
static VALUE BigDecimal_lt (VALUE self, VALUE r)
static VALUE BigDecimal_le (VALUE self, VALUE r)
static VALUE BigDecimal_gt (VALUE self, VALUE r)
static VALUE BigDecimal_ge (VALUE self, VALUE r)
static VALUE BigDecimal_neg (VALUE self)
static VALUE BigDecimal_mult (VALUE self, VALUE r)
static VALUE BigDecimal_divide (Real **c, Real **res, Real **div, VALUE self, VALUE r)
static VALUE BigDecimal_div (VALUE self, VALUE r)
static VALUE BigDecimal_DoDivmod (VALUE self, VALUE r, Real **div, Real **mod)
static VALUE BigDecimal_mod (VALUE self, VALUE r)
static VALUE BigDecimal_divremain (VALUE self, VALUE r, Real **dv, Real **rv)
static VALUE BigDecimal_remainder (VALUE self, VALUE r)
static VALUE BigDecimal_divmod (VALUE self, VALUE r)
static VALUE BigDecimal_div2 (int argc, VALUE *argv, VALUE self)
static VALUE BigDecimal_add2 (VALUE self, VALUE b, VALUE n)
static VALUE BigDecimal_sub2 (VALUE self, VALUE b, VALUE n)
static VALUE BigDecimal_mult2 (VALUE self, VALUE b, VALUE n)
static VALUE BigDecimal_abs (VALUE self)
static VALUE BigDecimal_sqrt (VALUE self, VALUE nFig)
static VALUE BigDecimal_fix (VALUE self)
static VALUE BigDecimal_round (int argc, VALUE *argv, VALUE self)
static VALUE BigDecimal_truncate (int argc, VALUE *argv, VALUE self)
static VALUE BigDecimal_frac (VALUE self)
static VALUE BigDecimal_floor (int argc, VALUE *argv, VALUE self)
static VALUE BigDecimal_ceil (int argc, VALUE *argv, VALUE self)
static VALUE BigDecimal_to_s (int argc, VALUE *argv, VALUE self)
static VALUE BigDecimal_exponent (VALUE self)
static VALUE BigDecimal_inspect (VALUE self)
static VALUE BigDecimal_power (VALUE self, VALUE p)
static VALUE BigDecimal_global_new (int argc, VALUE *argv, VALUE self)
static VALUE BigDecimal_new (int argc, VALUE *argv, VALUE self)
static VALUE BigDecimal_limit (int argc, VALUE *argv, VALUE self)
static VALUE BigDecimal_sign (VALUE self)
void Init_bigdecimal (void)
static int VpIsDefOP (Real *c, Real *a, Real *b, int sw)
static int AddExponent (Real *a, S_INT n)
static U_LONG VpAddAbs (Real *a, Real *b, Real *c)
static U_LONG VpSubAbs (Real *a, Real *b, Real *c)
static U_LONG VpSetPTR (Real *a, Real *b, Real *c, U_LONG *a_pos, U_LONG *b_pos, U_LONG *c_pos, U_LONG *av, U_LONG *bv)
static int VpNmlz (Real *a)
static void VpFormatSt (char *psz, S_INT fFmt)
static int VpRdup (Real *m, U_LONG ind_m)
VP_EXPORT void * VpMemAlloc (U_LONG mb)
VP_EXPORT void VpFree (Real *pv)
VP_EXPORT U_LONG VpGetPrecLimit (void)
VP_EXPORT U_LONG VpSetPrecLimit (U_LONG n)
VP_EXPORT unsigned long VpGetRoundMode (void)
VP_EXPORT int VpIsRoundMode (unsigned long n)
VP_EXPORT unsigned long VpSetRoundMode (unsigned long n)
static double Zero (void)
static double One (void)
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 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 RealVpOne (void)
VP_EXPORT RealVpAlloc (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 VpMidRound (Real *y, int f, S_LONG nf)
VP_EXPORT int VpLeftRound (Real *y, int f, S_LONG nf)
VP_EXPORT int VpActiveRound (Real *y, Real *x, int f, S_LONG nf)
VP_EXPORT void VpFrac (Real *y, Real *x)
VP_EXPORT int VpPower (Real *y, Real *x, S_INT n)

Variables

VALUE rb_cBigDecimal
static U_LONG BASE_FIG = 4
static U_LONG BASE = 10000L
static U_LONG HALF_BASE = 5000L
static U_LONG BASE1 = 1000L
static const rb_data_type_t BigDecimal_data_type
static U_LONG gnPrecLimit = 0
static U_LONG gfRoundMode = VP_ROUND_HALF_UP
static RealVpConstOne
static RealVpPt5
static unsigned short gfDoException = 0
volatile const double gZero_ABCED9B1_CE73__00400511F31D = 0.0
volatile const double gOne_ABCED9B4_CE73__00400511F31D = 1.0

Define Documentation

#define DBLE_FIG   (DBL_DIG+1)

Definition at line 57 of file bigdecimal.c.

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

#define DoSomeOne (   x,
  y,
  f 
)    rb_num_coerce_bin(x,y,f)
#define ENTER (   n  )     volatile VALUE vStack[n];int iStack=0
#define GUARD_OBJ (   p,
  y 
)    {p=y;SAVE(p);}
#define maxnr   100UL

Definition at line 2103 of file bigdecimal.c.

Referenced by VpSqrt().

#define MemCmp (   x,
  y,
  z 
)    memcmp(x,y,z)

Definition at line 2107 of file bigdecimal.c.

#define PUSH (   x  )     vStack[iStack++] = (unsigned long)(x);

Definition at line 38 of file bigdecimal.c.

#define SAVE (   p  )     PUSH(p->obj);
#define StrCmp (   x,
  y 
)    strcmp(x,y)

Definition at line 2108 of file bigdecimal.c.

Referenced by VpAlloc().


Function Documentation

static int AddExponent ( Real a,
S_INT  n 
) [static]
static VALUE BigDecimal_abs ( VALUE  self  )  [static]
static VALUE BigDecimal_add ( VALUE  self,
VALUE  r 
) [static]
static VALUE BigDecimal_add2 ( VALUE  self,
VALUE  b,
VALUE  n 
) [static]
static VALUE BigDecimal_ceil ( int  argc,
VALUE argv,
VALUE  self 
) [static]
static void BigDecimal_check_num ( Real p  )  [static]
static VALUE BigDecimal_coerce ( VALUE  self,
VALUE  other 
) [static]

Definition at line 600 of file bigdecimal.c.

References BigDecimal_to_f(), ENTER, GetVpValue(), GUARD_OBJ, Real::obj, rb_assoc_new(), T_FLOAT, and TYPE.

Referenced by Init_bigdecimal().

static VALUE BigDecimal_comp ( VALUE  self,
VALUE  r 
) [static]

Definition at line 755 of file bigdecimal.c.

References BigDecimalCmp().

Referenced by Init_bigdecimal().

static void BigDecimal_delete ( void *  pv  )  [static]

Definition at line 94 of file bigdecimal.c.

References VpFree().

static VALUE BigDecimal_div ( VALUE  self,
VALUE  r 
) [static]
static VALUE BigDecimal_div2 ( int  argc,
VALUE argv,
VALUE  self 
) [static]
static VALUE BigDecimal_divide ( Real **  c,
Real **  res,
Real **  div,
VALUE  self,
VALUE  r 
) [static]
static VALUE BigDecimal_divmod ( VALUE  self,
VALUE  r 
) [static]

Definition at line 1088 of file bigdecimal.c.

References BigDecimal_DoDivmod(), div, DoSomeOne, ENTER, mod, rb_assoc_new(), rb_intern, SAVE, and ToValue().

Referenced by Init_bigdecimal().

static VALUE BigDecimal_divremain ( VALUE  self,
VALUE  r,
Real **  dv,
Real **  rv 
) [static]
static VALUE BigDecimal_DoDivmod ( VALUE  self,
VALUE  r,
Real **  div,
Real **  mod 
) [static]
static VALUE BigDecimal_double_fig ( VALUE  self  )  [static]

Definition at line 194 of file bigdecimal.c.

References INT2FIX, and VpDblFig().

Referenced by Init_bigdecimal().

static VALUE BigDecimal_dump ( int  argc,
VALUE argv,
VALUE  self 
) [static]
static VALUE BigDecimal_eq ( VALUE  self,
VALUE  r 
) [static]

Definition at line 771 of file bigdecimal.c.

References BigDecimalCmp().

Referenced by Init_bigdecimal().

static VALUE BigDecimal_exponent ( VALUE  self  )  [static]

Definition at line 1622 of file bigdecimal.c.

References GetVpValue(), INT2NUM(), S_LONG, and VpExponent10().

Referenced by Init_bigdecimal().

static VALUE BigDecimal_fix ( VALUE  self  )  [static]
static VALUE BigDecimal_floor ( int  argc,
VALUE argv,
VALUE  self 
) [static]
static VALUE BigDecimal_frac ( VALUE  self  )  [static]
static VALUE BigDecimal_ge ( VALUE  self,
VALUE  r 
) [static]

Definition at line 819 of file bigdecimal.c.

References BigDecimalCmp().

Referenced by Init_bigdecimal().

static VALUE BigDecimal_global_new ( int  argc,
VALUE argv,
VALUE  self 
) [static]
static VALUE BigDecimal_gt ( VALUE  self,
VALUE  r 
) [static]

Definition at line 807 of file bigdecimal.c.

References BigDecimalCmp().

Referenced by Init_bigdecimal().

static VALUE BigDecimal_hash ( VALUE  self  )  [static]

Definition at line 222 of file bigdecimal.c.

References ENTER, Real::exponent, Real::frac, GetVpValue(), GUARD_OBJ, INT2FIX, Real::Prec, Real::sign, and U_LONG.

Referenced by Init_bigdecimal().

static VALUE BigDecimal_inspect ( VALUE  self  )  [static]
static VALUE BigDecimal_IsFinite ( VALUE  self  )  [static]

Definition at line 456 of file bigdecimal.c.

References GetVpValue(), VpIsInf, and VpIsNaN.

Referenced by Init_bigdecimal().

static VALUE BigDecimal_IsInfinite ( VALUE  self  )  [static]

Definition at line 446 of file bigdecimal.c.

References GetVpValue(), INT2FIX, VpIsNegInf, and VpIsPosInf.

Referenced by Init_bigdecimal().

static VALUE BigDecimal_IsNaN ( VALUE  self  )  [static]

Definition at line 435 of file bigdecimal.c.

References GetVpValue(), and VpIsNaN.

Referenced by Init_bigdecimal().

static VALUE BigDecimal_le ( VALUE  self,
VALUE  r 
) [static]

Definition at line 795 of file bigdecimal.c.

References BigDecimalCmp().

Referenced by Init_bigdecimal().

static VALUE BigDecimal_limit ( int  argc,
VALUE argv,
VALUE  self 
) [static]
static VALUE BigDecimal_load ( VALUE  self,
VALUE  str 
) [static]
static VALUE BigDecimal_lt ( VALUE  self,
VALUE  r 
) [static]

Definition at line 783 of file bigdecimal.c.

References BigDecimalCmp().

Referenced by Init_bigdecimal().

static size_t BigDecimal_memsize ( const void *  ptr  )  [static]

Definition at line 100 of file bigdecimal.c.

References Real::MaxPrec.

static VALUE BigDecimal_mod ( VALUE  self,
VALUE  r 
) [static]

Definition at line 1005 of file bigdecimal.c.

References BigDecimal_DoDivmod(), div, DoSomeOne, ENTER, mod, SAVE, and ToValue().

Referenced by Init_bigdecimal().

static VALUE BigDecimal_mode ( int  argc,
VALUE argv,
VALUE  self 
) [static]
static VALUE BigDecimal_mult ( VALUE  self,
VALUE  r 
) [static]
static VALUE BigDecimal_mult2 ( VALUE  self,
VALUE  b,
VALUE  n 
) [static]
static VALUE BigDecimal_neg ( VALUE  self  )  [static]

Definition at line 825 of file bigdecimal.c.

References ENTER, GetVpValue(), GUARD_OBJ, Real::Prec, ToValue(), VpAsgn(), VpBaseFig(), and VpCreateRbObject().

Referenced by Init_bigdecimal().

static VALUE BigDecimal_new ( int  argc,
VALUE argv,
VALUE  self 
) [static]
static VALUE BigDecimal_nonzero ( VALUE  self  )  [static]

Definition at line 745 of file bigdecimal.c.

References GetVpValue(), Qnil, and VpIsZero.

Referenced by Init_bigdecimal().

static VALUE BigDecimal_power ( VALUE  self,
VALUE  p 
) [static]
static VALUE BigDecimal_prec ( VALUE  self  )  [static]

Definition at line 209 of file bigdecimal.c.

References ENTER, GetVpValue(), GUARD_OBJ, INT2NUM(), Real::MaxPrec, Real::Prec, rb_assoc_new(), and VpBaseFig().

Referenced by Init_bigdecimal().

static VALUE BigDecimal_remainder ( VALUE  self,
VALUE  r 
) [static]

Definition at line 1059 of file bigdecimal.c.

References BigDecimal_divremain(), and ToValue().

Referenced by Init_bigdecimal().

static VALUE BigDecimal_round ( int  argc,
VALUE argv,
VALUE  self 
) [static]
static VALUE BigDecimal_sign ( VALUE  self  )  [static]

Definition at line 1792 of file bigdecimal.c.

References GetVpValue(), INT2FIX, and Real::sign.

Referenced by Init_bigdecimal().

static VALUE BigDecimal_split ( VALUE  self  )  [static]
static VALUE BigDecimal_sqrt ( VALUE  self,
VALUE  nFig 
) [static]
static VALUE BigDecimal_sub ( VALUE  self,
VALUE  r 
) [static]
static VALUE BigDecimal_sub2 ( VALUE  self,
VALUE  b,
VALUE  n 
) [static]
static VALUE BigDecimal_to_f ( VALUE  self  )  [static]
static VALUE BigDecimal_to_i ( VALUE  self  )  [static]
static VALUE BigDecimal_to_r ( VALUE  self  )  [static]
static VALUE BigDecimal_to_s ( int  argc,
VALUE argv,
VALUE  self 
) [static]
static VALUE BigDecimal_truncate ( int  argc,
VALUE argv,
VALUE  self 
) [static]
static VALUE BigDecimal_uplus ( VALUE  self  )  [static]

Definition at line 615 of file bigdecimal.c.

Referenced by Init_bigdecimal().

static VALUE BigDecimal_version ( VALUE  self  )  [static]

Definition at line 72 of file bigdecimal.c.

References rb_str_new2().

Referenced by Init_bigdecimal().

static VALUE BigDecimal_zero ( VALUE  self  )  [static]

Definition at line 737 of file bigdecimal.c.

References GetVpValue(), Qtrue, and VpIsZero.

Referenced by Init_bigdecimal().

static VALUE BigDecimalCmp ( VALUE  self,
VALUE  r,
char  op 
) [static]
static U_LONG GetAddSubPrec ( Real a,
Real b 
) [static]
static S_INT GetPositiveInt ( VALUE  v  )  [static]
static Real* GetVpValue ( VALUE  v,
int  must 
) [static]
void Init_bigdecimal ( void   ) 

Definition at line 1903 of file bigdecimal.c.

References BigDecimal_abs(), BigDecimal_add(), BigDecimal_add2(), BigDecimal_ceil(), BigDecimal_coerce(), BigDecimal_comp(), BigDecimal_div(), BigDecimal_div2(), BigDecimal_divmod(), BigDecimal_double_fig(), BigDecimal_dump(), BigDecimal_eq(), BigDecimal_exponent(), BigDecimal_fix(), BigDecimal_floor(), BigDecimal_frac(), BigDecimal_ge(), BigDecimal_global_new(), BigDecimal_gt(), BigDecimal_hash(), BigDecimal_inspect(), BigDecimal_IsFinite(), BigDecimal_IsInfinite(), BigDecimal_IsNaN(), BigDecimal_le(), BigDecimal_limit(), BigDecimal_load(), BigDecimal_lt(), BigDecimal_mod(), BigDecimal_mode(), BigDecimal_mult(), BigDecimal_mult2(), BigDecimal_neg(), BigDecimal_new(), BigDecimal_nonzero(), BigDecimal_power(), BigDecimal_prec(), BigDecimal_remainder(), BigDecimal_round(), BigDecimal_sign(), BigDecimal_split(), BigDecimal_sqrt(), BigDecimal_sub(), BigDecimal_sub2(), BigDecimal_to_f(), BigDecimal_to_i(), BigDecimal_to_r(), BigDecimal_to_s(), BigDecimal_truncate(), BigDecimal_uplus(), BigDecimal_version(), BigDecimal_zero(), INT2FIX, rb_cBigDecimal, rb_cNumeric, rb_define_class(), rb_define_const(), rb_define_global_function(), rb_define_method(), rb_define_singleton_method(), S_INT, U_LONG, VP_EXCEPTION_ALL, VP_EXCEPTION_INFINITY, VP_EXCEPTION_NaN, VP_EXCEPTION_OVERFLOW, VP_EXCEPTION_UNDERFLOW, VP_EXCEPTION_ZERODIVIDE, VP_ROUND_CEIL, VP_ROUND_DOWN, VP_ROUND_FLOOR, VP_ROUND_HALF_DOWN, VP_ROUND_HALF_EVEN, VP_ROUND_HALF_UP, VP_ROUND_MODE, VP_ROUND_UP, VP_SIGN_NaN, VP_SIGN_NEGATIVE_FINITE, VP_SIGN_NEGATIVE_INFINITE, VP_SIGN_NEGATIVE_ZERO, VP_SIGN_POSITIVE_FINITE, VP_SIGN_POSITIVE_INFINITE, VP_SIGN_POSITIVE_ZERO, VpBaseVal(), and VpInit().

static double One ( void   )  [static]
static VALUE ToValue ( Real p  )  [static]
VP_EXPORT int VpActiveRound ( Real y,
Real x,
int  f,
S_LONG  nf 
)
static U_LONG VpAddAbs ( Real a,
Real b,
Real c 
) [static]

Definition at line 2910 of file bigdecimal.c.

References BASE, Real::frac, U_LONG, VpAsgn(), and VpSetPTR().

Referenced by VpAddSub().

VP_EXPORT U_LONG VpAddSub ( Real c,
Real a,
Real b,
int  operation 
)
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 VpBaseFig ( void   ) 
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 
)
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 U_LONG VpDblFig ( void   ) 

Definition at line 2241 of file bigdecimal.c.

Referenced by BigDecimal_double_fig(), and BigDecimal_sqrt().

VP_EXPORT U_LONG VpDivd ( Real c,
Real r,
Real a,
Real b 
)
VP_EXPORT void VpDtoV ( Real m,
double  d 
)
VP_EXPORT int VpException ( unsigned short  f,
const char *  str,
int  always 
)
VP_EXPORT S_LONG VpExponent10 ( Real a  ) 
static void VpFormatSt ( char *  psz,
S_INT  fFmt 
) [static]

Definition at line 3776 of file bigdecimal.c.

References ISSPACE, memmove(), S_INT, and U_LONG.

Referenced by VpToFString(), and VpToString().

VP_EXPORT void VpFrac ( Real y,
Real x 
)
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().

static unsigned short VpGetException ( void   )  [static]

Definition at line 2162 of file bigdecimal.c.

References gfDoException.

Referenced by BigDecimal_mode().

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   ) 
VP_EXPORT U_LONG VpInit ( U_LONG  BaseVal  ) 
static void VpInternalRound ( Real c,
U_LONG  ixDigit,
U_LONG  vPrev,
U_LONG  v 
) [static]
static int VpIsDefOP ( Real c,
Real a,
Real b,
int  sw 
) [static]
VP_EXPORT int VpIsRoundMode ( unsigned long  n  ) 
VP_EXPORT int VpLeftRound ( Real y,
int  f,
S_LONG  nf 
)
static int VpLimitRound ( Real c,
U_LONG  ixDigit 
) [static]
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 
)
VP_EXPORT U_LONG VpMult ( Real c,
Real a,
Real b 
)
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().

static int VpNmlz ( Real a  )  [static]
VP_EXPORT U_LONG VpNumOfChars ( Real vp,
const char *  pszFmt 
)
VP_EXPORT Real* VpOne ( void   ) 

Definition at line 2539 of file bigdecimal.c.

Referenced by BigDecimal_DoDivmod().

VP_EXPORT int VpPower ( Real y,
Real x,
S_INT  n 
)
static int VpRdup ( Real m,
U_LONG  ind_m 
) [static]

Definition at line 4649 of file bigdecimal.c.

References AddExponent(), BASE, Real::frac, Real::Prec, U_LONG, and VpNmlz().

Referenced by VpInternalRound(), and VpMidRound().

static void VpSetException ( unsigned short  f  )  [static]

Definition at line 2168 of file bigdecimal.c.

References gfDoException.

Referenced by BigDecimal_mode().

VP_EXPORT U_LONG VpSetPrecLimit ( U_LONG  n  ) 
static U_LONG VpSetPTR ( Real a,
Real b,
Real c,
U_LONG *  a_pos,
U_LONG *  b_pos,
U_LONG *  c_pos,
U_LONG *  av,
U_LONG *  bv 
) [static]

Definition at line 3116 of file bigdecimal.c.

References AddExponent(), Real::exponent, Real::frac, Max, Real::MaxPrec, Real::Prec, and U_LONG.

Referenced by VpAddAbs(), and VpSubAbs().

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 
)
static U_LONG VpSubAbs ( Real a,
Real b,
Real c 
) [static]

Definition at line 3002 of file bigdecimal.c.

References BASE, Real::frac, U_LONG, VpAsgn(), and VpSetPTR().

Referenced by VpAddSub().

VP_EXPORT void VpSzMantissa ( Real a,
char *  psz 
)
VP_EXPORT void VpToFString ( Real a,
char *  psz,
int  fFmt,
int  fPlus 
)
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 
)
VP_EXPORT int VpVtoD ( double *  d,
S_LONG *  e,
Real m 
)
static double Zero ( void   )  [static]

Variable Documentation

U_LONG BASE = 10000L [static]
U_LONG BASE1 = 1000L [static]
U_LONG BASE_FIG = 4 [static]
Initial value:
 {
    "BigDecimal",
    0, BigDecimal_delete, BigDecimal_memsize,
}

Definition at line 106 of file bigdecimal.c.

unsigned short gfDoException = 0 [static]

Definition at line 2159 of file bigdecimal.c.

Referenced by VpException(), VpGetException(), and VpSetException().

U_LONG gfRoundMode = VP_ROUND_HALF_UP [static]

Definition at line 2099 of file bigdecimal.c.

Referenced by VpGetRoundMode(), VpInternalRound(), and VpSetRoundMode().

U_LONG gnPrecLimit = 0 [static]

Definition at line 2098 of file bigdecimal.c.

Referenced by VpGetPrecLimit(), and VpSetPrecLimit().

volatile const double gOne_ABCED9B4_CE73__00400511F31D = 1.0

Definition at line 2221 of file bigdecimal.c.

Referenced by One().

volatile const double gZero_ABCED9B1_CE73__00400511F31D = 0.0

Definition at line 2220 of file bigdecimal.c.

Referenced by Zero().

U_LONG HALF_BASE = 5000L [static]

Definition at line 47 of file bigdecimal.c.

Referenced by VpInit().

Definition at line 32 of file bigdecimal.c.

Referenced by Init_bigdecimal(), and VpCreateRbObject().

Real* VpConstOne [static]

Definition at line 2101 of file bigdecimal.c.

Real* VpPt5 [static]

Definition at line 2102 of file bigdecimal.c.