shithub: femtolisp

Download patch

ref: 73063b8a1eb2647abff04cd4af49d04239a5222a
parent: 267698bd3be39d182fa974697e3c34ec23dcefd7
author: mag <mag-one@autistici.org>
date: Fri Jun 23 12:26:24 EDT 2023

new bignum? implementation

--- a/builtins.c
+++ b/builtins.c
@@ -226,8 +226,7 @@
 {
 	argcount(nargs, 1);
 	value_t v = args[0];
-	return ((! isfixnum(v)) ||
-			(iscprim(v) && cp_numtype((cprim_t*)ptr(v)) < T_FLOAT)) ?
+	return (iscvalue(v) && cp_numtype((cprim_t*)ptr(v)) == T_MPINT) ?
 		FL_T : FL_F;
 }
 
--- a/test/unittest.lsp
+++ b/test/unittest.lsp
@@ -86,7 +86,7 @@
 (assert (> 0x10000000000000000 0x8fffffffffffffff))
 (assert (< 0x8fffffffffffffff 0x10000000000000000))
 
-(assert (bignum? (ash 2 60)))
+(assert ((not bignum? (ash 2 60))))
 (assert (not (bignum? (- (ash 2 60) 1))))
 (assert (bignum? 1606938044258990275541962092341162602522202993782792835301376))
 (assert (bignum? 0xfffffffffffffffff))