From 6d9f97e1f2b60fe6ca33e0e75e8048c35a39df0e Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Fri, 28 Dec 2012 18:53:17 +0530 Subject: Replace more constants with their values Code cleanup. --- sysdeps/ieee754/dbl-64/atnat.h | 22 +++++-------- sysdeps/ieee754/dbl-64/atnat2.h | 30 ++++++------------ sysdeps/ieee754/dbl-64/s_tan.c | 70 ++++++++++++++++++++--------------------- sysdeps/ieee754/dbl-64/ulog.h | 18 +++-------- sysdeps/ieee754/dbl-64/utan.h | 18 +++-------- 5 files changed, 61 insertions(+), 97 deletions(-) (limited to 'sysdeps/ieee754') diff --git a/sysdeps/ieee754/dbl-64/atnat.h b/sysdeps/ieee754/dbl-64/atnat.h index 6b8e17821c..5d1eb0cbef 100644 --- a/sysdeps/ieee754/dbl-64/atnat.h +++ b/sysdeps/ieee754/dbl-64/atnat.h @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * Written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001-2012 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -52,8 +52,6 @@ /**/ f17 = {{0x3fae1e1e, 0x1e1e1e1e} }, /* 1/17 */ /**/ f19 = {{0xbfaaf286, 0xbca1af28} }, /* -1/19 */ /* constants */ -/**/ zero = {{0x00000000, 0x00000000} }, /* 0 */ -/**/ one = {{0x3ff00000, 0x00000000} }, /* 1 */ /**/ a = {{0x3e4bb67a, 0x00000000} }, /* 1.290e-8 */ /**/ b = {{0x3fb00000, 0x00000000} }, /* 1/16 */ /**/ c = {{0x3ff00000, 0x00000000} }, /* 1 */ @@ -77,9 +75,7 @@ /**/ u9[M] ={{{0x38c1aa5b, 0x00000000} }, /* 2.658e-35 */ /**/ {{0x35c1aa4d, 0x00000000} }, /* 9.443e-50 */ /**/ {{0x32c1aa88, 0x00000000} }, /* 3.355e-64 */ -/**/ {{0x11c1aa56, 0x00000000} }},/* 3.818e-223 */ -/**/ two8 = {{0x40700000, 0x00000000} }, /* 2**8=256 */ -/**/ two52 = {{0x43300000, 0x00000000} }; /* 2**52 */ +/**/ {{0x11c1aa56, 0x00000000} }};/* 3.818e-223 */ #else #ifdef LITTLE_ENDI @@ -106,8 +102,6 @@ /**/ f17 = {{0x1e1e1e1e, 0x3fae1e1e} }, /* 1/17 */ /**/ f19 = {{0xbca1af28, 0xbfaaf286} }, /* -1/19 */ /* constants */ -/**/ zero = {{0x00000000, 0x00000000} }, /* 0 */ -/**/ one = {{0x00000000, 0x3ff00000} }, /* 1 */ /**/ a = {{0x00000000, 0x3e4bb67a} }, /* 1.290e-8 */ /**/ b = {{0x00000000, 0x3fb00000} }, /* 1/16 */ /**/ c = {{0x00000000, 0x3ff00000} }, /* 1 */ @@ -131,15 +125,13 @@ /**/ u9[M] ={{{0x00000000, 0x38c1aa5b} }, /* 2.658e-35 */ /**/ {{0x00000000, 0x35c1aa4d} }, /* 9.443e-50 */ /**/ {{0x00000000, 0x32c1aa88} }, /* 3.355e-64 */ -/**/ {{0x00000000, 0x11c1aa56} }},/* 3.818e-223 */ -/**/ two8 = {{0x00000000, 0x40700000} }, /* 2**8=256 */ -/**/ two52 = {{0x00000000, 0x43300000} }; /* 2**52 */ +/**/ {{0x00000000, 0x11c1aa56} }};/* 3.818e-223 */ #endif #endif -#define ZERO zero.d -#define ONE one.d +#define ZERO 0.0 +#define ONE 1.0 #define A a.d #define B b.d #define C c.d @@ -160,7 +152,7 @@ #define U6 u6.d #define U7 u7.d #define U8 u8.d -#define TWO8 two8.d -#define TWO52 two52.d +#define TWO8 0x1.0p8 /* 2^8 */ +#define TWO52 0x1.0p52 /* 2^52 */ #endif diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h index fa6aa0d495..ec855e2cfd 100644 --- a/sysdeps/ieee754/dbl-64/atnat2.h +++ b/sysdeps/ieee754/dbl-64/atnat2.h @@ -2,7 +2,7 @@ /* * IBM Accurate Mathematical Library * Written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001-2012 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -57,9 +57,6 @@ /**/ f17 = {{0x3fae1e1e, 0x1e1e1e1e} }, /* 1/17 */ /**/ f19 = {{0xbfaaf286, 0xbca1af28} }, /* -1/19 */ /* constants */ -/**/ zero = {{0x00000000, 0x00000000} }, /* 0 */ -/**/ mzero = {{0x80000000, 0x00000000} }, /* -0 */ -/**/ one = {{0x3ff00000, 0x00000000} }, /* 1 */ /**/ inv16 = {{0x3fb00000, 0x00000000} }, /* 1/16 */ /**/ opi = {{0x400921fb, 0x54442d18} }, /* pi */ /**/ opi1 = {{0x3ca1a626, 0x33145c07} }, /* pi-opi */ @@ -95,11 +92,8 @@ /**/ {{0x23c6eee8, 0x00000000} }, /* 2.465e-136 */ /**/ {{0x11c6ed16, 0x00000000} }},/* 4.955e-223 */ /**/ ue = {{0x38900e9d, 0x00000000} }, /* 3.02e-36 */ -/**/ two8 = {{0x40700000, 0x00000000} }, /* 2**8=256 */ -/**/ two52 = {{0x43300000, 0x00000000} }, /* 2**52 */ /**/ two500 = {{0x5f300000, 0x00000000} }, /* 2**500 */ -/**/ twom500 = {{0x20b00000, 0x00000000} }, /* 2**(-500) */ -/**/ twom1022 = {{0x00100000, 0x00000000} }; /* 2**(-1022) */ +/**/ twom500 = {{0x20b00000, 0x00000000} }; /* 2**(-500) */ #else #ifdef LITTLE_ENDI @@ -127,9 +121,6 @@ /**/ f17 = {{0x1e1e1e1e, 0x3fae1e1e} }, /* 1/17 */ /**/ f19 = {{0xbca1af28, 0xbfaaf286} }, /* -1/19 */ /* constants */ -/**/ zero = {{0x00000000, 0x00000000} }, /* 0 */ -/**/ mzero = {{0x00000000, 0x80000000} }, /* -0 */ -/**/ one = {{0x00000000, 0x3ff00000} }, /* 1 */ /**/ inv16 = {{0x00000000, 0x3fb00000} }, /* 1/16 */ /**/ opi = {{0x54442d18, 0x400921fb} }, /* pi */ /**/ opi1 = {{0x33145c07, 0x3ca1a626} }, /* pi-opi */ @@ -165,20 +156,17 @@ /**/ {{0x00000000, 0x23c6eee8} }, /* 2.465e-136 */ /**/ {{0x00000000, 0x11c6ed16} }},/* 4.955e-223 */ /**/ ue = {{0x00000000, 0x38900e9d} }, /* 3.02e-36 */ -/**/ two8 = {{0x00000000, 0x40700000} }, /* 2**8=256 */ -/**/ two52 = {{0x00000000, 0x43300000} }, /* 2**52 */ /**/ two500 = {{0x00000000, 0x5f300000} }, /* 2**500 */ -/**/ twom500 = {{0x00000000, 0x20b00000} }, /* 2**(-500) */ -/**/ twom1022 = {{0x00000000, 0x00100000} }; /* 2**(-1022) */ +/**/ twom500 = {{0x00000000, 0x20b00000} }; /* 2**(-500) */ #endif #endif -#define ZERO zero.d -#define MZERO mzero.d -#define ONE one.d -#define TWO8 two8.d -#define TWO52 two52.d -#define TWOM1022 twom1022.d +#define ZERO 0.0 /* 0 */ +#define MZERO -0.0 /* 0 with the sign bit set */ +#define ONE 1.0 /* 1 */ +#define TWO8 0x1.0p8 /* 2^8 */ +#define TWO52 0x1.0p52 /* 2^52 */ +#define TWOM1022 0x1.0p-1022 /* 2^-1022 */ #endif diff --git a/sysdeps/ieee754/dbl-64/s_tan.c b/sysdeps/ieee754/dbl-64/s_tan.c index f8507eaa4c..7bc329d793 100644 --- a/sysdeps/ieee754/dbl-64/s_tan.c +++ b/sysdeps/ieee754/dbl-64/s_tan.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001, 2009, 2011 Free Software Foundation + * Copyright (C) 2001-2012 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -84,7 +84,7 @@ tan(double x) { goto ret; } - w=(x