Add a port of ndiff:

ndiff is a utility for comparing putatively similar files, ignoring small
numeric differences.  The utility is written by Nelson H.  F. Beebe and
covered by the GNU General Public License (GPL), version 2.  It may be
built with arbitrary precision support (more powerful) or using built-in
floating point precision, see Makefile.

Assessing the consistency of a numerical program run in multiple
environments (operating systems, architectures, or compilers) can be a
difficult task for a human, as small differences in numerical output values
are expected.  File differencing utilites, such as diff(1), will generally
produce voluminous output, often longer than the original files.

ndiff solves this problem. Taking two two text files expected to be
identical, or at least numerically similar, it allows to specify absolute
and/or relative error tolerances for differences between numerical values
in the two files, and then reports only the lines with values exceeding
those tolerances.  It also tells by how much they differ. A simple example:

% ndiff --relative-error 1.0e-3 test019.txt.1 test019.txt.2
### Maximum relative error in matching lines = 8.64e-51 at line 129 field 4

WWW: http://www.math.utah.edu/~beebe/software/ndiff/

I've cleaned up the submitted version a little.

PR:		62221
Submitted by:	Stefan A. Deutscher <sad@mailaps.org>
This commit is contained in:
Greg Lewis 2004-02-18 22:02:39 +00:00
parent 84b0649880
commit 9404716e92
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=101356
6 changed files with 111 additions and 0 deletions

View file

@ -96,6 +96,7 @@
SUBDIR += mupad
SUBDIR += naturalmath
SUBDIR += nauty
SUBDIR += ndiff
SUBDIR += netcdf
SUBDIR += newmat
SUBDIR += ngraph

44
math/ndiff/Makefile Normal file
View file

@ -0,0 +1,44 @@
# New ports collection makefile for: ndiff
# Date created: 31 January 2004
# Whom: Stefan A. Deutscher (sad@mailaps.org)
#
# $FreeBSD$
#
PORTNAME= ndiff
PORTVERSION= 2.00
CATEGORIES= math
MASTER_SITES= ftp://ftp.math.utah.edu/pub/misc/
PKGNAMEPREFIX=
MAINTAINER= ports@FreeBSD.org
COMMENT= Compare putatively similar files, ignoring small numeric differences
.if !defined(WITHOUT_GMP)
LIB_DEPENDS= gmp:${PORTSDIR}/math/libgmp-freebsd
.endif
GNU_CONFIGURE= yes
ALL_TARGET= all check
MAN1= ndiff.1
.if !defined(NOPORTDOCS)
PORTDOCS= *
.endif
post-build:
@${ECHO_MSG} "If there were no errors in the above checks then type"
@${ECHO_MSG}
@${ECHO_MSG} " ${MAKE} install"
@${ECHO_MSG}
@${ECHO_MSG} "to install ${PORTNAME}-${PORTVERSION}"
post-install:
.if !defined(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.pdf ${DOCSDIR}
${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.ps ${DOCSDIR}
${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.html ${DOCSDIR}
.endif
.include <bsd.port.mk>

2
math/ndiff/distinfo Normal file
View file

@ -0,0 +1,2 @@
MD5 (ndiff-2.00.tar.gz) = 885548b4dc26e72c5455bebb5ba6c16d
SIZE (ndiff-2.00.tar.gz) = 230850

View file

@ -0,0 +1,36 @@
--- Makefile.in.orig Wed Feb 18 14:17:22 2004
+++ Makefile.in Wed Feb 18 14:19:31 2004
@@ -602,14 +602,12 @@
if test -f $(PROGNAME) ; \
then \
$(CP) $(PROGNAME) $(bindir)/$(PROGNAME) ; \
- $(LN) $(bindir)/$(PROGNAME) $(bindir)/$(PROGNAME)-$(VERSION) ; \
else \
for f in $(SHFILES) ; \
do \
g=`basename $$f .sh` ; \
$(SEDCMD) $$f | $(CHECKSUM) > $(bindir)/$$g ; \
- $(LN) $(bindir)/$$g $(bindir)/$$g-$(VERSION) ; \
- $(CHMOD) 775 $(bindir)/$$g $(bindir)/$$g-$(VERSION) ; \
+ $(CHMOD) 775 $(bindir)/$$g ; \
done ; \
fi
@@ -635,7 +633,7 @@
install-show:
@echo ''
@echo Installed files...
- @$(LS) -l $(bindir)/$(PROGNAME) $(bindir)/$(PROGNAME)-$(VERSION)
+ @$(LS) -l $(bindir)/$(PROGNAME)
@$(LS) -l $(mandir)/$(PROGNAME).$(manext)
@if test -d $(shrlibdir) ; then $(LS) -lR $(shrlibdir)/* ; fi
@echo ''
@@ -703,7 +701,7 @@
uninstall-exe:
-for f in $(PROGRAMS) ; \
do \
- $(RM) $(bindir)/$$f $(bindir)/$$f-$(VERSION) 2>/dev/null; \
+ $(RM) $(bindir)/$$f 2>/dev/null; \
done
uninstall-man:

24
math/ndiff/pkg-descr Normal file
View file

@ -0,0 +1,24 @@
ndiff is a utility for comparing putatively similar files, ignoring small
numeric differences. The utility is written by Nelson H. F. Beebe and
covered by the GNU General Public License (GPL), version 2. It may be
built with arbitrary precision support (more powerful) or using built-in
floating point precision, see Makefile.
Assessing the consistency of a numerical program run in multiple
environments (operating systems, architectures, or compilers) can be a
difficult task for a human, as small differences in numerical output values
are expected. File differencing utilites, such as diff(1), will generally
produce voluminous output, often longer than the original files.
ndiff solves this problem. Taking two two text files expected to be
identical, or at least numerically similar, it allows to specify absolute
and/or relative error tolerances for differences between numerical values
in the two files, and then reports only the lines with values exceeding
those tolerances. It also tells by how much they differ. A simple example:
% ndiff --relative-error 1.0e-3 test019.txt.1 test019.txt.2
### Maximum relative error in matching lines = 8.64e-51 at line 129 field 4
WWW: http://www.math.utah.edu/~beebe/software/ndiff/
Have fun. Stefan (sad@mailaps.org)

4
math/ndiff/pkg-plist Normal file
View file

@ -0,0 +1,4 @@
bin/ndiff
share/lib/ndiff/ndiff-2.00/ndiff.awk
@dirrm share/lib/ndiff/ndiff-2.00
@dirrm share/lib/ndiff