Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Macros | Enumerations | Functions | Variables
bigdecimal.c File Reference
`#include "bigdecimal.h"`
`#include "ruby/util.h"`
`#include <assert.h>`
`#include <ctype.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <errno.h>`
`#include <math.h>`

Go to the source code of this file.

## Macros
#define | NDEBUG
#define | MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max)
#define | SIGNED_VALUE_MAX INTPTR_MAX
#define | SIGNED_VALUE_MIN INTPTR_MIN
#define | MUL_OVERFLOW_SIGNED_VALUE_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, SIGNED_VALUE_MIN, SIGNED_VALUE_MAX)
#define | ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
#define | PUSH(x) (vStack[iStack++] = (VALUE)(x))
#define | SAVE(p) PUSH((p)->obj)
#define | GUARD_OBJ(p, y) ((p)=(y), SAVE(p))
#define | BASE_FIG RMPD_COMPONENT_FIGURES
#define | BASE RMPD_BASE
#define | HALF_BASE (BASE/2)
#define | BASE1 (BASE/10)
#define | DBLE_FIG (DBL_DIG+1) /* figure of double */
#define | RRATIONAL_ZERO_P(x)
#define | RRATIONAL_NEGATIVE_P(x) RTEST(rb_funcall((x), '<', 1, INT2FIX(0)))
#define | RB_OBJ_CLASSNAME(obj) rb_obj_class(obj)
#define | RB_OBJ_STRING(obj) (obj)
#define | BIGDECIMAL_POSITIVE_P(bd) ((bd)->sign > 0)
#define | BIGDECIMAL_NEGATIVE_P(bd) ((bd)->sign < 0)
#define | DoSomeOne(x, y, f) rb_num_coerce_bin(x,y,f)
#define | VpAllocReal(prec) (Real *)VpMemAlloc(offsetof(Real, frac) + (prec) * sizeof(BDIGIT))
#define | VpReallocReal(ptr, prec) (Real *)VpMemRealloc((ptr), offsetof(Real, frac) + (prec) * sizeof(BDIGIT))
#define | BigMath_exp(x, n) BigMath_s_exp(rb_mBigMath, (x), (n))
#define | BigMath_log(x, n) BigMath_s_log(rb_mBigMath, (x), (n))
#define | is_positive(x) (!is_negative(x))
#define | maxnr 100UL /* Maximum iterations for calculating sqrt. */
#define | MemCmp(x, y, z) memcmp(x,y,z)
#define | StrCmp(x, y) strcmp(x,y)
#define | rmpd_set_thread_local_exception_mode(mode)
#define | rmpd_set_thread_local_precision_limit(limit)
#define | RMPD_PRECISION_LIMIT_DEFAULT ((size_t)0)
#define | rmpd_set_thread_local_rounding_mode(mode)

## Enumerations
enum | op_sw { OP_SW_ADD = 1, OP_SW_SUB, OP_SW_MULT, OP_SW_DIV }

## Functions
| NORETURN (static void cannot_be_coerced_into_BigDecimal(VALUE, VALUE))
VP_EXPORT Real * | VpNewRbClass (size_t mx, const char *str, VALUE klass)
VP_EXPORT Real * | VpCreateRbObject (size_t mx, const char *str)
void | Init_bigdecimal (void)
VP_EXPORT void * | VpMemAlloc (size_t mb)
VP_EXPORT void * | VpMemRealloc (void *ptr, size_t mb)
VP_EXPORT void | VpFree (Real *pv)
VP_EXPORT size_t | VpGetPrecLimit (void)
VP_EXPORT size_t | VpSetPrecLimit (size_t n)
VP_EXPORT unsigned short | VpGetRoundMode (void)
VP_EXPORT int | VpIsRoundMode (unsigned short n)
VP_EXPORT unsigned short | VpSetRoundMode (unsigned short n)
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 size_t | VpNumOfChars (Real *vp, const char *pszFmt)
VP_EXPORT size_t | VpInit (BDIGIT BaseVal)
VP_EXPORT Real * | VpOne (void)
Real * | rmpd_parse_special_string (const char *str)
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 | VpMidRound (Real *y, unsigned short f, ssize_t nf)
VP_EXPORT int | VpLeftRound (Real *y, unsigned short f, ssize_t nf)
VP_EXPORT int | VpActiveRound (Real *y, Real *x, 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)

## Variables
VALUE | rb_cBigDecimal
VALUE | rb_mBigMath
const volatile double | gOne_ABCED9B4_CE73__00400511F31D = 1.0

## Macro Definition Documentation

## ◆ BASE

#define BASE RMPD_BASE

Definition at line 74 of file bigdecimal.c.

