Neil Jerram
40f892156a
Read complex numbers where both parts are inexact decimals
...
Thanks to Bill Schottstaedt for reporting this problem!
* libguile/numbers.c (mem2ureal): Don't be misled by *p_exactness
being INEXACT on entry (as is possible when reading a complex
number): use local exactness variable x which starts as EXACT.
Call mem2decimal_from_point () with &x instead of p_exactness.
* test-suite/tests/numbers.test ("string->number"): Add complex number
tests suggested by Bill.
2009-07-01 19:43:55 +01:00
Neil Jerram
53befeb700
Change Guile license to LGPLv3+
...
(Not quite finished, the following will be done tomorrow.
module/srfi/*.scm
module/rnrs/*.scm
module/scripts/*.scm
testsuite/*.scm
guile-readline/*
)
2009-06-17 00:22:09 +01:00
Ludovic Courtès
5e647d08e9
Fix compilation of `numbers.c' on Tru64.
...
* libguile/numbers.c (scm_c_make_polar): Don't use sincos(3) on non-GNU
platforms. Reported by Didier Godefroy <ldg@ulysium.net>.
2009-05-20 23:53:09 +02:00
Ludovic Courtès
b66a552487
Merge branch 'master' into boehm-demers-weiser-gc
2008-09-23 19:01:01 +02:00
Neil Jerram
1dd797921c
Fix for incorrect (gcd -2) => -2; should give 2.
...
(reported by Bill Schottstaedt)
* libguile/numbers.c (scm_gcd): When only one arg given, use scm_abs
to ensure that result is non-negative.
* test-suite/tests/numbers.test ("gcd"): New test, (gcd -2).
2008-09-22 21:21:20 +01:00
Ludovic Courtès
44e268898b
Merge branch 'master' into boehm-demers-weiser-gc
...
Conflicts:
lib/Makefile.am
libguile/gc-card.c
libguile/gc-freelist.c
libguile/gc-mark.c
libguile/gc-segment.c
libguile/gc.c
libguile/gc.h
libguile/gc_os_dep.c
libguile/private-gc.h
m4/.cvsignore
m4/gnulib-cache.m4
m4/gnulib-comp.m4
2008-09-13 22:51:27 +02:00
Ludovic Courtès
dbb605f575
Include <config.h> in all C files; use #ifdef HAVE_CONFIG_H' rather than
#if'.
2008-09-13 15:35:27 +02:00
Ludovic Courtès
6f03035fe8
Merge branch 'master' into boehm-demers-weiser-gc
...
Conflicts:
libguile/Makefile.am
libguile/coop-defs.h
libguile/gc-card.c
libguile/gc-freelist.c
libguile/gc-malloc.c
libguile/gc-mark.c
libguile/gc-segment.c
libguile/gc.c
libguile/gc.h
libguile/gc_os_dep.c
libguile/hashtab.c
libguile/hashtab.h
libguile/inline.h
libguile/private-gc.h
libguile/struct.c
libguile/struct.h
libguile/threads.c
libguile/threads.h
libguile/vectors.h
libguile/weaks.h
test-suite/tests/gc.test
2008-09-10 23:09:30 +02:00
Ludovic Courtès
6774820f1e
Merge commit ' 29776e85da
' into boehm-demers-weiser-gc
...
Conflicts:
libguile/gc-card.c
libguile/gc.c
libguile/gc.h
libguile/ports.c
2008-09-10 22:50:04 +02:00
Ludovic Courtès
e9b8556ec9
Merge commit ' 7337d56d57
' into boehm-demers-weiser-gc
...
Conflicts:
libguile/struct.c
2008-09-10 22:44:31 +02:00
Ludovic Courtès
4a4849dbe0
Merge commit ' 0329137392
' into boehm-demers-weiser-gc
...
Conflicts:
libguile/gc.c
libguile/srcprop.c
libguile/srcprop.h
2008-09-10 22:33:40 +02:00
Ludovic Courtès
35a9197ccc
Merge commit ' f30e1bdf97
' into boehm-demers-weiser-gc
...
Conflicts:
libguile/Makefile.am
libguile/coop-pthreads.c
libguile/gc-freelist.c
libguile/gc-segment.c
libguile/gc.c
libguile/private-gc.h
test-suite/tests/environments.nottest
2008-09-10 22:27:30 +02:00
Ludovic Courtes
92d8fd328c
Use `scm_gc_malloc_pointerless' in various places (improves performance).
...
* libguile/fports.c (scm_fport_buffer_add): Use
`scm_gc_malloc_pointerless ()' instead of `scm_gc_malloc ()' when
allocating room for the read/write buffers.
* libguile/numbers.c (scm_c_make_rectangular): Likewise.
* libguile/ports.c (scm_ungetc): Likewise.
* libguile/random.c (scm_i_copy_rstate): Likewise.
(scm_c_make_rstate): Likewise.
* libguile/regex-posix.c (scm_make_regexp): Likewise.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-36
2008-09-10 20:27:00 +02:00
Ludovic Courtès
417566ebc9
Never define _GNU_SOURCE' explicitly since
AC_USE_SYSTEM_EXTENSIONS'
...
takes care of it.
Conflicts:
ChangeLog
configure.in
libguile/eval.c
libguile/srfi-14.c
libguile/threads.c
2008-08-20 19:31:46 +02:00
Neil Jerram
76dae88158
Fix misleading output from `(help rationalize)'
...
* numbers.c (scm_rationalize): Update docstring to match the
manual (which is more correct). Change argument "err" to "eps",
also to match the manual.
2008-08-03 00:27:32 +01:00
Ludovic Courtès
7a35784c6b
Avoid warning with GCC on FreeBSD 6.2 in `numbers.c'.
2008-05-07 21:38:11 +02:00
Neil Jerram
bca69a9fba
Only define scm_from_complex_double if it will
...
actually be used.
2008-03-09 21:57:00 +00:00
Ludovic Courtès
a2c25234fb
Use imaginary_part' instead of
imaginary' to fix build on Solaris 2.10.
2008-02-23 11:28:11 +00:00
Neil Jerram
4b26c03ec7
* numbers.c (SCM_COMPLEX_VALUE): Use GUILE_I instead of _Complex_I
...
directly, and only if GUILE_I was defined by the configure step.
(scm_log, scm_log10, scm_exp, scm_sqrt): Use SCM_COMPLEX_VALUE
code only if SCM_COMPLEX_VALUE is defined.
* configure.in (--without-64-calls): Use AC_MSG_CHECKING and
AC_MSG_RESULT instead of just echo.
(GUILE_I): New programs to try using _Complex_I or 1.0fi for the
imaginary unit.
2008-02-11 21:20:14 +00:00
Ludovic Courtès
189171c5bb
Fix compilation of `numbers.c' with Sun CC.
2008-02-06 13:51:05 +00:00
Ludovic Courtès
9cc37597af
Changes from arch/CVS synchronization
2007-12-08 16:00:56 +00:00
Kevin Ryde
90709cd75f
(scm_log): Test HAVE_CLOG as well as HAVE_COMPLEX_DOUBLE
...
before using clog(). It's possible for gcc to provide the "complex
double" type, but for the system not to have the complex funcs.
(scm_exp): Ditto HAVE_CEXP for cexp().
(clog, cexp, carg): Remove fallback definitions. These only
duplicated the code within scm_log and scm_exp, and the latter have to
exist for the case when there's no "complex double". So better just
fix up the conditionals selecting between the complex funcs and plain
doubles than worry about fallbacks.
2007-09-02 22:36:23 +00:00
Ludovic Courtès
1911e3da17
Changes from arch/CVS synchronization
2007-04-17 14:12:17 +00:00
Han-Wen Nienhuys
1d8ce4c04d
* configure.in (HAVE_CRYPT): check for cexp, clog, carg
...
* numbers.c (carg): provide carg, cexp, clog in case they are
missing.
2007-04-09 14:47:41 +00:00
Kevin Ryde
23d7256628
merge from 1.8
2007-01-15 23:42:45 +00:00
Han-Wen Nienhuys
e2bf3b19f6
* numbers.c (scm_i_fraction_reduce): move logic into
...
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-12-23 20:35:32 +00:00
Kevin Ryde
8ab3d8a068
merge from 1.8 branch
2006-10-09 23:40:48 +00:00
Ludovic Courtès
eaa94eaaa9
Changes from arch/CVS synchronization
2006-07-12 08:07:27 +00:00
Kevin Ryde
23f2b9a3de
merge from 1.8 branch
2006-06-17 23:15:59 +00:00
Kevin Ryde
2b829bbb3d
merge from 1.8 branch
2006-04-17 00:05:42 +00:00
Marius Vollmer
3a1b45fdf7
Use scm_from_bool instead of SCM_BOOL. Thanks to Peter Gavin!
2005-08-11 21:03:58 +00:00
Marius Vollmer
92205699d0
The FSF has a new address.
2005-05-23 19:57:22 +00:00
Kevin Ryde
4c6e36a6e3
(scm_divide): Correction to 1/complex and <any>/complex,
...
need to test abs(re)<abs(im) for choice of cases, otherwise divide by
zero when re==0 and im<0. Reported by Jean Crepeau.
2005-04-29 22:59:22 +00:00
Kevin Ryde
40882e3d0b
(scm_oneplus, scm_oneminus): New functions, converted from
...
scheme code in boot-9.scm.
2005-04-14 00:35:50 +00:00
Kevin Ryde
23c3b605b5
(scm_i_clonebig): Remove static, so can use in srfi-60.
2005-03-13 00:18:34 +00:00
Kevin Ryde
9806de0dca
(scm_logior): Must scm_i_normbig results as per scm_logand,
...
because OR-ing bits into a negative can reduce the value to an inum.
2005-03-13 00:16:22 +00:00
Kevin Ryde
e8c5b1f291
(scm_num_eq_p): On 64-bit systems, be careful about
...
casting inum to double since that can lose precision.
2005-03-13 00:13:10 +00:00
Kevin Ryde
7d92d3d0da
Add a copyright year.
2005-02-14 23:15:08 +00:00
Kevin Ryde
a9ad484720
In scm_difference, amend comment about normbig.
2005-02-14 23:14:35 +00:00
Kevin Ryde
788aca275f
(scm_ash): Rewrite using shifts, much faster than
...
integer-expt and multiply/divide. Inexacts and fractions no longer
supported (they happened to work before for left shifts, but not
right). Don't really need inexacts and fractions, since ash is
documented as a "bitwise operation", and all the rest of those only
take exact integers.
2005-01-27 22:51:22 +00:00
Kevin Ryde
ba6e7231e4
(scm_logtest, scm_logbit_p, scm_integer_expt): Update
...
docstrings from manual.
2005-01-15 00:01:40 +00:00
Kevin Ryde
66b1c775d2
(scm_modulo): Amend fixme comment about negative divisor
...
with "%", C99 says it's well-defined.
2004-12-10 00:00:27 +00:00
Marius Vollmer
7a1aba42cf
(scm_i_print_complex, icmplx2str): New.
...
(iflo2str): Use icmplx2str for complex numbers.
2004-10-29 14:17:20 +00:00
Marius Vollmer
b479fe9ae4
(scm_i_print_double): New.
2004-10-26 16:53:23 +00:00
Marius Vollmer
2881e77b5a
(SCM_T_INTBUFLEN): Increased to cover
...
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-10-22 13:50:39 +00:00
Marius Vollmer
1713d319b7
* numbers.c (scm_i_range_error): New.
...
* conv-integer.i.c, conv-uinteger.i.c: Use it instead of
scm_out_of_range.
2004-10-19 15:59:56 +00:00
Marius Vollmer
cd0362604b
Include <gmp.h> in numbers.h, not in
...
numbers.c.
(scm_to_mpz, scm_from_mpz): New.
Thanks to Andreas Vögele!
2004-09-21 00:42:30 +00:00
Marius Vollmer
0bafe73b5d
(scm_integer_expt): Do not accept inexact integers.
2004-09-08 14:09:01 +00:00
Kevin Ryde
1e35a229f0
Revert this:
...
(scm_integer_p): +/-inf is not an integer.
2004-09-08 01:03:06 +00:00
Kevin Ryde
8bddb01ebb
(scm_integer_expt): Reject exponent +/-inf.
...
(scm_integer_p): +/-inf is not an integer.
Bug report by Bill Schottstaedt.
2004-09-07 00:12:45 +00:00