Home | History | Annotate | Download | only in dist

Lines Matching refs:Decimal

14 **   ext/misc/decimal.c
4428 ** in the prefix is the minimum-length decimal
4437 ** in the prefix is the minimum-length decimal
5671 ** signs are ignored. Decimal points and exponential notation
5743 /************************* Begin ext/misc/decimal.c ******************/
5756 ** Routines to implement arbitrary-precision decimal math.
5781 /* A decimal object */
5782 typedef struct Decimal Decimal;
5783 struct Decimal {
5789 int nFrac; /* Number of digits to the right of the decimal point */
5794 ** Release memory held by a Decimal, but do not free the object itself.
5796 static void decimal_clear(Decimal *p){
5801 ** Destroy a Decimal object
5803 static void decimal_free(Decimal *p){
5811 ** Allocate a new Decimal object initialized to the text in zIn[].
5814 static Decimal *decimalNewFromText(const char *zIn, int n){
5815 Decimal *p = 0;
5926 static Decimal *decimalFromDouble(double);
5929 ** Allocate a new Decimal object from an sqlite3_value. Return a pointer
5934 ** directly into a Decimal. For SQLITE_FLOAT or for SQLITE_BLOB of length
5935 ** 8 bytes, the resulting double value is expanded into its decimal equivalent.
5939 static Decimal *decimal_new(
5941 sqlite3_value *pIn, /* Construct the decimal object from this */
5944 Decimal *p = 0;
5993 ** Make the given Decimal the result.
5995 static void decimal_result(sqlite3_context *pCtx, Decimal *p){
6046 ** Round a decimal value to N significant digits. N must be positive.
6048 static void decimal_round(Decimal *p, int N){
6072 ** Make the given Decimal the result in an format similar to '%+#e'.
6076 static void decimal_result_sci(sqlite3_context *pCtx, Decimal *p, int N){
6081 int nFrac; /* Digits to the right of the decimal point */
6134 ** Compare to Decimal objects. Return negative, 0, or positive if the
6144 static int decimal_cmp(Decimal *pA, Decimal *pB){
6158 Decimal *pTemp = pA;
6187 Decimal *pA = 0, *pB = 0;
6205 ** Expand the Decimal so that it has a least nDigit digits and nFrac
6206 ** digits to the right of the decimal point.
6208 static void decimal_expand(Decimal *p, int nDigit, int nFrac){
6240 static void decimal_add(Decimal *pA, Decimal *pB){
6308 ** All significant digits after the decimal point are retained.
6309 ** Trailing zeros after the decimal point are omitted as long as
6310 ** the number of digits after the decimal point is no less than
6313 static void decimalMul(Decimal *pA, Decimal *pB){
6364 ** Create a new Decimal object that contains an integer power of 2.
6366 static Decimal *decimalPow2(int N){
6367 Decimal *pA = 0; /* The result to be returned */
6368 Decimal *pX = 0; /* Multiplier */
6399 ** Use an IEEE754 binary64 ("double") to generate a new Decimal object.
6401 static Decimal *decimalFromDouble(double r){
6405 Decimal *pA;
6406 Decimal *pX;
6447 ** SQL Function: decimal(X)
6450 ** Convert input X into decimal and then back into text.
6452 ** If X is originally a float, then a full decimal expansion of that floating
6457 ** decimal(X) returns a complete decimal, without the e+NNN at the end.
6464 Decimal *p = decimal_new(context, argv[0], 0);
6483 ** Compare text in decimal order.
6492 Decimal *pA = decimalNewFromText((const char*)zA, nKey1);
6493 Decimal *pB = decimalNewFromText((const char*)zB, nKey2);
6518 Decimal *pA = decimal_new(context, argv[0], 1);
6519 Decimal *pB = decimal_new(context, argv[1], 1);
6531 Decimal *pA = decimal_new(context, argv[0], 1);
6532 Decimal *pB = decimal_new(context, argv[1], 1);
6545 ** Works like sum() except that it uses decimal arithmetic for unlimited
6553 Decimal *p;
6554 Decimal *pArg;
6579 Decimal *p;
6580 Decimal *pArg;
6591 Decimal *p = sqlite3_aggregate_context(context, 0);
6596 Decimal *p = sqlite3_aggregate_context(context, 0);
6612 Decimal *pA = decimal_new(context, argv[0], 1);
6613 Decimal *pB = decimal_new(context, argv[1], 1);
6643 Decimal *pA = decimalPow2(sqlite3_value_int(argv[0]));
6664 { "decimal", 1, 0, decimalFunc },
6665 { "decimal", 2, 0, decimalFunc },
6691 rc = sqlite3_create_collation(db, "decimal", SQLITE_UTF8,
6697 /************************* End ext/misc/decimal.c ********************/
7504 ** EXACT DECIMAL REPRESENTATION OF BINARY64 VALUES
7507 ** This extension in combination with the separate 'decimal' extension
7508 ** can be used to compute the exact decimal representation of binary64
7523 ** Then, to compute the exact decimal representation of a floating