summaryrefslogtreecommitdiff
path: root/libguile/numbers.h
AgeCommit message (Collapse)AuthorFilesLines
2004-05-06(SCM_I_BIG_MPZ): Use SCM_CELL_OBJECT_LOC instead of taking the addressMarius Vollmer1-1/+1
of SCM_CELL_WORD_1, the latter being no longer an lvalue.
2004-03-25(scm_modulo_expt): Renamed fromKevin Ryde1-1/+1
scm_modular_expt, matching scheme level name `modulo-expt'.
2004-03-25Add copyright years based on ChangeLog entries.Kevin Ryde1-1/+1
2004-03-252004-03-26 Eric Hanchrow <offby1@blarg.net>Kevin Ryde1-1/+2
* numbers.c, numbers.h (scm_modular_expt): New function.
2003-11-18* print.c (scm_iprin1): Handle fractions.Marius Vollmer1-1/+33
* objects.h (scm_class_fraction): New. * objects.c (scm_class_fraction): New. (scm_class_of): Handle fractions. * hash.c (scm_hasher): Handle fractions. * numbers.c: New code for handling fraction all over the place. (scm_odd_p, scm_even_p): Handle inexact integers. (scm_rational_p): New function, same as scm_real_p. (scm_round_number, scm_truncate_number, scm_ceiling, scm_floor): New exact functions that replace the inexact 'dsubr' implementations. (scm_numerator, scm_denominator): New. * numbers.h (SCM_NUMP): Recognize fractions. (SCM_FRACTIONP, SCM_SLOPPY_FRACTIONP, SCM_FRACTION_NUMERATOR, SCM_FRACTION_DENOMINATOR, SCM_FRACTION_SET_NUMERATOR, SCM_FRACTION_SET_DENOMINATOR, SCM_FRACTION_REDUCED_BIT, SCM_FRACTION_REDUCED_SET, SCM_FRACTION_REDUCED_CLEAR, SCM_FRACTION_REDUCED): New. (scm_floor, scm_ceiling, scm_truncate_number, scm_round_number): New prototypes. (scm_make_ratio, scm_rationalize, scm_numerator, scm_denominator, scm_rational_p): New prototypes. (scm_i_dbl2num, scm_i_fraction2double, scm_i_fraction_equalp, scm_i_print_fraction): New prototypes. * goops.c (create_standard_classes): Create "<fraction>" class. * gc-mark.c (scm_gc_mark_dependencies): Handle fractions. * gc-card.c (scm_i_sweep_card): Include scm_tc16_fraction as a case in the switch, but do nothing for now. * eval.c (SCM_CEVAL, SCM_APPLY, call_dsubr_1): Convert fractions to doubles when calling 'dsubr' functions. * eq.c (scm_eqv_p, scm_equal_p): Handle fractions.
2003-09-21 * numbers.h (SCM_INEXACTP): Removed uses of SCM_TYP16S.Dirk Herrmann1-2/+4
* tags.h, deprecated.h (SCM_TYP16S): Deprecated and moved from tags.h to deprecated.h.
2003-09-18 This set of patches introduces a new tc7 code scm_tc7_number forDirk Herrmann1-1/+11
numbers. Bignums, reals and complex numbers are turned from smobs into subtypes of scm_tc7_number. * tags.h (scm_tc7_number): New. * eq.c (scm_equal_p), eval.c (SCM_CEVAL), evalext.c (scm_self_evaluating_p), gc-card.c (scm_i_sweep_card), gc-mark.c (scm_gc_mark_dependencies), goops.c (create_smob_classes), hash.c (scm_hasher), numbers.c, numbers.h (SCM_NUMP), objects.c (scm_class_of), print.c (scm_iprin1), smob.c (scm_smob_prehistory): Don't handle bignums, reals and complex numbers as subtypes of scm_tc7_smob any more. * numbers.h, tags.h (scm_tc16_big, scm_tc16_real, scm_tc16_complex): Moved definitions from tags.h to numbers.h.
2003-09-06 * numbers.h (SCM_INEXACTP, SCM_REALP, SCM_COMPLEXP): Removed usesDirk Herrmann1-6/+3
of SCM_SLOPPY_INEXACTP, SCM_SLOPPY_REALP and SCM_SLOPPY_COMPLEXP. * numbers.h, deprecated.h (SCM_SLOPPY_INEXACTP, SCM_SLOPPY_REALP, SCM_SLOPPY_COMPLEXP): Deprecated and moved from numbers.h to deprecated.h.
2003-09-04 * numbers.h (SCM_MAKINUM): Define in terms of scm_tc2_int.Dirk Herrmann1-4/+5
(SCM_INEXACTP, SCM_REALP, SCM_COMPLEXP): Define in terms of the respective SLOPPY macro.
2003-05-302003-05-30 Stefan Jahn <stefan@lkcc.org>Stefan Jahn1-1/+6
* configure.in: Checking for unsetenv(). 2003-05-30 Stefan Jahn <stefan@lkcc.org> * posix.c (s_scm_putenv): Use the new HAVE_UNSETENV appropriately for mingw32 hosts. * numbers.h: Defining copysign(), isnan() and finite() to be prefixed by a single '_' for mingw32 hosts.
2003-04-16oops -- reverse accidental commit.Rob Browning1-1/+0
2003-04-16*** empty log message ***Rob Browning1-0/+1
2003-04-07* numbers.h: remove the gmp.h #include (not needed now).Rob Browning1-2/+0
2003-04-05Changed license terms to the plain LGPL thru-out.Marius Vollmer1-35/+11
2003-04-04* numbers.h: remove SCM_BIGDIG conditionals, reorganize, andRob Browning1-74/+30
rewrite to handle GMP bignums.
2003-03-27* numbers.h: fix various preprocessor usages of new publicRob Browning1-21/+23
symbols to expect 0 or 1 values rather than 1 or undefined. i.e. change #ifdef to #if, etc.
2003-03-25* numbers.h: replace usage of HAVE_FLOATINGPOINT_H withRob Browning1-10/+10
SCM_HAVE_FLOATINGPOINT_H. Replace usage of HAVE_IEEEFP_H with SCM_HAVE_IEEEFP_H. Replace usage of HAVE_NAN_H with SCM_HAVE_NAN_H. Replace usage of STDC_HEADERS with SCM_HAVE_STDC_HEADERS. Replace usage of ptrdiff_t with scm_t_ptrdiff. Replace usage of HAVE_LONG_LONGS with "SCM_SIZEOF_LONG_LONG != 0".
2002-05-06Conditionally include floatingpoint.h, ieeefp.h, and nan.h. ProvideMarius Vollmer1-0/+22
declarations for scm_inf_p, scm_nan_p, scn_inf, and scm_nan.
2001-11-25(SCM_MAKE_BIGNUM_TAG): New.Marius Vollmer1-4/+5
2001-11-072001-11-07 Stefan Jahn <stefan@lkcc.org>Stefan Jahn1-0/+4
* configure.in: Include `win32-socket.o' in the list of object files if networking is enabled on Win32. 2001-11-07 Stefan Jahn <stefan@lkcc.org> * win32-socket.[ch]: New files. Defines Winsock-API error codes and makes them available through Guile. That is because the Winsock-API does not store its errors in `errno' and thus cannot return error messages via `strerror (errno)'. * socket.c (scm_init_socket): Initialize `win32-socket' part here under M$-Windows. * numbers.h: Added missing declaration of `scm_sys_check_number_conversions()'. * error.c: Local definition of SCM_I_STRERROR and SCM_I_ERRNO and use in `(strerror)' and `(system-error)'. * Makefile.am (EXTRA_libguile_la_SOURCES): Added `win32-socket.[ch]' to extra source and header files.
2001-11-02Prefixed each each exported symbol with SCM_API.Marius Vollmer1-128/+128
2001-10-06Corrected definition of SCM_MOST_POSITIVE_FIXNUM. Boy was I confused.Marius Vollmer1-2/+7
2001-10-06* tags.h (SCM_T_BITS_MAX, SCM_T_SIGNED_BITS_MAX,Marius Vollmer1-7/+3
SCM_T_SIGNED_BITS_MIN): New. * numbers.h (SCM_MOST_POSITIVE_FIXNUM, SCM_MOST_NEGATIVE_FIXNUM): Use them to make these macros computable by the preprocessor.
2001-10-05* numbers.h: Removed old comment about using SCM_CAR to accessDirk Herrmann1-16/+13
non-pair cells. (SCM_MOST_POSITIVE_FIXNUM, SCM_MOST_NEGATIVE_FIXNUM): Make sure the return value is signed. Thanks to Brian Crowder for the bug report. (SCM_SRS): Avoid unnecessary casting and don't unpack input values. With this patch, SCM_SRS can be safely used for other types than scm_t_signed_bits. However, it should still better be an internal macro and thus be renamed to SCM_I_SRS. (SCM_MAKINUM, SCM_INUM): Use proper casting.
2001-09-23* validate.h (SCM_NUM2FLOAT, SCM_NUM2DOUBLE,Mikael Djurfeldt1-1/+8
SCM_VALIDATE_FLOAT_COPY, SCM_VALIDATE_DOUBLE_COPY): New macros. (The NUM names might soon change.) * numbers.h: Added missing declarations.
2001-08-31* Removed deprecated stuff.Dirk Herrmann1-27/+4
* Some more renamings to SCM_<filename>_H.
2001-07-30* Rewrote string->number stuff.Dirk Herrmann1-11/+9
2001-07-09Remove "face-lift" comment.Thien-Thi Nguyen1-2/+0
2001-06-14replace "scm_*_t" with "scm_t_*".Marius Vollmer1-8/+8
2001-06-14(SCM_SRS): Cast shiftee to scm_signed_bits_t.Marius Vollmer1-2/+2
(SCM_INUM): Cast result to scm_signed_bits_t.
2001-05-26revert the ill-considered part of the 2001-05-24 changesMichael Livshin1-11/+3
2001-05-24* validate.hMichael Livshin1-24/+86
(SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,BITS,UBITS,INT,UINT}[_DEF]): new macros. * unif.h: type renaming: scm_array -> scm_array_t scm_array_dim -> scm_array_dim_t the old names are deprecated, all in-Guile uses changed. * tags.h (scm_ubits_t): new typedef, representing unsigned scm_bits_t. * stacks.h: type renaming: scm_info_frame -> scm_info_frame_t scm_stack -> scm_stack_t the old names are deprecated, all in-Guile uses changed. * srcprop.h: type renaming: scm_srcprops -> scm_srcprops_t scm_srcprops_chunk -> scm_srcprops_chunk_t the old names are deprecated, all in-Guile uses changed. * gsubr.c, procs.c, print.c, ports.c, read.c, rdelim.c, ramap.c, rw.c, smob.c, sort.c, srcprop.c, stacks.c, strings.c, strop.c, strorder.c, strports.c, struct.c, symbols.c, unif.c, values.c, vectors.c, vports.c, weaks.c: various int/size_t -> size_t/scm_bits_t changes. * random.h: type renaming: scm_rstate -> scm_rstate_t scm_rng -> scm_rng_t scm_i_rstate -> scm_i_rstate_t the old names are deprecated, all in-Guile uses changed. * procs.h: type renaming: scm_subr_entry -> scm_subr_entry_t the old name is deprecated, all in-Guile uses changed. * options.h (scm_option_t.val): unsigned long -> scm_bits_t. type renaming: scm_option -> scm_option_t the old name is deprecated, all in-Guile uses changed. * objects.c: various long -> scm_bits_t changes. (scm_i_make_class_object): flags: unsigned long -> scm_ubits_t * numbers.h (SCM_FIXNUM_BIT): deprecated, renamed to SCM_I_FIXNUM_BIT. * num2integral.i.c: new file, multiply included by numbers.c, used to "templatize" the various integral <-> num conversion routines. * numbers.c (scm_mkbig, scm_big2num, scm_adjbig, scm_normbig, scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl): deprecated. (scm_i_mkbig, scm_i_big2inum, scm_i_adjbig, scm_i_normbig, scm_i_copybig, scm_i_short2big, scm_i_ushort2big, scm_i_int2big, scm_i_uint2big, scm_i_long2big, scm_i_ulong2big, scm_i_bits2big, scm_i_ubits2big, scm_i_size2big, scm_i_ptrdiff2big, scm_i_long_long2big, scm_i_ulong_long2big, scm_i_dbl2big, scm_i_big2dbl, scm_short2num, scm_ushort2num, scm_int2num, scm_uint2num, scm_bits2num, scm_ubits2num, scm_size2num, scm_ptrdiff2num, scm_num2short, scm_num2ushort, scm_num2int, scm_num2uint, scm_num2bits, scm_num2ubits, scm_num2ptrdiff, scm_num2size): new functions. * modules.c (scm_module_reverse_lookup): i, n: int -> scm_bits_t.x * load.c: change int -> size_t in various places (where the variable is used to store a string length). (search-path): call scm_done_free, not scm_done_malloc. * list.c (scm_ilength): return a scm_bits_t, not long. some other {int,long} -> scm_bits_t changes. * hashtab.c: various [u]int -> scm_bits_t changes. scm_ihashx_closure -> scm_ihashx_closure_t (and made a typedef). (scm_ihashx): n: uint -> scm_bits_t use scm_bits2num instead of scm_ulong2num. * gsubr.c: various int -> scm_bits_t changes. * gh_data.c (gh_scm2double): no loss of precision any more. * gh.h (gh_str2scm): len: int -> size_t (gh_{get,set}_substr): start: int -> scm_bits_t, len: int -> size_t (gh_<num>2scm): n: int -> scm_bits_t (gh_*vector_length): return scm_[u]size_t, not unsigned long. (gh_length): return scm_bits_t, not unsigned long. * fports.h: type renaming: scm_fport -> scm_fport_t the old name is deprecated, all in-Guile uses changed. * fports.c (fport_fill_input): count: int -> scm_bits_t (fport_flush): init_size, remaining, count: int -> scm_bits_t * debug.h (scm_lookup_cstr, scm_lookup_soft, scm_evstr): removed those prototypes, as the functions they prototype don't exist. * fports.c (default_buffer_size): int -> size_t (scm_fport_buffer_add): read_size, write_size: int -> scm_bits_t default_size: int -> size_t (scm_setvbuf): csize: int -> scm_bits_t * fluids.c (n_fluids): int -> scm_bits_t (grow_fluids): old_length, i: int -> scm_bits_t (next_fluid_num, scm_fluid_ref, scm_fluid_set_x): n: int -> scm_bits_t (scm_c_with_fluids): flen, vlen: int -> scm_bits_t * filesys.c (s_scm_open_fdes): changed calls to SCM_NUM2LONG to the new and shiny SCM_NUM2INT. * extensions.c: extension -> extension_t (and made a typedef). * eval.h (SCM_IFRAME): cast to scm_bits_t, not int. just so there are no nasty surprises if/when the various deeply magic tag bits move somewhere else. * eval.c: changed the locals used to store results of SCM_IFRAME, scm_ilength and such to be of type scm_bits_t (and not int/long). (iqq): depth, edepth: int -> scm_bits_t (scm_eval_stack): int -> scm_bits_t (SCM_CEVAL): various vars are not scm_bits_t instead of int. (check_map_args, scm_map, scm_for_each): len: long -> scm_bits_t i: int -> scm_bits_t * environments.c: changed the many calls to scm_ulong2num to scm_ubits2num. (import_environment_fold): proc_as_ul: ulong -> scm_ubits_t * dynwind.c (scm_dowinds): delta: long -> scm_bits_t * debug.h: type renaming: scm_debug_info -> scm_debug_info_t scm_debug_frame -> scm_debug_frame_t the old names are deprecated, all in-Guile uses changed. (scm_debug_eframe_size): int -> scm_bits_t * debug.c (scm_init_debug): use scm_c_define instead of the deprecated scm_define. * continuations.h: type renaming: scm_contregs -> scm_contregs_t the old name is deprecated, all in-Guile uses changed. (scm_contregs_t.num_stack_items): size_t -> scm_bits_t (scm_contregs_t.num_stack_items): ulong -> scm_ubits_t * continuations.c (scm_make_continuation): change the type of stack_size form long to scm_bits_t. * ports.h: type renaming: scm_port_rw_active -> scm_port_rw_active_t (and made a typedef) scm_port -> scm_port_t scm_ptob_descriptor -> scm_ptob_descriptor_t the old names are deprecated, all in-Guile uses changed. (scm_port_t.entry): int -> scm_bits_t. (scm_port_t.line_number): int -> long. (scm_port_t.putback_buf_size): int -> size_t. * __scm.h (long_long, ulong_long): deprecated (they pollute the global namespace and have little value besides that). (SCM_BITS_LENGTH): new, is the bit size of scm_bits_t (i.e. of an SCM handle). (ifdef spaghetti): include sys/types.h and sys/stdtypes.h, if they exist (for size_t & ptrdiff_t) (scm_sizet): deprecated. * Makefile.am (noinst_HEADERS): add num2integral.i.c
2001-04-28* numbers.h (scm_dblproc): deprecation expired - removed.Rob Browning1-27/+0
(SCM_UNEGFIXABLE): deprecation expired - removed. (SCM_FLOBUFLEN): deprecation expired - removed. (SCM_INEXP): deprecation expired - removed. (SCM_CPLXP): deprecation expired - removed. (SCM_REAL): deprecation expired - removed. (SCM_IMAG): deprecation expired - removed. (SCM_REALPART): deprecation expired - removed. (scm_makdbl): deprecation expired - removed. (SCM_SINGP): deprecation expired - removed. (SCM_NUM2DBL): deprecation expired - removed. (SCM_NO_BIGDIG): deprecation expired - removed.
2001-04-10* Avoid redundant casting of argument numbers to char* and vice versa.Dirk Herrmann1-5/+6
2001-03-15* numbers.c (scm_num2ulong): Check that a bignum is positiveMarius Vollmer1-0/+2
before looking at the magnitude. Correctly check for overflow during conversion. (scm_num2long_long): Likewise. (scm_num2ulong_long): New. (ULONG_LONG_MAX): Define if not already defined. * numbers.h: (scm_num2ulong_long): New prototype.
2001-01-18* Cleaned up some limits-definitions.Dirk Herrmann1-10/+6
2000-11-23* SCM_SETCHARS deprecated.Dirk Herrmann1-0/+1
2000-09-26* Eliminated all remaining calls to SCM_CHARS.Dirk Herrmann1-2/+3
2000-06-20* numbers.h: Put #ifdef HAVE_LONG_LONGS around declarations usingMikael Djurfeldt1-1/+5
the long_long type. (Thanks to Bernard Urban.)
2000-06-19* numbers.h (SCM_NEWREAL, SCM_NEWCOMPLEX): Removed.Mikael Djurfeldt1-2/+0
2000-05-30* Don't use SCM_SMOB_PREDICATE in header file.Dirk Herrmann1-1/+1
2000-05-25* Un-deprecated the *FIXABLE macros.Dirk Herrmann1-3/+6
* Deprecated SCM_UNPACK_CAR. * Updated NEWS and RELEASE.
2000-05-25* Replace SCM_UNPACK_CAR appropriately.Dirk Herrmann1-5/+4
* Only access cons cells via SCM_{SET}?C[AD]R. * gc.c: Remove unused struct member variable 'valid'.
2000-05-16* Makefile.am: Let 'make clean' remove *.x and *.doc files.Dirk Herrmann1-29/+10
* Renamed SCM_STRICT_TYPING to SCM_DEBUG_TYPING_STRICTNESS. * Removed conditionally compiled code for Turbo C. * gdbint.c: Eliminated call to scm_tag.
2000-05-11* __scm.h: Added section for debugging options.Dirk Herrmann1-74/+32
* New debugging option SCM_DEBUG_DEPRECATED. * numbers.c numbers.h: Deprecated a lot of stuff.
2000-05-10* Added FIXME comment about the problems with infinite numbers.Dirk Herrmann1-1/+1
* abs/magnitude: Made independent of each other. * Avoid using REALPART for real objects.
2000-05-04Avoid modifications of cells via pointers. Use SCM_SET_CELL... instead.Dirk Herrmann1-1/+1
2000-05-03* scm_divbigbig and scm_divbigint are static nowDirk Herrmann1-2/+0
and only return valid SCM values. * Reordered some further dispatch sequences. * Division by zero of inums leads to an error now.
2000-05-02* numbers.c (scm_logtest, scm_division): Reordered dispatch sequence.Dirk Herrmann1-1/+1
* removed calls to deprecated scm_makdbl.
2000-04-04Lots of fixes with respect to strict typing.Dirk Herrmann1-4/+4