## ◆ BASE1

#define BASE1 (BASE/10)

Definition at line 77 of file bigdecimal.c.

## ◆ BASE_FIG

#define BASE_FIG RMPD_COMPONENT_FIGURES

Definition at line 73 of file bigdecimal.c.

## ◆ BIGDECIMAL_NEGATIVE_P

#define BIGDECIMAL_NEGATIVE_P | ( |  | bd | ) | ((bd)->sign < 0)

Definition at line 131 of file bigdecimal.c.

## ◆ BIGDECIMAL_POSITIVE_P

#define BIGDECIMAL_POSITIVE_P | ( |  | bd | ) | ((bd)->sign > 0)

Definition at line 130 of file bigdecimal.c.

## ◆ BigMath_exp

#define BigMath_exp | ( |  | x,
|  |  | n
| ) |  | BigMath_s_exp(rb_mBigMath, (x), (n))

Definition at line 2176 of file bigdecimal.c.

## ◆ BigMath_log

#define BigMath_log | ( |  | x,
|  |  | n
| ) |  | BigMath_s_log(rb_mBigMath, (x), (n))

Definition at line 2177 of file bigdecimal.c.

## ◆ DBLE_FIG

#define DBLE_FIG (DBL_DIG+1) /* figure of double */

Definition at line 80 of file bigdecimal.c.

## ◆ DoSomeOne

#define DoSomeOne | ( |  | x,
|  |  | y,
|  |  | f
| ) |  | rb_num_coerce_bin(x,y,f)

Definition at line 136 of file bigdecimal.c.

## ◆ ENTER

#define ENTER | ( |  | n | ) | volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0

Definition at line 68 of file bigdecimal.c.

## ◆ GUARD_OBJ

#define GUARD_OBJ | ( |  | p,
|  |  | y
| ) |  | ((p)=(y), SAVE(p))

Definition at line 71 of file bigdecimal.c.

## ◆ HALF_BASE

#define HALF_BASE (BASE/2)

Definition at line 76 of file bigdecimal.c.

## ◆ is_positive

#define is_positive | ( |  | x | ) | (!is_negative(x))

Definition at line 2200 of file bigdecimal.c.

## ◆ maxnr

#define maxnr 100UL /* Maximum iterations for calculating sqrt. */

Definition at line 3547 of file bigdecimal.c.

## ◆ MemCmp

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

Definition at line 3551 of file bigdecimal.c.

## ◆ MUL_OVERFLOW_SIGNED_INTEGER_P

#define MUL_OVERFLOW_SIGNED_INTEGER_P | ( |  | a,
|  |  | b,
|  |  | min,
|  |  | max
| ) |  |

Value:
( \
(a) == 0 ? 0 : \
(a) == -1 ? (b) < -(max) : \
(a) > 0 ? \
((b) > 0 ? (max) / (a) < (b) : (min) / (a) > (b)) : \
((b) > 0 ? (min) / (a) < (b) : (max) / (a) > (b)))

Definition at line 35 of file bigdecimal.c.

## ◆ MUL_OVERFLOW_SIGNED_VALUE_P

#define MUL_OVERFLOW_SIGNED_VALUE_P | ( |  | a,
|  |  | b
| ) |  | MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, SIGNED_VALUE_MIN, SIGNED_VALUE_MAX)

Definition at line 43 of file bigdecimal.c.

## ◆ NDEBUG

#define NDEBUG

Definition at line 17 of file bigdecimal.c.

## ◆ PUSH

#define PUSH | ( |  | x | ) | (vStack[iStack++] = (VALUE)(x))

Definition at line 69 of file bigdecimal.c.

## ◆ RB_OBJ_CLASSNAME

#define RB_OBJ_CLASSNAME | ( |  | obj | ) | rb_obj_class(obj)

Definition at line 98 of file bigdecimal.c.

## ◆ RB_OBJ_STRING

#define RB_OBJ_STRING | ( |  | obj | ) | (obj)

Definition at line 99 of file bigdecimal.c.

## ◆ RMPD_PRECISION_LIMIT_DEFAULT

#define RMPD_PRECISION_LIMIT_DEFAULT ((size_t)0)

Definition at line 3660 of file bigdecimal.c.

## ◆ rmpd_set_thread_local_exception_mode

#define rmpd_set_thread_local_exception_mode | ( |  | mode | ) |

Value:
rb_thread_local_aset( \
rb_thread_current(), \
id_BigDecimal_exception_mode, \
INT2FIX((int)(mode)) \
)

Definition at line 3621 of file bigdecimal.c.

## ◆ rmpd_set_thread_local_precision_limit

