cptypes: add suport for bignum?

This commit is contained in:
Gustavo Massaccesi 2020-11-18 09:45:37 -03:00
parent 3b7378f071
commit cdfa80bde9
2 changed files with 9 additions and 2 deletions

View File

@ -548,7 +548,8 @@
(test-chain '((lambda (x) (eq? x 0)) fixnum? #;exact-integer? real? number?)) (test-chain '((lambda (x) (eq? x 0)) fixnum? #;exact-integer? real? number?))
(test-chain* '(fixnum? integer? real?)) (test-chain* '(fixnum? integer? real?))
(test-chain* '(fixnum? exact? number?)) ; exact? may raise an error (test-chain* '(fixnum? exact? number?)) ; exact? may raise an error
(test-chain* '((lambda (x) (eq? x (expt 256 100))) real? number?)) ; bignum? (test-chain* '(bignum? exact? number?)) ; exact? may raise an error
(test-chain* '((lambda (x) (eq? x (expt 256 100))) bignum? real? number?))
(test-chain '((lambda (x) (eqv? 0.0 x)) flonum? real? number?)) (test-chain '((lambda (x) (eqv? 0.0 x)) flonum? real? number?))
(test-chain '(gensym? symbol?)) (test-chain '(gensym? symbol?))
(test-chain '(not boolean?)) (test-chain '(not boolean?))

View File

@ -462,7 +462,7 @@ Notes:
(predicate-implies? y t))) (predicate-implies? y t)))
'(char null-or-pair $record '(char null-or-pair $record
gensym uninterned-symbol interned-symbol symbol gensym uninterned-symbol interned-symbol symbol
fixnum exact-integer flonum real number fixnum bignum exact-integer flonum real number
boolean true ptr))] ; ensure they are order from more restrictive to less restrictive boolean true ptr))] ; ensure they are order from more restrictive to less restrictive
[else #f])) [else #f]))
@ -573,6 +573,7 @@ Notes:
[box? 'box] [box? 'box]
[$record? '$record] [$record? '$record]
[fixnum? 'fixnum] [fixnum? 'fixnum]
[bignum? 'bignum]
[flonum? 'flonum] [flonum? 'flonum]
[real? 'real] [real? 'real]
[number? 'number] [number? 'number]
@ -619,6 +620,7 @@ Notes:
[box 'box] [box 'box]
[$record '$record] [$record '$record]
[fixnum 'fixnum] [fixnum 'fixnum]
[bignum 'bignum]
[flonum 'flonum] [flonum 'flonum]
[real 'real] [real 'real]
[number 'number] [number 'number]
@ -716,16 +718,20 @@ Notes:
[(null-or-pair) (or (eq? x 'pair) [(null-or-pair) (or (eq? x 'pair)
(check-constant-is? x null?))] (check-constant-is? x null?))]
[(fixnum) (check-constant-is? x target-fixnum?)] [(fixnum) (check-constant-is? x target-fixnum?)]
[(bignum) (check-constant-is? x target-bignum?)]
[(exact-integer) [(exact-integer)
(or (eq? x 'fixnum) (or (eq? x 'fixnum)
(eq? x 'bignum)
(check-constant-is? x (lambda (x) (and (integer? x) (check-constant-is? x (lambda (x) (and (integer? x)
(exact? x)))))] (exact? x)))))]
[(flonum) (check-constant-is? x flonum?)] [(flonum) (check-constant-is? x flonum?)]
[(real) (or (eq? x 'fixnum) [(real) (or (eq? x 'fixnum)
(eq? x 'bignum)
(eq? x 'exact-integer) (eq? x 'exact-integer)
(eq? x 'flonum) (eq? x 'flonum)
(check-constant-is? x real?))] (check-constant-is? x real?))]
[(number) (or (eq? x 'fixnum) [(number) (or (eq? x 'fixnum)
(eq? x 'bignum)
(eq? x 'exact-integer) (eq? x 'exact-integer)
(eq? x 'flonum) (eq? x 'flonum)
(eq? x 'real) (eq? x 'real)