Fix 'bitwise-bit-count' for negative arguments.

Fixes <http://bugs.gnu.org/14864>.
Reported by Göran Weinholt <goran@weinholt.se>.

* module/rnrs/arithmetic/bitwise.scm (bitwise-bit-count): If the
  argument is negative, return the 'bitwise-not' of the result of
  'logcount', as per R6RS.  Previously, 'bitwise-bit-count' was
  identical to 'logcount'.
Fix VM 'ash' for right shifts by large amounts.

Fixes <http://bugs.gnu.org/14864>.
Reported by Göran Weinholt <goran@weinholt.se>.

* libguile/vm-i-scheme.c (ash): Fallback to 'scm_ash' for right shifts
  with counts >= SCM_I_FIXNUM_BIT, since '>>' is not guaranteed to work
  correctly for large counts.
Fix rounding in scm_i_divide2double for negative arguments.

* libguile/numbers.c (INUM_LOSSLESSLY_CONVERTIBLE_TO_DOUBLE):
  New macro.
  (scm_i_divide2double): Use INUM_LOSSLESSLY_CONVERTIBLE_TO_DOUBLE to
  determine if our fast path is safe.  Previously, negative arguments
  were not checked properly.

* test-suite/tests/numbers.test (exact->inexact): Add tests.
Fix bugs in numerical equality predicate.

* libguile/numbers.c (scm_num_eq_p): Fix bug comparing fractions to
  infinities (reported by Göran Weinholt <goran@weinholt.se>).  Fix
  erroneous comment describing the logic behind inum/flonum comparison.
  Use similar logic for inum/complex comparison to avoid rounding
  errors.  Make minor indentation fixes and simplifications.

* test-suite/tests/numbers.test (=): Add tests.
numbers.test: Avoid inexact arithmetic in computation of fixnum-bit.

* test-suite/tests/numbers.test (fixnum-bit): Rewrite to avoid
  inexact arithmetic.
Avoid lossy conversion from inum to double in numerical comparisons.

* libguile/numbers.c (scm_less_p): Avoid converting inums to doubles.

* test-suite/tests/numbers.test (<): Add tests.
numbers.test: Fix inum/flonum comparison test on 32-bit machines.

* test-suite/tests/numbers.test (<): Fix inum/flonum test.
Allow fl+ and fl* to accept zero arguments.

Fixes <http://bugs.gnu.org/14869>.
Reported by Göran Weinholt <goran@weinholt.se>.

* module/rnrs/arithmetic/flonums.scm (fl+, fl*): Accept zero arguments.

* test-suite/tests/r6rs-arithmetic-flonums.test (fl+, fl*): Add tests.
flonum? returns false for complex number objects.

Fixes <http://bugs.gnu.org/14866>.
Reported by Göran Weinholt <goran@weinholt.se>.

* module/rnrs/arithmetic/flonums.scm (flonum?): Use 'real?' instead of
  'number?'.

* test-suite/tests/r6rs-arithmetic-flonums.test (flonum?): Add tests.
flfinite? applied to a NaN returns false.

Fixes <http://bugs.gnu.org/14868>.
Reported by Göran Weinholt <goran@weinholt.se>.

* module/rnrs/arithmetic/flonums.scm (flfinite?): If the argument is a
  NaN, return false.

* test-suite/tests/r6rs-arithmetic-flonums.test (flfinite?): Add test.
Flonum operations always return flonums.

Fixes <http://bugs.gnu.org/14871>.
Reported by Göran Weinholt <goran@weinholt.se>.

* module/rnrs/arithmetic/flonums.scm (ensure-flonum): New procedure.
  (fllog): Rewrite using case-lambda.  Handle negative zeroes.  Use
  'ensure-flonum'.
  (flatan): Rewrite using case-lambda.
  (flasin, flacos, flsqrt, flexpt): Use 'ensure-flonum'.

* test-suite/tests/r6rs-arithmetic-flonums.test
  (fllog, flasin, flacos, flsqrt, flexpt): Add tests.
min and max: NaNs beat infinities, per R6RS errata.

Fixes <http://bugs.gnu.org/14865>.
Reported by Göran Weinholt <goran@weinholt.se>.

* libguile/numbers.c (scm_min, scm_max): NaNs beat infinities, as per
  the R6RS errata.

* test-suite/tests/numbers.test (min, max): Update tests.
gcd and lcm support inexact integer arguments.

Fixes <http://bugs.gnu.org/14870>.
Reported by Göran Weinholt <goran@weinholt.se>.

* libguile/numbers.c (scm_gcd, scm_lcm): Support inexact integers.

* test-suite/tests/numbers.test (gcd, lcm): Add tests.
Fix 'fxbit-count' for negative arguments.

Reported by Göran Weinholt <goran@weinholt.se>.

* module/rnrs/arithmetic/fixnums.scm (fxbit-count): If the argument is
  negative, return the 'bitwise-not' of the result of 'logcount', as per
  R6RS.  Previously, 'fxbit-count' was identical to 'logcount'.

* test-suite/tests/r6rs-arithmetic-fixnums.test (fxbit-count): Add test.
Update copyright dates of recently-changed R6RS bitwise/flonums files.

* module/rnrs/arithmetic/bitwise.scm:
  module/rnrs/arithmetic/flonums.scm:
  test-suite/tests/r6rs-arithmetic-bitwise.test:
  test-suite/tests/r6rs-arithmetic-flonums.test: Add 2013 to the
  copyright dates.
Fix R6RS 'fixnum-width'.

Fixes <http://bugs.gnu.org/14879>.
Reported by Göran Weinholt <goran@weinholt.se>.

* module/rnrs/arithmetic/fixnums.scm (fixnum-width): Rewrite to avoid
  inexact arithmetic, and correct the off-by-one error.

* test-suite/tests/r6rs-arithmetic-fixnums.test (fixnum-width): Add
  tests.
Add support for HTTP proxies.

* module/web/http.scm (http-proxy-port?, set-http-proxy-port?!): New
  exported procedures.
  (write-request-line): If we're using an http proxy, write an
  absolute-URI in the request line.

* module/web/client.scm: Import (web http).
  (current-http-proxy): New exported parameter.
  (open-socket-for-uri): If 'current-http-proxy' is not false,
  connect to the proxy instead of the URI host, and use
  'set-http-proxy-port?!' to make note of that fact.

* doc/ref/web.texi (Web Client): Document 'current-http-proxy'.
build: Add `gdbinit' to the distribution.

* Makefile.am (EXTRA_DIST): Add gdbinit.
Fix 'SCM_SYSCALL' to really swallow EINTR.

* libguile/_scm.h (SCM_SYSCALL): Keep looping upon EINTR.
  Reported at
  <http://lists.gnu.org/archive/html/guile-devel/2013-06/msg00050.html>.
Modify SCM_UNPACK type check to avoid warnings in clang.

* libguile/tags.h (SCM_UNPACK): Change (*(SCM*)0=(x)) to
  (*(volatile SCM *)0=(x)), to avoid null-dereference warnings
  from clang.  Reported by Shane Celis <shane.celis@gmail.com>.