This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix types of constants in k_casinh*.c


I noticed there were places in math/k_casinhf.c and math/k_casinhl.c
that were using double constants 1.0 and 2.0 instead of 1.0f and 2.0f
or 1.0L and 2.0L.  For long double this would have been harmless; for
float it might have caused unnecessary promotions / double rounding.
I've committed as obvious this patch to use appropriately typed
constants after testing on x86_64 and x86.

2013-03-19  Joseph Myers  <joseph@codesourcery.com>

	* math/k_casinhf.c (__kernel_casinhf): Consistently use float
	constants.
	* math/k_casinhl.c (__kernel_casinhl): Consistently use long
	double constants.

diff --git a/math/k_casinhf.c b/math/k_casinhf.c
index 3152ea2..7ff4b03 100644
--- a/math/k_casinhf.c
+++ b/math/k_casinhf.c
@@ -79,8 +79,8 @@ __kernel_casinhf (__complex__ float x, int adj)
     }
   else
     {
-      __real__ y = (rx - ix) * (rx + ix) + 1.0;
-      __imag__ y = 2.0 * rx * ix;
+      __real__ y = (rx - ix) * (rx + ix) + 1.0f;
+      __imag__ y = 2.0f * rx * ix;
 
       y = __csqrtf (y);
 
diff --git a/math/k_casinhl.c b/math/k_casinhl.c
index 110ae33..aec501b 100644
--- a/math/k_casinhl.c
+++ b/math/k_casinhl.c
@@ -86,8 +86,8 @@ __kernel_casinhl (__complex__ long double x, int adj)
     }
   else
     {
-      __real__ y = (rx - ix) * (rx + ix) + 1.0;
-      __imag__ y = 2.0 * rx * ix;
+      __real__ y = (rx - ix) * (rx + ix) + 1.0L;
+      __imag__ y = 2.0L * rx * ix;
 
       y = __csqrtl (y);
 

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]