Changeset 13562 in project for chicken/trunk/library.scm


Ignore:
Timestamp:
03/07/09 17:08:16 (11 years ago)
Author:
Kon Lovett
Message:

Added fixnum & flonum limit constants.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/library.scm

    r13304 r13562  
    4141#include <errno.h>
    4242#include <time.h>
     43#include <float.h>
    4344
    4445#ifdef HAVE_SYSEXITS_H
     
    733734;;; Numeric routines:
    734735
     736(define most-positive-fixnum (foreign-value "C_MOST_POSITIVE_FIXNUM" int))
     737(define most-negative-fixnum (foreign-value "C_MOST_NEGATIVE_FIXNUM" int))
     738(define fixnum-bits (foreign-value "(C_WORD_SIZE - 1)" int))
     739(define fixnum-precision (foreign-value "(C_WORD_SIZE - (1 + 1))" int))
     740
    735741(define (fixnum? x) (##core#inline "C_fixnump" x))
    736742(define (fx+ x y) (##core#inline "C_fixnum_plus" x y))
     
    769775    (fx-check-divison-by-zero x y 'fxmod)
    770776    (##core#inline "C_fixnum_modulo" x y) ] ) )
     777
     778(define maximum-flonum (foreign-value "DBL_MAX" double))
     779(define minimum-flonum (foreign-value "DBL_MIN" double))
     780(define flonum-radix (foreign-value "FLT_RADIX" int))
     781(define flonum-epsilon (foreign-value "DBL_EPSILON" double))
     782(define flonum-precision (foreign-value "DBL_MANT_DIG" int))
     783(define flonum-decimal-precision (foreign-value "DBL_DIG" int))
     784(define flonum-maximum-exponent (foreign-value "DBL_MAX_EXP" int))
     785(define flonum-minimum-exponent (foreign-value "DBL_MIN_EXP" int))
     786(define flonum-maximum-decimal-exponent (foreign-value "DBL_MAX_10_EXP" int))
     787(define flonum-minimum-decimal-exponent (foreign-value "DBL_MIN_10_EXP" int))
    771788
    772789(define (flonum? x) (##core#inline "C_i_flonump" x))
Note: See TracChangeset for help on using the changeset viewer.