summaryrefslogtreecommitdiffstats
path: root/contrib/bc/lib
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2000-01-16 10:01:07 +0000
committerobrien <obrien@FreeBSD.org>2000-01-16 10:01:07 +0000
commit9657c835ffcf45e0a6d46f291505b0b112f8a244 (patch)
tree5d5d9173806480632c39d4481d45259688119985 /contrib/bc/lib
parent0ec6169bea8adb8ddbf8f9ce363f6e1803f88621 (diff)
downloadFreeBSD-src-9657c835ffcf45e0a6d46f291505b0b112f8a244.zip
FreeBSD-src-9657c835ffcf45e0a6d46f291505b0b112f8a244.tar.gz
Import GNU bc 1.05a.
Diffstat (limited to 'contrib/bc/lib')
-rw-r--r--contrib/bc/lib/Makefile.in96
-rw-r--r--contrib/bc/lib/number.c15
2 files changed, 67 insertions, 44 deletions
diff --git a/contrib/bc/lib/Makefile.in b/contrib/bc/lib/Makefile.in
index 2b58b3c..4d3ca83 100644
--- a/contrib/bc/lib/Makefile.in
+++ b/contrib/bc/lib/Makefile.in
@@ -1,8 +1,14 @@
-# Makefile.in generated automatically by automake 1.1n from Makefile.am
+# Makefile.in generated automatically by automake 1.3 from Makefile.am
-# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
SHELL = /bin/sh
@@ -26,6 +32,8 @@ mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
+DISTDIR =
+
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
@@ -43,14 +51,15 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
-NORMAL_INSTALL = true
-PRE_INSTALL = true
-POST_INSTALL = true
-NORMAL_UNINSTALL = true
-PRE_UNINSTALL = true
-POST_UNINSTALL = true
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
CC = @CC@
LEX = @LEX@
+MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
VERSION = @VERSION@
@@ -76,7 +85,7 @@ libbc_a_OBJECTS = getopt.o getopt1.o vfprintf.o number.o
AR = ar
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-LINK = $(CC) $(LDFLAGS) -o $@
+LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in
@@ -87,14 +96,14 @@ GZIP = --best
SOURCES = $(libbc_a_SOURCES)
OBJECTS = $(libbc_a_OBJECTS)
-default: all
+all: Makefile $(LIBRARIES)
.SUFFIXES:
-.SUFFIXES: .c .o
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile
+.SUFFIXES: .S .c .o .s
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps lib/Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
@@ -102,7 +111,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
mostlyclean-noinstLIBRARIES:
clean-noinstLIBRARIES:
- test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
distclean-noinstLIBRARIES:
@@ -111,47 +120,56 @@ maintainer-clean-noinstLIBRARIES:
.c.o:
$(COMPILE) -c $<
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
mostlyclean-compile:
- rm -f *.o core
+ -rm -f *.o core *.core
clean-compile:
distclean-compile:
- rm -f *.tab.c
+ -rm -f *.tab.c
maintainer-clean-compile:
libbc.a: $(libbc_a_OBJECTS) $(libbc_a_DEPENDENCIES)
- rm -f libbc.a
+ -rm -f libbc.a
$(AR) cru libbc.a $(libbc_a_OBJECTS) $(libbc_a_LIBADD)
$(RANLIB) libbc.a
tags: TAGS
-ID: $(HEADERS) $(SOURCES)
- here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES)
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
- done; \
- test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \
- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
- rm -f TAGS ID
+ -rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = lib
+
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
@@ -175,27 +193,25 @@ install: install-exec install-data all
uninstall:
-all: $(LIBRARIES) Makefile
-
install-strip:
- $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
+ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
mostlyclean-generic:
- test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
- test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- rm -f Makefile $(DISTCLEANFILES)
- rm -f config.cache config.log stamp-h
- test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -rm -f Makefile $(DISTCLEANFILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
- test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
- test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-noinstLIBRARIES mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
@@ -204,7 +220,7 @@ clean: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \
distclean: distclean-noinstLIBRARIES distclean-compile distclean-tags \
distclean-generic clean
- rm -f config.status
+ -rm -f config.status
maintainer-clean: maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile maintainer-clean-tags \
@@ -212,7 +228,7 @@ maintainer-clean: maintainer-clean-noinstLIBRARIES \
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
-.PHONY: default mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
+.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
diff --git a/contrib/bc/lib/number.c b/contrib/bc/lib/number.c
index e1ada04..469d44c8b 100644
--- a/contrib/bc/lib/number.c
+++ b/contrib/bc/lib/number.c
@@ -1,7 +1,7 @@
/* number.c: Implements arbitrary precision numbers. */
/* This file is part of GNU bc.
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1031,6 +1031,10 @@ bc_raisemod (base, expo, mod, result, scale)
temp = copy_num (_one_);
init_num (&parity);
+ /* Check the base for scale digits. */
+ if (base->n_scale != 0)
+ rt_warn ("non-zero scale in base");
+
/* Check the exponent for scale digits. */
if (exponent->n_scale != 0)
{
@@ -1209,8 +1213,11 @@ bc_sqrt (num, scale)
/* Calculate the initial guess. */
if (cmp_res < 0)
- /* The number is between 0 and 1. Guess should start at 1. */
- guess = copy_num (_one_);
+ {
+ /* The number is between 0 and 1. Guess should start at 1. */
+ guess = copy_num (_one_);
+ cscale = (*num)->n_scale;
+ }
else
{
/* The number is greater than 1. Guess should start at 10^(exp/2). */
@@ -1221,11 +1228,11 @@ bc_sqrt (num, scale)
guess1->n_scale = 0;
bc_raise (guess, guess1, &guess, 0);
free_num (&guess1);
+ cscale = 3;
}
/* Find the square root using Newton's algorithm. */
done = FALSE;
- cscale = 3;
while (!done)
{
free_num (&guess1);
OpenPOWER on IntegriCloud