summaryrefslogtreecommitdiff
path: root/big.h
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2022-03-28 16:47:04 -0400
committerJakob Kaivo <jkk@ung.org>2022-03-28 16:47:04 -0400
commitb7220bcd1a054872e081afc77b305f0247bf3f98 (patch)
tree82b500fc7ebb49378f7737bdd2ad30744fd0f9fe /big.h
parent1ff08c03752688d8269d8d93113fcc74e6f52f02 (diff)
group functions by funcionality
Diffstat (limited to 'big.h')
-rw-r--r--big.h51
1 files changed, 36 insertions, 15 deletions
diff --git a/big.h b/big.h
index 760944d..9eb1406 100644
--- a/big.h
+++ b/big.h
@@ -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)))