#define rmpd_set_thread_local_precision_limit | ( |  | limit | ) |

Value:
rb_thread_local_aset( \
rb_thread_current(), \
id_BigDecimal_precision_limit, \
SIZET2NUM(limit) \
)

Definition at line 3654 of file bigdecimal.c.

## ◆ rmpd_set_thread_local_rounding_mode

#define rmpd_set_thread_local_rounding_mode | ( |  | mode | ) |

Value:
rb_thread_local_aset( \
rb_thread_current(), \
id_BigDecimal_rounding_mode, \
INT2FIX((int)(mode)) \
)

Definition at line 3691 of file bigdecimal.c.

## ◆ RRATIONAL_NEGATIVE_P

#define RRATIONAL_NEGATIVE_P | ( |  | x | ) | RTEST(rb_funcall((x), '<', 1, INT2FIX(0)))

Definition at line 89 of file bigdecimal.c.

## ◆ RRATIONAL_ZERO_P

#define RRATIONAL_ZERO_P | ( |  | x | ) |

Value:
(FIXNUM_P(rb_rational_num(x)) && \
FIX2LONG(rb_rational_num(x)) == 0)

Definition at line 84 of file bigdecimal.c.

## ◆ SAVE

#define SAVE | ( |  | p | ) | PUSH((p)->obj)

Definition at line 70 of file bigdecimal.c.

## ◆ SIGNED_VALUE_MAX

#define SIGNED_VALUE_MAX INTPTR_MAX

Definition at line 41 of file bigdecimal.c.

## ◆ SIGNED_VALUE_MIN

#define SIGNED_VALUE_MIN INTPTR_MIN

Definition at line 42 of file bigdecimal.c.

## ◆ StrCmp

#define StrCmp | ( |  | x,
|  |  | y
| ) |  | strcmp(x,y)

Definition at line 3552 of file bigdecimal.c.

## ◆ VpAllocReal

#define VpAllocReal | ( |  | prec | ) | (Real *)VpMemAlloc(offsetof(Real, frac) + (prec) * sizeof(BDIGIT))

Definition at line 660 of file bigdecimal.c.

## ◆ VpReallocReal

#define VpReallocReal | ( |  | ptr,
|  |  | prec
| ) |  | (Real *)VpMemRealloc((ptr), offsetof(Real, frac) + (prec) * sizeof(BDIGIT))

Definition at line 661 of file bigdecimal.c.

## Enumeration Type Documentation

## ◆ op_sw

enum op_sw

Enumerator
OP_SW_ADD |
OP_SW_SUB |
OP_SW_MULT |
OP_SW_DIV |

Definition at line 3554 of file bigdecimal.c.

## Function Documentation

## ◆ Init_bigdecimal()

void Init_bigdecimal | ( | void |  | ) |

Definition at line 3302 of file bigdecimal.c.

References arg.

## ◆ NORETURN()

NORETURN | ( | static void | cannot_be_coerced_into_BigDecimalVALUE, VALUE | ) |

## ◆ rmpd_parse_special_string()

Real* rmpd_parse_special_string | ( | const char * | str | ) |

Definition at line 4052 of file bigdecimal.c.

References i, ISSPACE, len, Real::MaxPrec, NULL, str, strncmp(), SZ_INF, SZ_NaN, SZ_NINF, SZ_PINF, UNREACHABLE, VP_SIGN_NaN, VP_SIGN_NEGATIVE_INFINITE, VP_SIGN_POSITIVE_INFINITE, VpAllocReal, VpSetNaN, VpSetNegInf, and VpSetPosInf.

Referenced by VpAlloc().

## ◆ VpActiveRound()

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

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,
|  | const char * | 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

## ◆ gOne_ABCED9B4_CE73__00400511F31D

const volatile double gOne_ABCED9B4_CE73__00400511F31D = 1.0

Definition at line 3751 of file bigdecimal.c.

## ◆ rb_cBigDecimal

VALUE rb_cBigDecimal

Definition at line 45 of file bigdecimal.c.

Referenced by VpCreateRbObject().

## ◆ rb_mBigMath

VALUE rb_mBigMath

Definition at line 46 of file bigdecimal.c.

INT2FIX
#define INT2FIX(i)
Definition: ruby.h:263
rb_thread_current
VALUE rb_thread_current(void)
Definition: thread.c:2676
FIXNUM_P
#define FIXNUM_P(f)
Definition: ruby.h:396
SIZET2NUM
#define SIZET2NUM(v)
Definition: ruby.h:295
rb_thread_local_aset
VALUE rb_thread_local_aset(VALUE, ID, VALUE)
Definition: thread.c:3364