Changeset 13653 in project


Ignore:
Timestamp:
03/10/09 09:48:20 (11 years ago)
Author:
Kon Lovett
Message:

Save.

Location:
release/4/number-limits
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • release/4/number-limits/tags/2.0.0/float-limits.scm

    r13573 r13653  
    66(declare
    77        (usual-integrations)
     8  (inline)
     9  (local)
    810  (number-type generic) )
    911
  • release/4/number-limits/tags/2.0.0/int-limits.scm

    r13573 r13653  
    66(declare
    77        (usual-integrations)
     8  (inline)
     9  (local)
    810        (number-type fixnum) )
    911
  • release/4/number-limits/trunk/float-limits.scm

    r13573 r13653  
    66(declare
    77        (usual-integrations)
     8  (inline)
     9  (local)
    810  (number-type generic) )
    911
     
    4244
    4345
    44 ;;;
     46;;; float-limits
    4547
    4648(module float-limits (;export
  • release/4/number-limits/trunk/int-limits.scm

    r13573 r13653  
    66(declare
    77        (usual-integrations)
     8  (inline)
     9  (local)
    810        (number-type fixnum) )
    911
     
    1921# define UNSIGNED_LONG_LONG_SIZE  -1
    2022#endif
     23
     24*define MOST_POSITIVE_INT32 ((int32_t)(0x7fffffffUL))
     25*define MOST_POSITIVE_INT64 ((int64_t)(0x7fffffffffffffffLL))
    2126<#
    2227
    2328
    24 ;;;
     29;;; int-limits
    2530
    2631(module int-limits (;export
    2732  ;
     33  machine-word-bits machine-word-precision
     34  maximum-unsigned-machine-word
     35  most-negative-machine-word most-positive-machine-word
     36  ;
    2837  unsigned-integer32-size
    2938  maximum-unsigned-integer32
     39  most-negative-integer32 most-positive-integer32
    3040  ;
    31   machine-word-bits
    32   machine-word-precision
    33   maximum-machine-word
    34   most-negative-machine-word
    35   most-positive-machine-word
     41  unsigned-integer64-size
     42  maximum-unsigned-integer64
     43  most-negative-integer64 most-positive-integer64
    3644  ;
    3745  char-size       unsigned-char-size
     
    4351(import scheme chicken foreign)
    4452
    45 ;;
    46 
    47 (define unsigned-integer32-size (foreign-value "sizeof( uint32_t )" unsigned-int))
    48 (define maximum-unsigned-integer32 (foreign-value "((uint32_t)(~0U))" unsigned-integer32))
    49 
    50 ;;
     53;; machine-word
    5154
    5255(define machine-word-bits (foreign-value "C_WORD_SIZE" int))
    5356(define machine-word-precision (foreign-value "(C_WORD_SIZE - 1)" int))
    54 (define maximum-machine-word (foreign-value "C_UWORD_MAX" unsigned-long))
     57(define maximum-unsigned-machine-word (foreign-value "C_UWORD_MAX" unsigned-long))
    5558(define most-negative-machine-word (foreign-value "C_WORD_MIN" long))
    5659(define most-positive-machine-word (foreign-value "C_WORD_MAX" long))
    5760
    58 ;;
     61;; integer32
     62
     63(define unsigned-integer32-size (foreign-value "sizeof( uint32_t )" int))
     64(define maximum-unsigned-integer32 (foreign-value "((uint32_t)(~0UL))" unsigned-integer32))
     65(define most-negative-integer32 (foreign-value "(-MOST_POSITIVE_INT32 - 1)" integer32))
     66(define most-positive-integer32 (foreign-value "MOST_POSITIVE_INT32" integer32))
     67
     68;; integer64
     69
     70(define unsigned-integer64-size (foreign-value "sizeof( uint64_t )" int))
     71(define maximum-unsigned-integer64 (foreign-value "((uint64_t)(~0ULL))" unsigned-integer64))
     72(define most-negative-integer64 (foreign-value "(-MOST_POSITIVE_INT64 - 1)" integer64))
     73(define most-positive-integer64 (foreign-value "MOST_POSITIVE_INT64" integer64))
     74
     75;; char
    5976
    6077(define unsigned-char-size (foreign-value "sizeof( unsigned char )" int))
    6178(define char-size (foreign-value "sizeof( unsigned char )" int))
    6279
     80;; short
     81
    6382(define unsigned-short-size (foreign-value "sizeof( unsigned short )" int))
    6483(define short-size (foreign-value "sizeof( unsigned short )" int))
     84
     85;; int
    6586
    6687(define unsigned-int-size (foreign-value "sizeof( unsigned int )" int))
    6788(define int-size (foreign-value "sizeof( unsigned int )" int))
    6889
     90;; long
     91
    6992(define unsigned-long-size (foreign-value "sizeof( unsigned long )" int))
    7093(define long-size (foreign-value "sizeof( unsigned long )" int))
     94
     95;; long-long
    7196
    7297(define unsigned-long-long-size (foreign-value "UNSIGNED_LONG_LONG_SIZE" int))
  • release/4/number-limits/trunk/tests/run.scm

    r13573 r13653  
    99#;(print "** long double " (if (fp= maximum-long-double maximum-long-double) "supported" "unsupported") " **")
    1010
     11(assert (fp= float-radix flonum-radix))
    1112(assert (fp= maximum-double maximum-flonum))
    1213(assert (fp= minimum-double minimum-flonum))
Note: See TracChangeset for help on using the changeset viewer.