[crlibm] Initial package

Tim Niemueller timn at fedoraproject.org
Mon Mar 21 14:13:17 UTC 2011


commit 6dd23cbe10b6678e8c3d2309c6e423d5307c22b0
Author: Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:   Tue Feb 22 13:40:23 2011 +0100

    Initial package

 .gitignore                   |    4 +
 crlibm-1.0beta4-shared.patch |  337 ++++++++++++++++++++++++++++++++++++++++++
 crlibm.spec                  |   90 +++++++++++
 sources                      |    1 +
 4 files changed, 432 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..1af312f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,4 @@
+/crlibm-1.0beta4*
+/.build*
+/x86_64
+/*.src.rpm
diff --git a/crlibm-1.0beta4-shared.patch b/crlibm-1.0beta4-shared.patch
new file mode 100644
index 0000000..005cfb0
--- /dev/null
+++ b/crlibm-1.0beta4-shared.patch
@@ -0,0 +1,337 @@
+diff -urN crlibm-1.0beta4/configure.ac crlibm-1.0beta4.fedora/configure.ac
+--- crlibm-1.0beta4/configure.ac	2010-03-04 19:10:34.000000000 +0100
++++ crlibm-1.0beta4.fedora/configure.ac	2011-02-19 23:51:11.669673012 +0100
+@@ -50,6 +50,7 @@
+ dnl Check for compiler
+ 
+ AC_PROG_CC(gcc icc cc)
++AC_PROG_LIBTOOL
+ 
+ # Try to set compiler flags to get floating point arithmetics 
+ # to work. This is an old heritage and should become useless within 30 years
+@@ -222,10 +223,8 @@
+ AM_CONDITIONAL(USE_HARDWARE_DE, test x$has_ia32_de = xtrue  -a x$has_fpu_control = xyes  -a x$enable_double_extended = xyes -a x$enable_interval_functions = xno    )
+ dnl  Note that at the moment, enabling intervals disables double-extended
+ 
+-
+-
+-
+-
++AC_CHECK_HEADER(scs.h,,MAYBE_SCS=scs)
++AC_SUBST([MAYBE_SCS])
+ 
+ 
+ 
+@@ -413,7 +412,7 @@
+ 
+ 
+ 
+-AC_CONFIG_FILES([Makefile tests/Makefile scs_lib/Makefile])
++AC_CONFIG_FILES([Makefile tests/Makefile])
+ AC_OUTPUT
+ 
+ 
+diff -urN crlibm-1.0beta4/crlibm_private.h crlibm-1.0beta4.fedora/crlibm_private.h
+--- crlibm-1.0beta4/crlibm_private.h	2010-03-04 19:10:34.000000000 +0100
++++ crlibm-1.0beta4.fedora/crlibm_private.h	2011-02-20 00:07:16.330890556 +0100
+@@ -8,9 +8,15 @@
+ #ifndef CRLIBM_PRIVATE_H
+ #define CRLIBM_PRIVATE_H 1
+ 
+-#include "scs_lib/scs.h"
+-#include "scs_lib/scs_private.h"
++#include <scs.h>
+ 
++/* undef all the variables that might have been defined in scs_config.h */
++#undef VERSION 
++#undef PACKAGE 
++#undef HAVE_GMP_H
++#undef HAVE_MPFR_H
++#undef HAVE_MATHLIB_H
++/* then include the proper definitions  */
+ #ifdef HAVE_CONFIG_H
+ #include "crlibm_config.h"
+ #endif
+@@ -20,6 +26,43 @@
+ #include <inttypes.h>
+ #endif
+ 
++#define db_number scs_db_number
++
++#ifdef WORDS_BIGENDIAN
++ #define HI 0
++ #define LO 1 
++#else
++ #define HI 1
++ #define LO 0
++#endif
++
++#define SCS_RADIX   ((unsigned int)(1<<SCS_NB_BITS))
++#define SCS_MASK_RADIX ((unsigned int)(SCS_RADIX-1))
++
++#define R_HW  result->h_word
++#define R_SGN result->sign
++#define R_IND result->index
++#define R_EXP result->exception.d
++
++#define X_HW  x->h_word
++#define X_SGN x->sign
++#define X_IND x->index
++#define X_EXP x->exception.d
++
++#define Y_HW  y->h_word
++#define Y_SGN y->sign
++#define Y_IND y->index
++#define Y_EXP y->exception.d
++
++#define Z_HW  z->h_word
++#define Z_SGN z->sign
++#define Z_IND z->index
++#define Z_EXP z->exception.d
++
++#define W_HW  w->h_word
++#define W_SGN w->sign
++#define W_IND w->index
++#define W_EXP w->exception.d
+ 
+ 
+ #if (defined(CRLIBM_TYPECPU_X86) || defined(CRLIBM_TYPECPU_AMD64))
+diff -urN crlibm-1.0beta4/Makefile.am crlibm-1.0beta4.fedora/Makefile.am
+--- crlibm-1.0beta4/Makefile.am	2009-02-26 17:20:14.000000000 +0100
++++ crlibm-1.0beta4.fedora/Makefile.am	2011-02-19 15:16:57.304164823 +0100
+@@ -1,6 +1,6 @@
+ ## Process this file with automake to produce Makefile.in
+ 
+-lib_LIBRARIES = libcrlibm.a
++lib_LTLIBRARIES = libcrlibm.la
+ 
+ # shared libraries need libtool. We'll do it later.
+ #lib_LTLIBRARIES = libcrlibm.la
+@@ -8,7 +8,7 @@
+ 
+ # Note that at the moment, asking for intervals disables double-extended
+ if USE_HARDWARE_DE
+-libcrlibm_a_SOURCES =  \
++libcrlibm_la_SOURCES =  \
+ 	crlibm.h crlibm_private.h crlibm_private.c double-extended.h\
+ 	triple-double.h triple-double.c\
+ 	exp-td.h exp-td.c exp-td-standalone.c expm1-standalone.c  \
+@@ -25,7 +25,7 @@
+ 	atan_fast.c atan_fast.h atan_accurate.h atan_accurate.c \
+ 	csh_fast.h csh_fast.c
+ else 
+-libcrlibm_a_SOURCES =  \
++libcrlibm_la_SOURCES =  \
+ 	crlibm.h crlibm_private.h crlibm_private.c \
+ 	triple-double.h triple-double.c\
+ 	exp-td.h exp-td.c exp-td-standalone.c expm1-standalone.c  \
+@@ -41,16 +41,11 @@
+ 	csh_fast.h csh_fast.c 
+ endif
+ 
+-
+-# add all the scs_lib useful functions
+-libcrlibm_a_LIBADD = scs_lib/scs_private.o scs_lib/addition_scs.o  \
+-	scs_lib/division_scs.o scs_lib/print_scs.o\
+-	scs_lib/double2scs.o scs_lib/zero_scs.o\
+-	scs_lib/multiplication_scs.o scs_lib/scs2double.o
++libcrlibm_la_LIBADD = -lscs
+ 
+ include_HEADERS = crlibm.h
+ 
+-SUBDIRS = scs_lib . tests
++SUBDIRS = $(MAYBE_SCS) . tests
+ 
+ # Add your compiler here. Default is assumed to be gcc.
+ if COMPILER_ICC
+@@ -126,7 +121,6 @@
+ 	docs/latex/fig_scs docs/latex/fig_exp\
+ 	docs/latex/elem-fun.bib\
+ 	docs/latex/tripledoubleprocedures.tex \
+-	scs_lib/tests/tbx_timing.h \
+ 	tests/testperfs.sh\
+ 	triple-double.h double-extended.h \
+ 	log-de.c log-de.h log-td.c log-td.h\
+diff -urN crlibm-1.0beta4/scs_lib/Makefile.am crlibm-1.0beta4.fedora/scs_lib/Makefile.am
+--- crlibm-1.0beta4/scs_lib/Makefile.am	2007-01-24 15:41:51.000000000 +0100
++++ crlibm-1.0beta4.fedora/scs_lib/Makefile.am	2011-02-08 23:00:48.811601680 +0100
+@@ -1,11 +1,11 @@
+ ## Process this file with automake to produce Makefile.in
+ 
+ 
+-lib_LIBRARIES = libscs.a
++lib_LTLIBRARIES = libscs.la
+ INCLUDES=-I$(top_srcdir)
+ 
+ 
+-libscs_a_SOURCES = scs.h scs_private.h scs_private.c \
++libscs_la_SOURCES = scs.h scs_private.h scs_private.c \
+ 	double2scs.c print_scs.c \
+ 	division_scs.c\
+ 	addition_scs.c multiplication_scs.c\
+Binärdateien crlibm-1.0beta4/scs_lib/.scs_private.h.swp and crlibm-1.0beta4.fedora/scs_lib/.scs_private.h.swp sind verschieden.
+diff -urN crlibm-1.0beta4/tests/Makefile.am crlibm-1.0beta4.fedora/tests/Makefile.am
+--- crlibm-1.0beta4/tests/Makefile.am	2009-02-26 16:59:10.000000000 +0100
++++ crlibm-1.0beta4.fedora/tests/Makefile.am	2011-02-08 23:00:58.220567349 +0100
+@@ -8,10 +8,8 @@
+ bin_PROGRAMS =  crlibm_testval crlibm_soaktest crlibm_testperf  crlibm_blindtest crlibm_generate_test_vectors
+ endif
+ 
+-LDADD= $(top_builddir)/libcrlibm.a
++LDADD= $(top_builddir)/libcrlibm.la
+ INCLUDES=-I$(top_srcdir)
+-../libcrlibm.a:
+-	cd $(top_srcdir); make libcrlibm.a 
+ 
+ crlibm_testval_SOURCES = test_val.c test_common.c test_common.h
+ crlibm_soaktest_SOURCES = soak_test.c test_common.c test_common.h
+@@ -75,4 +73,4 @@
+ sin.testdata cos.testdata tan.testdata asin.testdata acos.testdata atan.testdata sinh.testdata cosh.testdata \
+ sinpi.testdata cospi.testdata tanpi.testdata asinpi.testdata acospi.testdata atanpi.testdata pow.testdata
+ 
+-CLEANFILES = $(CRLIBM_CHECKLIST)
+\ Kein Zeilenumbruch am Dateiende.
++CLEANFILES = $(CRLIBM_CHECKLIST)
+diff -urN crlibm-1.0beta4/tests/tbx_timing.h crlibm-1.0beta4.fedora/tests/tbx_timing.h
+--- crlibm-1.0beta4/tests/tbx_timing.h	1970-01-01 01:00:00.000000000 +0100
++++ crlibm-1.0beta4.fedora/tests/tbx_timing.h	2011-02-20 00:08:59.217488495 +0100
+@@ -0,0 +1,102 @@
++#ifndef TBX_TIMING_H
++#define TBX_TIMING_H
++
++#include <sys/types.h>
++#include <sys/time.h>
++#if defined(CRLIBM_TYPECPU_ITANIUM) && defined(__INTEL_COMPILER)
++#include<ia64intrin.h>
++#endif
++
++/*
++ * For the user interested in High resolution timer, to my knowledge 
++ * the best library is "RTAI", unfortunately it works only on Linux OS
++ */
++
++
++typedef union u_tbx_tick
++{
++  unsigned long long tick;
++
++  struct
++  {
++    unsigned long low;
++    unsigned long high;
++  } sub;
++
++  struct timeval timev;
++} tbx_tick_t, *p_tbx_tick_t;
++
++
++#if defined(CRLIBM_TYPECPU_ITANIUM) && defined(__GNUC__) && !defined(__INTEL_COMPILER)
++ 
++#define TBX_GET_TICK(t) \
++   __asm__ __volatile__("mov %0=ar.itc" : "=r"((t).tick) :: "memory")
++#define TBX_TICK_RAW_DIFF(t1, t2)    ((t2).tick - (t1).tick)
++
++
++#elif defined(CRLIBM_TYPECPU_ITANIUM) && defined(__HPCC__)
++/* Never tested, currently nobody defines __HPCC__.
++  It should work on HPUX machines using HP compiler */
++#include<machine/sys/inline.h>/* to move up of course */
++#define TBX_GET_TICK(t) \
++   t.tick=_Asm_mov_from_ar(_AREG_ITC)
++#define TBX_TICK_RAW_DIFF(t1, t2)    ((t2).tick - (t1).tick )
++
++
++#elif defined(CRLIBM_TYPECPU_ITANIUM) && defined(__INTEL_COMPILER)
++#define TBX_GET_TICK(t)    t.tick=__getReg(_IA64_REG_AR_ITC)   
++#define TBX_TICK_RAW_DIFF(t1, t2)    ((t2).tick - (t1).tick)
++
++
++
++#elif (defined(CRLIBM_TYPECPU_AMD64) || defined(CRLIBM_TYPECPU_X86)) \
++    && defined(__GNUC__) && !defined(__INTEL_COMPILER)
++#define TBX_GET_TICK(time)                \
++        __asm__ __volatile__(             \
++                "xorl %%eax,%%eax\n\t"    \
++                "cpuid\n\t"               \
++                "rdtsc\n\t"               \
++                "movl %%eax,(%0)\n\t"     \
++                "movl %%edx,4(%0)\n\t"    \
++                "xorl %%eax,%%eax\n\t"    \
++                "cpuid\n\t"               \
++                : /* no output */         \
++                : "S"(&time.tick)         \
++                : "eax", "ebx", "ecx", "edx", "memory")
++#define TBX_TICK_RAW_DIFF(t1, t2)    ((t2).tick - (t1).tick)
++
++
++#elif defined(CRLIBM_TYPECPU_ALPHA)  && defined(__GNUC__)
++#define TBX_GET_TICK(t) \
++   __asm__ volatile("rpcc %0\n\t" : "=r"((t).tick))
++#define TBX_TICK_RAW_DIFF(t1, t2) \
++   (((t2).tick & 0xFFFFFFFF) - ((t1).tick & 0xFFFFFFFF))
++
++
++#elif defined(CRLIBM_TYPECPU_SPARC)  && defined(__GNUC__)
++#define TBX_GET_TICK(t) \
++    (t).tick = gethrtime()
++#define TBX_TICK_RAW_DIFF(t1, t2) \
++   ((t2).tick  - (t1).tick)
++
++
++
++#else  /* generic case */
++
++#define TIMING_USES_GETTIMEOFDAY 1  /* inform the test functions that timings are inaccurate */
++#define TBX_GET_TICK(t) \
++   gettimeofday(&(t).timev, 0)
++#define TBX_TICK_RAW_DIFF(t1, t2) \
++   ((t2.timev.tv_sec * 1000000L + t2.timev.tv_usec) - \
++    (t1.timev.tv_sec * 1000000L + t1.timev.tv_usec))
++
++#endif
++
++#define TBX_TICK_DIFF(t1, t2) (TBX_TICK_RAW_DIFF(t1, t2) - tbx_residual + 1)
++#define TBX_TIMING_DELAY(t1, t2) tbx_tick2usec(TBX_TICK_DIFF(t1, t2))
++
++extern unsigned long long tbx_residual;
++extern tbx_tick_t         tbx_new_event;
++extern tbx_tick_t         tbx_last_event;
++
++#endif /* TBX_TIMING_H */
+diff -urN crlibm-1.0beta4/tests/test_perf.c crlibm-1.0beta4.fedora/tests/test_perf.c
+--- crlibm-1.0beta4/tests/test_perf.c	2007-07-02 15:53:01.000000000 +0200
++++ crlibm-1.0beta4.fedora/tests/test_perf.c	2011-02-20 00:09:27.528377890 +0100
+@@ -13,7 +13,7 @@
+ #include "test_common.h"
+ #include "powmidpoint.h"
+ 
+-#include "scs_lib/tests/tbx_timing.h"
++#include "tbx_timing.h"
+ 
+ #ifdef HAVE_MATHLIB_H
+ #include <MathLib.h>
+diff -urN crlibm-1.0beta4/tests/test_perf-interval.c crlibm-1.0beta4.fedora/tests/test_perf-interval.c
+--- crlibm-1.0beta4/tests/test_perf-interval.c	2006-10-24 13:26:31.000000000 +0200
++++ crlibm-1.0beta4.fedora/tests/test_perf-interval.c	2011-02-20 00:09:53.232277534 +0100
+@@ -19,7 +19,7 @@
+ #include "test_common.h"
+ #include "interval.h"
+ 
+-#include "scs_lib/tests/tbx_timing.h"
++#include "tbx_timing.h"
+ 
+ #ifdef HAVE_MATHLIB_H
+ #include <MathLib.h>
+diff -urN crlibm-1.0beta4/triple-double.h crlibm-1.0beta4.fedora/triple-double.h
+--- crlibm-1.0beta4/triple-double.h	2007-03-16 11:01:19.000000000 +0100
++++ crlibm-1.0beta4.fedora/triple-double.h	2011-02-20 00:01:01.294368805 +0100
+@@ -8,8 +8,7 @@
+ #ifndef TRIPLE_DOUBLE_H
+ #define TRIPLE_DOUBLE_H 1
+ 
+-#include "scs_lib/scs.h"
+-#include "scs_lib/scs_private.h"
++#include <scs.h>
+ 
+  /* undef all the variables that might have been defined in
+     scs_lib/scs_private.h */
diff --git a/crlibm.spec b/crlibm.spec
new file mode 100644
index 0000000..f3e04fb
--- /dev/null
+++ b/crlibm.spec
@@ -0,0 +1,90 @@
+Name:           crlibm
+Version:        1.0
+Release:        0.3.beta4%{?dist}
+Summary:        Correctly Rounded mathematical library
+
+Group:          System Environment/Libraries
+License:        LGPLv2+
+URL:            http://lipforge.ens-lyon.fr/www/crlibm/
+Source0:        http://lipforge.ens-lyon.fr/frs/download.php/162/crlibm-1.0beta4.tar.gz
+Patch0:         %{name}-1.0beta4-shared.patch
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildRequires:  texlive-latex
+BuildRequires:  autoconf, automake, libtool
+BuildRequires:  libscs-devel
+
+%description
+CRlibm is a free mathematical library (libm) which provides:
+* implementations of the double-precision C99 standard elementary functions,
+* correctly rounded in the four IEEE-754 rounding modes,
+* with a comprehensive proof of both the algorithms used and their
+  implementation,
+* sufficiently efficient in average time, worst-case time, and memory
+  consumption to replace existing libms transparently.
+
+
+%package        devel
+Summary:        Development files for %{name}
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description    devel
+The %{name}-devel package contains libraries and header files for
+developing applications that use %{name}.
+
+
+%prep
+%setup -q -n %{name}-1.0beta4
+%patch0 -p1 -b .shared
+
+rm -rf scs_lib
+
+
+%build
+# autoreconf requires because the patch modifies configure.ac and Makefile.am
+autoreconf --install --force
+%configure --disable-static
+make %{?_smp_mflags}
+make crlibm.pdf
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
+
+# We do not want to install the test programs
+rm -rf $RPM_BUILD_ROOT%{_bindir}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%defattr(-,root,root,-)
+%doc README AUTHORS COPYING.LIB
+%{_libdir}/*.so.*
+
+%files devel
+%defattr(-,root,root,-)
+%doc docs/crlibm.pdf
+%{_includedir}/*
+%{_libdir}/*.so
+
+
+%changelog
+* Sat Feb 19 2011 Tim Niemueller <tim at niemueller.de> - 1.0-0.3.beta4
+- Delete included scs_lib in prep stage
+
+* Sat Feb 19 2011 Tim Niemueller <tim at niemueller.de> - 1.0-0.2.beta4
+- Use system-wide installed scslib if available
+
+* Tue Feb 08 2011 Tim Niemueller <tim at niemueller.de> - 1.0-0.1.beta4
+- Initial package
+
diff --git a/sources b/sources
index e69de29..685c3ab 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+8ecabd55d4a2d08030eb770ae2a5670a  crlibm-1.0beta4.tar.gz


More information about the scm-commits mailing list