diff options
author | unknown <hf@deer.(none)> | 2005-02-09 02:50:45 +0400 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2005-02-09 02:50:45 +0400 |
commit | 91db48e35a57421c00f65d5ce82e84b843ceec22 (patch) | |
tree | 9631c72d46b0fd08479ad02de00e5846cd339cda /include/decimal.h | |
parent | 63bcbfc4339ae843dc367d08fff0760da4d484c3 (diff) | |
download | mariadb-git-91db48e35a57421c00f65d5ce82e84b843ceec22.tar.gz |
Precision Math implementation
BitKeeper/etc/ignore:
Added client/decimal.c client/my_decimal.cc client/my_decimal.h to the ignore list
Diffstat (limited to 'include/decimal.h')
-rw-r--r-- | include/decimal.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/decimal.h b/include/decimal.h index 4d1fbfddc01..1e0ee97c267 100644 --- a/include/decimal.h +++ b/include/decimal.h @@ -26,7 +26,9 @@ typedef struct st_decimal { decimal_digit *buf; } decimal; -int decimal2string(decimal *from, char *to, int *to_len); +int decimal2string(decimal *from, char *to, int *to_len, + int fixed_precision, int fixed_decimals, + char filler); int string2decimal(char *from, decimal *to, char **end); int string2decimal_fixed(char *from, decimal *to, char **end); int decimal2ulonglong(decimal *from, ulonglong *to); @@ -35,6 +37,7 @@ int decimal2longlong(decimal *from, longlong *to); int longlong2decimal(longlong from, decimal *to); int decimal2double(decimal *from, double *to); int double2decimal(double from, decimal *to); +void decimal_optimize_fraction(decimal *from); int decimal2bin(decimal *from, char *to, int precision, int scale); int bin2decimal(char *from, decimal *to, int precision, int scale); @@ -50,6 +53,7 @@ int decimal_div(decimal *from1, decimal *from2, decimal *to, int scale_incr); int decimal_mod(decimal *from1, decimal *from2, decimal *to); int decimal_round(decimal *from, decimal *to, int new_scale, decimal_round_mode mode); int decimal_is_zero(decimal *from); +void max_decimal(int precision, int frac, decimal *to); /* set a decimal to zero */ @@ -65,7 +69,8 @@ int decimal_is_zero(decimal *from); of the decimal (including decimal dot, possible sign and \0) */ -#define decimal_string_size(dec) ((dec)->intg + (dec)->frac + ((dec)->frac > 0) + 2) +#define decimal_string_size(dec) (((dec)->intg ? (dec)->intg : 1) + \ + (dec)->frac + ((dec)->frac > 0) + 2) /* negate a decimal */ #define decimal_neg(dec) do { (dec)->sign^=1; } while(0) |