diff options
author | Jakob Kaivo <jkk@ung.org> | 2022-03-28 16:47:04 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2022-03-28 16:47:04 -0400 |
commit | b7220bcd1a054872e081afc77b305f0247bf3f98 (patch) | |
tree | 82b500fc7ebb49378f7737bdd2ad30744fd0f9fe /big.h | |
parent | 1ff08c03752688d8269d8d93113fcc74e6f52f02 (diff) |
group functions by funcionality
Diffstat (limited to 'big.h')
-rw-r--r-- | big.h | 51 |
1 files changed, 36 insertions, 15 deletions
@@ -22,29 +22,50 @@ #define getsmallint(x) (hd[x]&SIGNBIT?-digit0(x):digit(x)) #define stosmallint(x) make(INT,(x)<0?SIGNBIT|(-(x)):(x),0) -long long big_toll(word); +/* initialization */ +void bigsetup(void); + +/* convert between big int and long long */ word big_fromll(long long); +long long big_toll(word); + +/* convert between big int and double */ +word big_fromd(double); double big_tod(word); + +/* unary negation */ +word big_negate(word); + +/* compare two big ints */ +int big_compare(word, word); + +/* basic arithmetic */ +word big_add(word, word); +word big_subtract(word, word); +word big_multiply(word, word); +word big_divide(word, word); +word big_remainder(word, word); + +/* logarithms and exponentiation */ double big_log(word); double big_log10(word); -int big_compare(word,word); -word big_divide(word, word); -word big_remainder(word,word); -word big_negate(word); -word bigoscan(char *,char *); -word big_add(word,word); -word big_pow(word,word); -word bigscan(char *); -void bigsetup(void); -word big_subtract(word,word); -word big_multiply(word,word); +word big_pow(word, word); + +/* TODO: combine to make big_tostr(word big, int base) */ word bigtostr(word); word bigtostr8(word); word bigtostrx(word); -word bigxscan(char *,char *); -word big_fromd(double); + +/* TODO: rename big_fromstr() */ +word strtobig(word, int); + +/* TODO: combine to make big_scan(char *, ?char*?, int base) */ +word bigscan(char *); +word bigoscan(char *, char *); +word bigxscan(char *, char *); + +/* TODO: better name and documentation */ int isnat(word); -word strtobig(word,int); #define force_dbl(x) ((tag[(x)] == INT) ? big_tod((x)) : get_dbl((x))) |