summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authordrochner <drochner>2005-07-27 17:06:53 +0000
committerdrochner <drochner>2005-07-27 17:06:53 +0000
commite68659fe677739ffd9f9fd25a3aeb3dcccec2903 (patch)
treeaf4dfc87f5ef189f5bf723b31399c7213e05c865 /benchmarks
parent820daf9a1ed5f0d24d9586eaff8f4229d7e92c33 (diff)
downloadpkgsrc-e68659fe677739ffd9f9fd25a3aeb3dcccec2903.tar.gz
import "zelibm", a tool to check the accuracy of some libm functions,
by Ulrich Drepper
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/zelibm/DESCR8
-rw-r--r--benchmarks/zelibm/Makefile21
-rw-r--r--benchmarks/zelibm/PLIST2
-rw-r--r--benchmarks/zelibm/distinfo9
-rw-r--r--benchmarks/zelibm/patches/patch-aa77
-rw-r--r--benchmarks/zelibm/patches/patch-ab21
-rw-r--r--benchmarks/zelibm/patches/patch-ac35
-rw-r--r--benchmarks/zelibm/patches/patch-ad28
-rw-r--r--benchmarks/zelibm/patches/patch-ae17
9 files changed, 218 insertions, 0 deletions
diff --git a/benchmarks/zelibm/DESCR b/benchmarks/zelibm/DESCR
new file mode 100644
index 00000000000..8c9f5eb92fb
--- /dev/null
+++ b/benchmarks/zelibm/DESCR
@@ -0,0 +1,8 @@
+A little program I wrote can be used to analyze the quality of the math
+library implementation. It simply computes the real result with a high
+precision and determines from this the error of the value the libm
+implementation produced. Very easy.
+To make the time waiting for the result a bit more interesting the program
+displays the error graphically in an updated window. Once the program is
+done it writes the plot in a GIF file which then can be used for later
+reference.
diff --git a/benchmarks/zelibm/Makefile b/benchmarks/zelibm/Makefile
new file mode 100644
index 00000000000..c6ad07080f6
--- /dev/null
+++ b/benchmarks/zelibm/Makefile
@@ -0,0 +1,21 @@
+# $NetBSD: Makefile,v 1.1.1.1 2005/07/27 17:06:53 drochner Exp $
+#
+
+DISTNAME= zelibm
+PKGNAME= zelibm-0
+CATEGORIES= benchmarks
+MASTER_SITES= http://people.redhat.com/drepper/libm/
+
+MAINTAINER= tech-pkg@NetBSD.org
+HOMEPAGE= http://people.redhat.com/drepper/libm/
+COMMENT= Visual Math Library Quality Check
+
+USE_TOOLS+= gmake
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/libmtest ${PREFIX}/bin
+
+.include "../../mk/x11.buildlink3.mk"
+.include "../../devel/gmp/buildlink3.mk"
+.include "../../graphics/gd/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/benchmarks/zelibm/PLIST b/benchmarks/zelibm/PLIST
new file mode 100644
index 00000000000..d8a51748d58
--- /dev/null
+++ b/benchmarks/zelibm/PLIST
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2005/07/27 17:06:53 drochner Exp $
+bin/libmtest
diff --git a/benchmarks/zelibm/distinfo b/benchmarks/zelibm/distinfo
new file mode 100644
index 00000000000..85901f66a27
--- /dev/null
+++ b/benchmarks/zelibm/distinfo
@@ -0,0 +1,9 @@
+$NetBSD: distinfo,v 1.1.1.1 2005/07/27 17:06:53 drochner Exp $
+
+SHA1 (zelibm.tar.gz) = 2fc4366ed466d766042b59c1ce303a1b53f722d3
+Size (zelibm.tar.gz) = 17616 bytes
+SHA1 (patch-aa) = f6ed33fc79d547cc559ba2343c160f18dd88e94d
+SHA1 (patch-ab) = 066bfcb106c946fd706d221d5e5b8dd8e9c9ece8
+SHA1 (patch-ac) = d7384d0c8878536057024253b281e9dd77936ea5
+SHA1 (patch-ad) = 24cc1d6d60a283d1f3922fb1b5223f4f01caacf5
+SHA1 (patch-ae) = 2ab8860c538040c040540529b5d2101c42b7b1eb
diff --git a/benchmarks/zelibm/patches/patch-aa b/benchmarks/zelibm/patches/patch-aa
new file mode 100644
index 00000000000..edd2a02c646
--- /dev/null
+++ b/benchmarks/zelibm/patches/patch-aa
@@ -0,0 +1,77 @@
+$NetBSD: patch-aa,v 1.1.1.1 2005/07/27 17:06:53 drochner Exp $
+
+--- dbl2mpq.c.orig 2004-04-16 21:29:16.000000000 +0200
++++ dbl2mpq.c 2004-04-16 21:52:52.000000000 +0200
+@@ -5,7 +5,7 @@
+
+ #include <float.h>
+ #include <gmp.h>
+-#include <ieee754.h>
++#include <machine/ieee.h>
+ #include <stdlib.h>
+
+ #include "zelibm.h"
+@@ -14,50 +14,50 @@
+ void
+ extract_double (mpq_t r, double d)
+ {
+- union ieee754_double u;
++ union ieee_double_u u;
+ unsigned int val;
+
+ /* Make the floating point value available in the broken down form. We
+ cannot use casting of pointers and other ugly ways to access the bits.
+ Using the union is the only half-way clean method. */
+- u.d = d;
++ u.dblu_d = d;
+
+ mpq_init (r);
+
+ /* Set the high word and the denominator to 1. */
+- val = u.ieee.mantissa0;
+- if (u.ieee.exponent != 0)
++ val = u.dblu_dbl.dbl_frach;
++ if (u.dblu_dbl.dbl_exp != 0)
+ val |= 1 << (DBL_MANT_DIG - 32 - 1);
+ mpq_set_ui (r, val, 1);
+ /* Shift in the right position. */
+ mpz_mul_2exp (mpq_numref (r), mpq_numref (r), 32);
+ /* Add the lower word. */
+- mpz_add_ui (mpq_numref (r), mpq_numref (r), u.ieee.mantissa1);
++ mpz_add_ui (mpq_numref (r), mpq_numref (r), u.dblu_dbl.dbl_fracl);
+
+- if (u.ieee.exponent == 0)
++ if (u.dblu_dbl.dbl_exp == 0)
+ {
+- if (u.ieee.mantissa0 != 0 && u.ieee.mantissa1 != 0)
++ if (u.dblu_dbl.dbl_frach != 0 && u.dblu_dbl.dbl_fracl != 0)
+ {
+ /* The number is a denormalized. */
+ mpz_mul_2exp (mpq_denref (r), mpq_denref (r),
+ -DBL_MIN_EXP + DBL_MANT_DIG + 1);
+ }
+ }
+- else if (u.ieee.exponent >= IEEE754_DOUBLE_BIAS + DBL_MANT_DIG)
++ else if (u.dblu_dbl.dbl_exp >= DBL_EXP_BIAS + DBL_MANT_DIG)
+ {
+ /* We have to multiply the numerator with the exponent. */
+ mpz_mul_2exp (mpq_numref (r), mpq_numref (r),
+- (u.ieee.exponent
+- - (IEEE754_DOUBLE_BIAS + DBL_MANT_DIG - 1)));
++ (u.dblu_dbl.dbl_exp
++ - (DBL_EXP_BIAS + DBL_MANT_DIG - 1)));
+ }
+ else
+ {
+ /* Set denominator to the appropriate power of 2. */
+ mpz_mul_2exp (mpq_denref (r), mpq_denref (r),
+- ((IEEE754_DOUBLE_BIAS + DBL_MANT_DIG - 1)
+- - u.ieee.exponent));
++ ((DBL_EXP_BIAS + DBL_MANT_DIG - 1)
++ - u.dblu_dbl.dbl_exp));
+ }
+
+- if (u.ieee.negative)
++ if (u.dblu_dbl.dbl_sign)
+ mpq_neg (r, r);
+ }
diff --git a/benchmarks/zelibm/patches/patch-ab b/benchmarks/zelibm/patches/patch-ab
new file mode 100644
index 00000000000..29fd4b16464
--- /dev/null
+++ b/benchmarks/zelibm/patches/patch-ab
@@ -0,0 +1,21 @@
+$NetBSD: patch-ab,v 1.1.1.1 2005/07/27 17:06:53 drochner Exp $
+
+--- libmtest.c.orig 2004-04-16 21:22:20.000000000 +0200
++++ libmtest.c 2004-04-16 21:23:56.000000000 +0200
+@@ -4,7 +4,6 @@
+ form on Microsoft and Be systems. */
+
+ #include <errno.h>
+-#include <error.h>
+ #include <float.h>
+ #include <gmp.h>
+ #include <math.h>
+@@ -214,7 +213,7 @@
+ /* Allocate the memory for the result. */
+ result = (double *) calloc (n, 2 * sizeof (double));
+ if (result == NULL)
+- error (EXIT_FAILURE, errno, "cannot create array for result");
++ exit (EXIT_FAILURE);
+
+ for (cnt = 0; cnt < nprocs; ++cnt)
+ {
diff --git a/benchmarks/zelibm/patches/patch-ac b/benchmarks/zelibm/patches/patch-ac
new file mode 100644
index 00000000000..fcc9b938c41
--- /dev/null
+++ b/benchmarks/zelibm/patches/patch-ac
@@ -0,0 +1,35 @@
+$NetBSD: patch-ac,v 1.1.1.1 2005/07/27 17:06:53 drochner Exp $
+
+--- zerandom.c.orig 2004-04-16 21:53:15.000000000 +0200
++++ zerandom.c 2004-04-16 21:57:46.000000000 +0200
+@@ -3,7 +3,7 @@
+ As a special restriction the file must not be used in this or a modified
+ form on Microsoft and Be systems. */
+
+-#include <ieee754.h>
++#include <machine/ieee.h>
+ #include <stdlib.h>
+
+ #include "zelibm.h"
+@@ -15,15 +15,15 @@
+ /* Get two 31 bit random numbers for the initial mantissa. */
+ unsigned int r1 = random ();
+ unsigned int r2 = random ();
+- union ieee754_double u;
++ union ieee_double_u u;
+ double res;
+
+- u.ieee.negative = 0;
+- u.ieee.exponent = IEEE754_DOUBLE_BIAS - 1;
+- u.ieee.mantissa0 = r1 >> 1;
+- u.ieee.mantissa1 = r2 | r1 << 31;
++ u.dblu_dbl.dbl_sign = 0;
++ u.dblu_dbl.dbl_exp = DBL_EXP_BIAS - 1;
++ u.dblu_dbl.dbl_frach = r1 >> 1;
++ u.dblu_dbl.dbl_fracl = r2 | r1 << 31;
+
+- res = low + 2 * (u.d - 0.5) * (high - low);
++ res = low + 2 * (u.dblu_d - 0.5) * (high - low);
+
+ while (res > high)
+ res /= 2.0;
diff --git a/benchmarks/zelibm/patches/patch-ad b/benchmarks/zelibm/patches/patch-ad
new file mode 100644
index 00000000000..bb319bfc235
--- /dev/null
+++ b/benchmarks/zelibm/patches/patch-ad
@@ -0,0 +1,28 @@
+$NetBSD: patch-ad,v 1.1.1.1 2005/07/27 17:06:53 drochner Exp $
+
+--- image.c.orig 1998-11-25 03:55:32.000000000 +0100
++++ image.c 2004-04-16 22:30:55.000000000 +0200
+@@ -4,7 +4,6 @@
+ form on Microsoft and Be systems. */
+
+ #include <errno.h>
+-#include <error.h>
+ #include <math.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -128,12 +127,12 @@
+
+ /* Write out the result. */
+ strcpy (outname, name);
+- strcat (outname, ".gif");
++ strcat (outname, ".png");
+ outfile = fopen (outname, "w");
+ if (outfile == NULL)
+- error (EXIT_FAILURE, errno, "cannot open output file `%s'", outname);
++ exit (EXIT_FAILURE);
+
+- gdImageGif (im_out, outfile);
++ gdImagePng (im_out, outfile);
+
+ fclose (outfile);
+
diff --git a/benchmarks/zelibm/patches/patch-ae b/benchmarks/zelibm/patches/patch-ae
new file mode 100644
index 00000000000..a549f80c747
--- /dev/null
+++ b/benchmarks/zelibm/patches/patch-ae
@@ -0,0 +1,17 @@
+$NetBSD: patch-ae,v 1.1.1.1 2005/07/27 17:06:53 drochner Exp $
+
+--- Makefile.orig 1998-11-30 03:37:23.000000000 +0100
++++ Makefile 2004-04-16 22:14:53.000000000 +0200
+@@ -3,9 +3,9 @@
+ zecos.c zecos_d.c zesinh.c zesinh_d.c zecosh.c zecosh_d.c \
+ zesqrt.c zesqrt_d.c zetan.c zetan_d.c zetanh.c zetanh_d.c
+
+-CFLAGS = -O -g -D_GNU_SOURCE -Wall
+-INCLUDES = -I. -I/usr/local/include -I/usr/X11R6/include -I/happy/clown/H-egcs-i686-linux-gnu/include
+-LDFLAGS = -L/usr/local/lib -L/usr/X11R6/lib
++#CFLAGS = -O -g -D_GNU_SOURCE -Wall
++INCLUDES = -I.
++#LDFLAGS = -L/usr/local/lib -L/usr/X11R6/lib
+
+ COMPILE = $(CC) -c -o $@ $(CFLAGS) $(INCLUDES) $<
+