mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Print bignums
This commit is contained in:
parent
b9d6d5d873
commit
4ad41f6d5c
1 changed files with 13 additions and 0 deletions
13
runtime.c
13
runtime.c
|
@ -831,6 +831,19 @@ object Cyc_display(void *data, object x, FILE * port)
|
|||
}
|
||||
fprintf(port, ")");
|
||||
break;
|
||||
case bignum_tag: {
|
||||
int bufsz;
|
||||
char *buf;
|
||||
|
||||
// TODO: check return value
|
||||
mp_radix_size(&bignum_value(x), 10, &bufsz);
|
||||
|
||||
buf = alloca(bufsz);
|
||||
// TODO: check return value
|
||||
mp_toradix_n(&bignum_value(x), buf, 10, bufsz);
|
||||
fprintf(port, "%s", buf);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
fprintf(port, "Cyc_display: bad tag x=%d\n", ((closure) x)->tag);
|
||||
exit(1);
|
||||
|
|
Loading…
Add table
Reference in a new issue