Changeset 15571 in project
 Timestamp:
 08/26/09 05:57:41 (10 years ago)
 Location:
 release/4/numbers
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

release/4/numbers/numbers.scm
r11917 r15571 53 53 number? complex? real? rational? integer? 54 54 makerectangular makepolar realpart imagpart magnitude angle 55 bignum? ratnum? cflonum? rectnum? compnum? 55 bignum? ratnum? cflonum? rectnum? compnum? cintnum? cplxnum? 56 56 numbers:+ numbers: numbers:> numbers:< numbers:= 57 57 numbers:>= numbers:<=) … … 770 770 (switchq (%checknumber x) 771 771 (FIX #t) 772 (FLO (%flointeger? x)) 772 773 (BIG #t) 773 (FLO (%flointeger? x))774 774 (else #f) ) ) 775 775 … … 1407 1407 ;;; Nonstandard type procedures 1408 1408 1409 (define (bignum? x) 1409 (define (bignum? x) ; big number 1410 1410 (switchq (%checknumber x) 1411 1411 (BIG #t) 1412 1412 (else #f) ) ) 1413 1413 1414 (define (ratnum? x) 1414 (define (ratnum? x) ; ratio number 1415 1415 (switchq (%checknumber x) 1416 1416 (RAT #t) 1417 1417 (else #f) ) ) 1418 1418 1419 (define (cflonum? x) 1419 (define (cplxnum? x) ; complex number 1420 (switchq (%checknumber x) 1421 (COMP #t) 1422 (else #f) ) ) 1423 1424 (define (rectnum? x) ; "exact" complex number 1425 (define (%rectpart? x) 1426 #;(assert (and (not (eq? COMP (%checknumber x))) (not (eq? NONE (%checknumber x))))) 1427 (switchq (%checknumber x) 1428 (FLO (%flointeger? x)) 1429 (else #t) ) ) 1430 (switchq (%checknumber x) 1431 (COMP (and (%rectpart? (complexreal x)) (%rectpart? (compleximag x)))) 1432 (else #f) ) ) 1433 1434 (define (compnum? x) ; inexact complex number 1435 (switchq (%checknumber x) 1436 (COMP (and (%inexact? (complexreal x)) (%inexact? (compleximag x)))) 1437 (else #f) ) ) 1438 1439 (define (cintnum? x) ; integer number 1440 (switchq (%checknumber x) 1441 (FIX #t) 1442 (BIG #t) 1443 (FLO (%flointeger? x)) 1444 (COMP (and (%integer? (complexreal x)) (%integer? (compleximag x)))) 1445 (else #f) ) ) 1446 1447 (define (cflonum? x) ; floatingpoint number 1420 1448 (switchq (%checknumber x) 1421 1449 (FLO #t) 1422 (COMP ( %inexact? x))1450 (COMP (and (%flonum? (complexreal x)) (%flonum? (compleximag x)))) 1423 1451 (else #f) ) ) 1424 1452 1425 (define (rectnum? x)1426 (switchq (%checknumber x)1427 (COMP (%exact? x))1428 (else #f) ) )1429 1430 (define (compnum? x)1431 (switchq (%checknumber x)1432 (COMP (%inexact? x))1433 (else #f) ) )1434 1435 1453 ;;; What we provide 1436 1454 
release/4/numbers/numbers.setup
r11101 r15571 12 12 'numbers 13 13 '("numbers.so" "numbersstatic.o" "numbers.import.so") 14 `((version "1.80 7")14 `((version "1.808") 15 15 (static "numbersstatic.o") 16 16 (staticoptions "lgmp"))) 
release/4/numbers/tests/numberstest.scm
r11101 r15571 445 445 446 446 ) 447 448 (testeez 449 "nonstandard type procedures" 450 451 (test/eq "bignum" #t (bignum? b1)) 452 453 (test/eq "ratnum" #t (ratnum? r1)) 454 455 (test/eq "cplxnum: compintintnum" #t (cplxnum? c1)) 456 (test/eq "cplxnum: compintflointnum" #t (cplxnum? 1.0+1i)) 457 (test/eq "cplxnum: compflointnum" #t (cplxnum? c2)) 458 (test/eq "cplxnum: compfloflonum" #t (cplxnum? 3.44.3i)) 459 (test/eq "not cplxnum: fixnum" #f (cplxnum? 1)) 460 461 (test/eq "rectnum: compintintnum" #t (rectnum? c1)) 462 (test/eq "rectnum: compintflointnum" #t (rectnum? 1.0+1i)) 463 (test/eq "not rectnum: compflointum" #f (rectnum? c2)) 464 465 (test/eq "compnum: compfloflonum" #t (compnum? 3.44.3i)) 466 (test/eq "not compnum: compflointnum" #f (compnum? 1.0+1i)) 467 (test/eq "not compnum: compintintnum" #f (compnum? c1)) 468 469 (test/eq "cintnum: intflonum" #t (cintnum? 1.0)) 470 (test/eq "cintnum: fixnum" #t (cintnum? 3)) 471 (test/eq "cintnum: bignum" #t (cintnum? b1)) 472 (test/eq "cintnum: compintintnum" #t (cintnum? c1)) 473 474 (test/eq "cflonum: intflonum" #t (cflonum? 1.0)) 475 (test/eq "cflonum: flonum" #t (cflonum? 3.4)) 476 (test/eq "cflonum: compfloflonum" #t (cflonum? 3.44.3i)) 477 (test/eq "cflonum: compfloflonum" #f (cflonum? c2)) 478 479 )
Note: See TracChangeset
for help on using the changeset viewer.