summaryrefslogtreecommitdiff
path: root/libguile/numbers.h
AgeCommit message (Collapse)AuthorFilesLines
2012-01-31Revert "add SCM_HEAP_OBJECT_BASE"Andy Wingo1-3/+3
This reverts commit 47ed8656db8800f3ad20a40eb2c4e9ef3dc891e3. Conflicts: libguile/foreign.c
2011-12-02Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-0/+3
Conflicts: libguile/guile.c libguile/numbers.c
2011-12-02install gmp memory functions that let libgc know about allocationsAndy Wingo1-0/+3
* libguile/numbers.c (custom_gmp_malloc, custom_gmp_realloc, custom_gmp_free): New static functions used by GMP for allocation. These are just wrappers for scm_malloc, scm_realloc, and free. (scm_init_numbers): If scm_install_gmp_memory_functions is nonzero, use mp_set_memory_functions to configure GMP to use custom_gmp_{malloc,realloc,free} for memory allocation. (scm_bigprint): Ask gmp for the function used to deallocate the string returned by mpz_get_str. * libguile/numbers.h: Declare scm_install_gmp_memory_functions. * libguile/guile.c: When running the Guile binary, install the gmp_memory_functions. Based on a patch by Mark H Weaver <mhw@netris.org>.
2011-10-24add SCM_HEAP_OBJECT_BASEAndy Wingo1-3/+3
* libguile/tags.h (SCM_HEAP_OBJECT_BASE): New macro. Given a SCM, returns a pointer to the start of its memory area on the heap. * libguile/bytevectors.c: * libguile/fluids.c: * libguile/foreign.c: * libguile/gc.h: * libguile/guardians.c: * libguile/numbers.h: * libguile/ports.c: * libguile/smob.c: * libguile/struct.c: * libguile/weak-set.c: * libguile/weak-table.c: * libguile/weak-vector.c: Use it.
2011-10-24refactor tc7 and tc16 checksAndy Wingo1-6/+5
* libguile/tags.h (SCM_HAS_TYP7, SCM_HAS_TYP7S, SCM_HAS_TYP16): New macros. * libguile/bytevectors.h (SCM_BYTEVECTOR_P): * libguile/control.h (SCM_PROMPT_P): * libguile/filesys.h (SCM_DIRP): * libguile/fluids.h (SCM_WITH_FLUIDS_P, SCM_FLUID_P) (SCM_I_DYNAMIC_STATE_P): * libguile/foreign.h (SCM_POINTER_P): * libguile/fports.h (SCM_FPORTP): * libguile/frames.h (SCM_VM_FRAME_P): * libguile/hashtab.h (SCM_HASHTABLE_P): * libguile/inline.h (scm_get_byte_or_eof): * libguile/numbers.h (SCM_REALP, SCM_BIGP, SCM_COMPLEXP, SCM_FRACTIONP): * libguile/objcodes.h (SCM_OBJCODE_P): * libguile/ports.h (SCM_OUTPUT_PORT_P): * libguile/programs.h (SCM_PROGRAM_P): * libguile/smob.h (SCM_SMOB_PREDICATE): * libguile/srfi-14.h (SCM_CHARSETP): * libguile/strings.c (IS_STRING): * libguile/strports.h (SCM_STRPORTP): * libguile/symbols.h (scm_is_symbol): * libguile/variable.h (SCM_VARIABLEP): * libguile/vectors.h (SCM_I_IS_VECTOR, SCM_I_IS_NONWEAK_VECTOR): * libguile/vm-i-system.c (call, tail-call, mv-call) * libguile/vm.h (SCM_VM_P, SCM_VM_CONT_P): * libguile/weak-set.c (SCM_WEAK_SET_P): * libguile/weak-table.c (SCM_WEAK_TABLE_P): * libguile/weak-vector.h (SCM_I_WVECTP): Use them.
2011-10-09New functions scm_is_exact and scm_is_inexactMike Gran1-0/+2
* doc/ref/api-data.texi (Exact and Inexact Numbers): doc for scm_is_exact and scm_is_inexact * libguile/numbers.c (scm_is_exact, scm_is_inexact): new functions * libguile/numbers.h: declarations for scm_is_exact and scm_is_inexact * test/suite/standalone/test-conversion.c (test_is_exact, test_is_inexact): new tests
2011-04-09Fix the R6RS exact-integer-sqrt and import into core guileMark H Weaver1-0/+2
* libguile/numbers.c (scm_exact_integer_sqrt): New C procedure to compute exact integer square root and remainder. (scm_i_exact_integer_sqrt): New Scheme procedure `exact-integer-sqrt' from the R6RS, imported into core guile. * libguile/numbers.h: Add prototypes. * module/rnrs/base.scm: Remove broken stub implementation, which would fail badly when applied to large integers. * doc/ref/api-data.texi: Add documentation. * doc/ref/r6rs.texi: Change documentation for `exact-integer-sqrt' to a stub that xrefs the core docs, as is done for other operations available in core. * test-suite/tests/numbers.test: Add tests. * NEWS: Add news entries.
2011-02-14Make SCM_NUMP and SCM_NUMBERP more extensibleMark H Weaver1-3/+1
* libguile/numbers.h (SCM_NUMP, SCM_NUMBERP): Mask out more bits in the cell type field when doing the comparison, in order to accept future numeric types that have not yet been implemented. This should allow us to add more core numeric types without breaking ABI compatibility. As a bonus, these macros are now more efficient.
2011-02-14Add four new sets of fast quotient and remainder operatorsMark H Weaver1-0/+16
* libguile/numbers.c (scm_floor_divide, scm_floor_quotient, scm_floor_remainder, scm_ceiling_divide, scm_ceiling_quotient, scm_ceiling_remainder, scm_truncate_divide, scm_truncate_quotient, scm_truncate_remainder, scm_round_divide, scm_round_quotient, scm_round_remainder): New extensible procedures `floor/', `floor-quotient', `floor-remainder', `ceiling/', `ceiling-quotient', `ceiling-remainder', `truncate/', `truncate-quotient', `truncate-remainder', `round/', `round-quotient', and `round-remainder'. * libguile/numbers.h: Add function prototypes. * test-suite/tests/numbers.test: Add tests. * doc/ref/api-data.texi (Arithmetic): Add documentation. * NEWS: Add NEWS entry.
2011-02-14Make divide functions return values via (SCM *) output argumentsMark H Weaver1-2/+5
* libguile/numbers.c (scm_euclidean_divide, scm_centered_divide): Change API to return two values via output arguments of type (SCM *), instead of packing into a values object. (scm_i_euclidean_divide, scm_i_centered_divide): New internal wrappers that call the above functions and pack the result into a values object. * libguile/numbers.h: Change prototypes to reflect new API. * doc/ref/api-data.h (Arithmetic): Update manual.
2011-01-31Rename {euclidean,centered}_quo_rem to {euclidean,centered}_divideMark H Weaver1-2/+2
* libguile/numbers.c (euclidean_quo_rem): Rename to euclidean_divide. (centered_quo_rem): Rename to {euclidean,centered}_divide. * libguile/numbers.h: Rename euclidean_quo_rem to euclidean_divide and centered_quo_rem to centered_divide. * doc/ref/api-data.texi: Rename euclidean_quo_rem to euclidean_divide and centered_quo_rem to centered_divide.
2011-01-30Improve extensibility of core numeric proceduresMark H Weaver1-2/+3
* libguile/numbers.c (scm_quotient, scm_remainder, scm_modulo, scm_zero_p, scm_positive_p, scm_negative_p, scm_real_part, scm_imag_part, scm_numerator, scm_denominator, scm_magnitude, scm_angle, scm_exact_to_inexact): Change from SCM_GPROC to SCM_PRIMITIVE_GENERIC. As a side effect, all of these procedures now have documentation strings. (scm_exact_p, scm_inexact_p, scm_odd_p, scm_even_p, scm_finite_p, scm_inf_p, scm_nan_p, scm_expt, scm_inexact_to_exact, scm_log, scm_log10, scm_exp, scm_sqrt): Change from SCM_DEFINE to SCM_PRIMITIVE_GENERIC, and make sure the code allows these functions to be extended in practice. (scm_real_part, scm_imag_part, scm_numerator, scm_denominator, scm_inexact_to_exact): Simplify type dispatch code. (scm_sqrt): Rename formal argument from x to z, since complex numbers are supported. (scm_abs): Fix empty FUNC_NAME. * libguile/numbers.h (scm_finite_p): Add missing prototype. (scm_inf_p, scm_nan_p): Rename formal parameter from n to x, since the domain is the real numbers. * test-suite/tests/numbers.test: Test for documentation strings. Change from `expect-fail' to `pass-if' for several of these, and add tests for others. Also add other tests for `real-part' and `imag-part', which previously had none.
2011-01-30Add two new sets of fast quotient and remainder operatorsMark H Weaver1-0/+6
* libguile/numbers.c (scm_euclidean_quo_and_rem, scm_euclidean_quotient, scm_euclidean_remainder, scm_centered_quo_and_rem, scm_centered_quotient, scm_centered_remainder): New extensible procedures `euclidean/', `euclidean-quotient', `euclidean-remainder', `centered/', `centered-quotient', `centered-remainder'. * libguile/numbers.h: Add function prototypes. * module/rnrs/base.scm: Remove incorrect stub implementations of `div', `mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'. Instead do renaming imports of `euclidean-quotient', `euclidean-remainder', `euclidean/', `centered-quotient', `centered-remainder', and `centered/', which are equivalent to the R6RS operators. * module/rnrs/arithmetic/fixnums.scm (fxdiv, fxmod, fxdiv-and-mod, fxdiv0, fxmod0, fxdiv0-and-mod0): Remove redundant checks for division by zero and unnecessary complexity. (fx+/carry): Remove unneeded calls to `inexact->exact'. * module/rnrs/arithmetic/flonums.scm (fldiv, flmod, fldiv-and-mod, fldiv0, flmod0, fldiv0-and-mod0): Remove redundant checks for division by zero and unnecessary complexity. Remove unneeded calls to `inexact->exact' and `exact->inexact' * test-suite/tests/numbers.test: (test-eqv?): New internal predicate for comparing numerical outputs with expected values. Add extensive test code for `euclidean/', `euclidean-quotient', `euclidean-remainder', `centered/', `centered-quotient', `centered-remainder'. * test-suite/tests/r6rs-arithmetic-fixnums.test: Fix some broken test cases, and remove `unresolved' test markers for `fxdiv', `fxmod', `fxdiv-and-mod', `fxdiv0', `fxmod0', and `fxdiv0-and-mod0'. * test-suite/tests/r6rs-arithmetic-flonums.test: Remove `unresolved' test markers for `fldiv', `flmod', `fldiv-and-mod', `fldiv0', `flmod0', and `fldiv0-and-mod0'. * doc/ref/api-data.texi (Arithmetic): Document `euclidean/', `euclidean-quotient', `euclidean-remainder', `centered/', `centered-quotient', and `centered-remainder'. (Operations on Integer Values): Add cross-references to `euclidean/' et al, from `quotient', `remainder', and `modulo'. * doc/ref/r6rs.texi (rnrs base): Improve documentation for `div', `mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'. Add cross-references to `euclidean/' et al. * NEWS: Add NEWS entry.
2011-01-28Add SCM_INUM1 to numbers.h, and make use of it and SCM_INUM0 in numbers.cMark H Weaver1-3/+4
* libguile/numbers.h: Add SCM_INUM1, a name for the fixnum 1. This is analogous to SCM_INUM0, a name for 0, which already existed. * libguile/numbers.c: Change occurrences of SCM_I_MAKINUM (0) and SCM_I_MAKINUM (1) to SCM_INUM0 and SCM_INUM1, respectively.
2010-10-13Allocate complex numbers in contiguous pointer-less memory.Ludovic Courtès1-3/+4
* libguile/numbers.h (SCM_COMPLEX_MEM): Remove. (SCM_COMPLEX_REAL): Change to just fetch the `real' field of the pointed-to `scm_t_complex'. (SCM_COMPLEX_IMAG): Likewise. (scm_t_complex)[type, pad]: New fields. * libguile/numbers.c (scm_c_make_rectangular): Allocate the whole complex contiguously, with `scm_gc_malloc_pointerless'.
2010-09-08Use Gnulib's `isnan' and `isinf' modules.Ludovic Courtès1-18/+0
This updates Gnulib to v0.0-4219-g84cdd8b. * m4/gnulib-cache.m4: Add `isinf' and `isnan'. * configure.ac: Remove checks for `floatingpoint.h', `ieeefp.h', and `nan.h'. * libguile/gen-scmconfig.c (main): Remove definitions of `SCM_HAVE_FLOATINGPOINT_H', `SCM_HAVE_IEEEFP_H', and `SCM_HAVE_NAN_H'. * libguile/numbers.c (isnan)[SCO && !HAVE_ISNAN]: Remove. (isinf)[SCO && !HAVE_ISINF]: Remove. (xisinf, xisnan): Remove. Change callers to use `isinf' and `isnan'. (guile_ieee_init): Remove the `defined HAVE_ISINF' and `define HAVE_ISNAN' conditions. * libguile/numbers.h: Remove code conditional on `SCM_HAVE_FLOATINGPOINT_H', `SCM_HAVE_IEEEFP_H', or `SCM_HAVE_NAN_H'.
2010-07-26remove SCM_HAVE_T_INT64, SCM_HAVE_T_UINT64Andy Wingo1-5/+1
* libguile/__scm.h: * libguile/numbers.h: * libguile/random.c: * libguile/srfi-4.c: * libguile/srfi-4.h: * libguile/numbers.c: * test-suite/standalone/test-conversion.c: * libguile/gen-scmconfig.c: As we require 64-bit integers in configure.ac, remove conditional definition of 64-bit types.
2009-12-03change asubrs to be gsubrsAndy Wingo1-1/+13
* libguile/numbers.h: * libguile/numbers.c (scm_i_gcd, scm_i_lcm, scm_i_logand, scm_i_logior) (scm_i_logxor, scm_i_min, scm_i_max, scm_i_sum, scm_i_difference) (scm_i_product, scm_i_divide): Change asubrs to be gsubrs.
2009-12-03+ is not an asubrAndy Wingo1-0/+1
* libguile/numbers.h: * libguile/numbers.c (scm_i_sum): Rework so that scm_sum is just a normal function. Its generic is actually provided by scm_i_sum, a gsubr with rest args. In that way, + is no longer an asubr.
2009-12-03implement transcendental sin, cos etc in c; deprecate $sin, $cos, etcAndy Wingo1-4/+12
* libguile/deprecated.h: * libguile/deprecated.c (scm_asinh, scm_acosh, scm_atanh): Deprecate these stand-ins for the C99 asinh, acosh, and atanh functions. Guile is not gnulib. (scm_sys_atan2): Deprecate as well, in favor of scm_atan. * libguile/numbers.h: * libguile/numbers.c (scm_sin, scm_cos, scm_tan) (scm_sinh, scm_cosh, scm_tanh) (scm_asin, scm_acos, scm_atan) (scm_sys_asinh, scm_sys_acosh, scm_sys_atanh): New functions, replacing the combination of dsubrs and boot-9 wrappers with C subrs that handle complex values. The latter three have _sys_ in their names due to the name conflict with the deprecated scm_asinh et al. Remove the $abs, $sin etc "dsubrs". * module/ice-9/boot-9.scm: Remove transcendental functions, as this all happens in C now. * module/ice-9/deprecated.scm: Add aliases for $sin et al. * test-suite/tests/ramap.test ("array-map!"): Adjust "dsubr" tests to use sqrt, not $sqrt. They don't actually test dsubrs now. In the two-source test, I'm pretty sure the dsubr array-map! should have been failing, as indeed it does now; I've changed the test case to expect the failure. I'd still like to know why it was succeeding before.
2009-12-03expt implemented in C, handles complex numbersAndy Wingo1-1/+1
* libguile/numbers.h: * libguile/numbers.c (scm_expt): Rename from scm_sys_expt, and handle the complex cases as well. * libguile/deprecated.h: * libguile/deprecated.c (scm_sys_expt): Add a deprecated shim. * module/ice-9/boot-9.scm (expt): Remove definition, scm_expt does all we need.
2009-08-25Add full Unicode capability to ports and the default readerMichael Gran1-1/+5
Ports are given two additional properties: a character encoding and a conversion failure strategy. These properties have getters and setters. The new properties are used to convert any locale text to/from the internal representation of strings. If unspecified, ports use a default value. The default value of these properties is held in a fluid. The default character encoding can be modified by calling setlocale. ISO-8859-1 is treated specially. Since it is a native encoding of strings, it can be processed more quickly. Source code is assumed to be ISO-8859-1 unless otherwise specified. The encoding of a source code file can be given as 'coding: XXXXX' in a magic comment at the top of a file. The C functions that deal with encoding often use a null pointer as shorthand for the native Latin-1 encoding, for efficiency's sake. * test-suite/tests/encoding-iso88591.test: new tests * test-suite/tests/encoding-iso88597.test: new tests * test-suite/tests/encoding-utf8.test: new tests * test-suite/tests/encoding-escapes.test: new tests * test-suite/tests/numbers.test: declare 'binary' encoding * test-suite/tests/ports.test: declare 'binary' encoding * test-suite/tests/r6rs-ports.test: declare 'binary' encoding * module/system/base/compile.scm (compile-file): use source-code file's self-declared encoding when compiling files * libguile/strports.c: store string ports in locale encoding (scm_strport_to_locale_u8vector, scm_call_with_output_locale_u8vector) (scm_open_input_locale_u8vector, scm_get_output_locale_u8vector): new functions * libguile/strings.h: new declaration for scm_i_string_contains_char * libguile/strings.c (scm_i_string_contains_char): new function (scm_from_stringn, scm_to_stringn): use NULL for Latin-1 (scm_from_locale_stringn, scm_to_locale_stringn): respect character encoding of input and output ports * libguile/read.h: declaration for scm_scan_for_encoding * libguile/read.c: (read_token): now takes scheme string instead of C string/length (read_complete_token): new function (scm_read_sexp, scm_read_number, scm_read_mixed_case_symbol) (scm_read_number_and_radix, scm_read_quote, scm_read_semicolon_comment) (scm_read_srfi4_vector, scm_read_bytevector, scm_read_guile_bit_vector) (scm_read_scsh_block_comment, scm_read_commented_expression) (scm_read_extended_symbol, scm_read_sharp_extension, scm_read_shart) (scm_read_expression): use scm_t_wchar for char type, use read_complete_token (scm_scan_for_encoding): new function to find a file's character encoding (scm_file_encoding): new function to find a port's character encoding * libguile/rdelim.c: don't unpack strings * libguile/print.h: declaration for modified function scm_i_charprint * libguile/print.c: use locale when printing characters and strings (scm_i_charprint): input parameter is now scm_t_wchar (scm_simple_format): don't unpack strings * libguile/posix.h: new declaration for scm_setbinary. * libguile/posix.c (scm_setlocale): set default and stdio port encodings based on the locale's character encoding (scm_setbinary): new function * libguile/ports.h (scm_t_port): add encoding and failed conversion handler to port type. Declarations for new or modified functions scm_getc, scm_unget_byte, scm_ungetc, scm_i_get_port_encoding, scm_i_set_port_encoding_x, scm_port_encoding, scm_set_port_encoding_x, scm_i_get_conversion_strategy, scm_i_set_conversion_strategy_x, scm_port_conversion_strategy, scm_set_port_conversion_strategy_x. * libguile/ports.c: assign the current ports to zero on startup so we can see if they've been set. (scm_current_input_port, scm_current_output_port, scm_current_error_port): return #f if the port is not yet initialized (scm_new_port_table_entry): set up a new port's encoding and illegal sequence handler based on the thread's current defaults (scm_i_remove_port): free port encoding name when port is removed (scm_i_mode_bits_n): now takes a scheme string instead of a c string and length. All callers changed. (SCM_MBCHAR_BUF_SIZE): new const (scm_getc): new function, since the scm_getc in inline.h is now scm_get_byte_or_eof. This pulls one codepoint from a port. (scm_lfwrite_substr, scm_lfwrite_str): now uses port's encoding (scm_unget_byte): new function, incorportaing the low-level functionality of scm_ungetc (scm_ungetc): uses scm_unget_byte * libguile/numbers.h (scm_t_wchar): compilation order problem with scm_t_wchar being use in functions in multiple headers. Forward declare scm_t_wchar. * libguile/load.c (scm_primitive_load): scan for file encoding at top of file and use it to set the load port's encoding * libguile/inline.h (scm_get_byte_or_eof): new function incorporating most of the functionality of scm_getc. * libguile/fports.c (fport_fill_input): now returns scm_t_wchar * libguile/chars.h (scm_t_wchar): avoid compilation order problem with declaration of scm_t_wchar
2009-08-21Use string accessors for string->number conversionMichael Gran1-0/+1
* libguile/numbers.c (scm_i_print_fraction): use string accessors (XDIGIT2UINT): use libunistring function (mem2uinteger, mem2integer, mem2decimal_from_point, mem2ureal) (mem2complex): take scheme string instead of c string; use accessors (scm_i_string_to_number): new function (scm_c_locale_string_to_number): use scm_i_string_to_number * libguile/numbers.h: declaration for scm_i_string_to_number * libguile/strings.c (scm_i_string_strcmp): new function * libguile/strings.h: declaration for scm_i_string_strcmp
2009-08-01Don't doubly define scm_t_wcharMichael Gran1-3/+0
* libguile/chars.h: don't define scm_t_wchar * libguile/numbers.h: define scm_t_wchar here
2009-07-29Add 32-bit charactersMichael Gran1-1/+9
This adds the 32-bit standalone characters. Strings are still 8-bit. Characters larger than 8-bit can only be entered or displayed in octal format at this point. At this point, the terminal's display encoding is expected to be Latin-1. * module/language/assembly/compile-bytecode.scm (write-bytecode): add 32-bit char * module/language/assembly.scm (object->assembly): add 32-bit char (assembly->object): add 32-bit char * libguile/vm-i-system.c (make-char32): new op * libguile/print.c (iprin1): print 32-bit char * libguile/numbers.h: add type scm_t_wchar * libguile/numbers.c: add type scm_t_wchar * libguile/chars.h: new type scm_t_wchar (SCM_CODEPOINT_MAX): new (SCM_IS_UNICODE_CHAR): new (SCM_MAKE_CHAR): operate on 32-bit char * libguile/chars.c: comparison operators now use Unicode codepoints (scm_c_upcase): now receives and returns scm_t_wchar (scm_c_downcase): now receives and returns scm_t_wchar
2009-06-17Change Guile license to LGPLv3+Neil Jerram1-6/+7
(Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* )
2008-05-31Add `SCM_INTERNAL' macro, use it.Ludovic Courtès1-16/+16
2006-12-23* numbers.c (scm_i_fraction_reduce): move logic intoHan-Wen Nienhuys1-8/+0
scm_i_make_ratio(), so fractions are only read. scm_i_fraction_reduce() modifies a fraction when reading it. A race condition might lead to fractions being corrupted by reading them concurrently. * numbers.h: remove SCM_FRACTION_SET_NUMERATOR, SCM_FRACTION_SET_DENOMINATOR, SCM_FRACTION_REDUCED_BIT, SCM_FRACTION_REDUCED_SET, SCM_FRACTION_REDUCED_CLEAR, SCM_FRACTION_REDUCED.
2006-10-09merge from 1.8 branchKevin Ryde1-0/+4
2006-04-17merge from 1.8 branchKevin Ryde1-2/+3
2005-06-05* hashtab.h: Bugfix: use SCM_API (WAS: extern).Marius Vollmer1-1/+0
* socket.c: Remove obsolete comment about socklen_t. (s_scm_setsockopt)[!HAVE_IP_MREQ]: Do not use ip_mreq code. * numbers.h (isnan)[__MINGW32__]: Remove. * Makefile.am (gen_scmconfig_SOURCES): Bugfix: Add DEFAULT_INCLUDES when cross compiling. * threads.c (ETIMEDOUT, pipe)[__MINGW32__]: Add defines. * stime.c (s_scm_strftime)[!HAVE_TM_ZONE]: Use SCM_SIMPLE_VECTOR_REF instead of SCM_VELTS. (Changed slightly from Jan's patch.)
2005-05-23The FSF has a new address.Marius Vollmer1-1/+1
2005-04-14(scm_oneplus, scm_oneminus): New functions, converted fromKevin Ryde1-0/+2
scheme code in boot-9.scm.
2005-03-13(scm_i_clonebig): Remove static, so can use in srfi-60.Kevin Ryde1-1/+2
2004-10-29(scm_i_print_complex, icmplx2str): New.Marius Vollmer1-0/+1
(iflo2str): Use icmplx2str for complex numbers.
2004-10-26(scm_i_print_double): New.Marius Vollmer1-0/+3
2004-10-22(SCM_T_INTBUFLEN): Increased to coverMarius Vollmer1-4/+7
scm_t_intmax values. (scm_uint2str): New, for scm_t_uintmax. (scm_iint2str): Argument type changed to scm_t_intmax, reimplemented in terms of scm_uint2str.
2004-09-21Include <gmp.h> in numbers.h, not inMarius Vollmer1-0/+6
numbers.c. (scm_to_mpz, scm_from_mpz): New. Thanks to Andreas Vögele!
2004-08-09(scm_round, scm_truncate): Renamed to scm_c_round and scm_c_truncate;Marius Vollmer1-2/+2
deprecated versions installed in deprecated.h and deprecated.c. Changed all uses.
2004-08-03(scm_complex_p): New, export as "complex?" to Scheme.Marius Vollmer1-3/+15
(scm_number_p): Export as "number?" to Scheme. (scm_is_complex, scm_is_number): New. (scm_c_make_rectangular, scm_c_make_polar): New. (scm_make_rectangular, scm_make_polar): Use above. (scm_c_real_part, scm_c_imag_part, scm_c_magnitude, scm_c_angle): New. (scm_make_complex): Discouraged by moving to discouraged.h and discouraged.c. Replaced all uses with scm_c_make_rectangular.
2004-08-03* numbers.h. numbers.c (scm_make_ratio): Renamed toMarius Vollmer1-1/+0
scm_i_make_ratio and made static, replaced uses with scm_divide.
2004-08-03(scm_is_rational): New.Marius Vollmer1-28/+2
(scm_i_short2big, scm_i_int2big, scm_i_uint2big, scm_i_size2big, scm_i_ptrdiff2big, scm_i_long_long2big, scm_i_ulong_long2big): Removed prototypes. (scm_make_real, scm_num2dbl, scm_float2num, scm_double2num): Discouraged by moving to discouraged.h and discouraged.c. Replaced all uses with scm_from_double. (scm_num2float, scm_num2double): Discouraged by moving prototype to discouraged.h and rewriting in terms of scm_to_double. Replaced all uses with scm_to_double. (scm_to_double): Do not implement in terms of scm_num2dbl, use explicit code. (scm_from_double): Do not implement in terms of scm_make_real, use explicit code.
2004-08-02* discouraged.h, discouraged.c: New files.Marius Vollmer1-33/+0
* deprecated.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOLP, SCM_EQ_P, SCM_NEGATE_BOOL, SCM_BOOL, SCM_BOOT_NOT): Promoted from being deprecated to being discouraged by moving to discouraged.h. * numbers.h, numbers.c, discouraged.h, discouraged.c (scm_short2num, scm_ushort2num, scm_int2num, scm_uint2num, scm_long2num, scm_ulong2num, scm_size2num, scm_ptrdiff2num, scm_num2short, scm_num2ushort, scm_num2int, scm_num2uint, scm_num2long, scm_num2ulong, scm_num2size, scm_num2ptrdiff, scm_long_long2num, scm_ulong_long2num, scm_num2long_long, scm_num2ulong_long): Discouraged by moving to discouraged.h and discouraged.c and reimplementing in terms of scm_from_* and scm_to_*. * numbers.h, numbers.c: Removed GUILE_DEBUG code. (scm_i_short2big, scm_i_ushort2big, scm_i_int2big, scm_i_uint2big, scm_i_size2big, scm_i_ptrdiff2big): Removed. (scm_i_long2big, scm_i_ulong2big): New, explicit definitions. * conv-integer.i.c, conv-uinteger.i.c: Use them instead of explicit code.
2004-07-29* numbers.h (scm_to_schar, scm_to_uchar, scm_to_char,Marius Vollmer1-56/+114
scm_to_short, scm_to_ushort, scm_to_int, scm_to_uint, scm_to_long, scm_to_ulong, scm_to_long_long, scm_to_ulong_long, scm_to_intmax, scm_to_uintmax, scm_to_size_t, scm_to_ssize_t scm_from_schar, scm_from_uchar, scm_from_char, scm_from_short, scm_from_ushort, scm_from_int, scm_from_uint, scm_from_long, scm_from_ulong, scm_from_long_long, scm_from_ulong_long, scm_from_intmax, scm_from_uintmax, scm_from_size_t, scm_from_ssize_t): No longer defined in terms of scm_to_signed_integer, etc, but in terms of scm_to_int8, etc.
2004-07-29* conv-integer.i.c, conv-uinteger.i.c: New files, used to generateMarius Vollmer1-38/+30
the functions below. * numbers.c, numbers.h (scm_to_int8, scm_to_uint8, scm_to_int16, scm_to_uint16, scm_to_int32, scm_to_uint32, scm_to_int64, scm_to_uint64, scm_from_int8, scm_from_uint8, scm_from_int16, scm_from_uint16, scm_from_int32, scm_from_uint32, scm_from_int64, scm_from_uint64): Turned from macros into proper functions. (scm_to_signed_integer, scm_to_unsigned_integer, scm_from_signed_integer, scm_from_unsigned_integer): Generate via conv-integer.i.c and conv-uinteger.i.c, as well.
2004-07-23(SCM_INUMP, SCM_NINUMP, SCM_INUM): Deprecated by reenaming them toMarius Vollmer1-4/+4
SCM_I_INUMP, SCM_I_NINUMP and SCM_I_INUM, respectively and adding deprecated versions to deprecated.h and deprecated.c. Changed all uses to either use the SCM_I_ variants or scm_is_*, scm_to_*, or scm_from_*, as appropriate.
2004-07-08* numbers.h (SCM_MAKINUM, SCM_I_MAKINUM): Renamed SCM_MAKINUM toMarius Vollmer1-2/+2
SCM_I_MAKINUM and changed all uses. * deprecated.h, deprecated.c (SCM_MAKINUM): Newly deprecated.
2004-07-07(scm_to_short, scm_to_ushort): It's SHRT_MIN, etc, not SHORT_MIN.Marius Vollmer1-3/+59
(scm_to_size_t): Use SIZE_MAX instead of cooking our own. (scm_to_long_long, scm_to_ulong_long, scm_to_int8, scm_to_uint8, scm_to_int16, scm_to_uint16, scm_to_int32, scm_to_uint32, scm_to_int64, scm_to_uint64, scm_to_intmax, scm_to_uintmax, scm_from_long_long, scm_from_ulong_long, scm_from_int8, scm_from_uint8, scm_from_int16, scm_from_uint16, scm_from_int32, scm_from_uint32, scm_from_int64, scm_from_uint64, scm_from_intmax, scm_from_uintmax): New.
2004-07-06(scm_is_integer, scm_is_signed_integer, scm_is_unsigned_integer,Marius Vollmer1-2/+72
scm_to_signed_integer, scm_to_unsigned_integer, scm_to_schar, scm_to_uchar, scm_to_char, scm_to_short, scm_to_ushort, scm_to_long, scm_to_ulong, scm_to_size_t, scm_to_ssize_t, scm_from_schar, scm_from_uchar, scm_from_char, scm_from_short, scm_from_ushort, scm_from_int, scm_from_uint, scm_from_long, scm_from_ulong, scm_from_size_t, scm_from_ssize_t, scm_is_real, scm_to_double, scm_from_double): New. * deprecated.h, boolean.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOL, SCM_NEGATE_BOOL, SCM_BOOLP): Deprecated by moving into "deprecated.h". Replaced all uses with scm_is_false, scm_is_true, scm_from_bool, and scm_is_bool, respectively.
2004-05-15 * numbers.h (SCM_SLOPPY_FRACTIONP): Removed. It was not usedDirk Herrmann1-5/+5
throughout guile, has not been part of an official release yet, and the concept of sloppy predicates has never been a good idea. (SCM_FRACTION_NUMERATOR, SCM_FRACTION_DENOMINATOR, SCM_FRACTION_SET_NUMERATOR, SCM_FRACTION_SET_DENOMINATOR): Simplified.