From 1fa7b45df8b146a42dc99af9004ce9ea93e7748b Mon Sep 17 00:00:00 2001 From: Jack Ren <jack.ren@intel.com> Date: Tue, 28 Feb 2012 12:02:21 +0800 Subject: [PATCH] libm: cherry-pick one patch from freebsd to fix logb() denormals issue from http://svnweb.freebsd.org/base?view=revision&revision=176101 " Oops, fix the fix in rev.1.10. logb() and logbf() were broken on denormals, and logb() remained broken after 1.10 because the fix for logbf() was incompletely translated. Convert to __FBSDID(). " Change-Id: I54f33648db7c421b06eee1ea8e63c57a179fae0d Signed-off-by: Jack Ren <jack.ren@intel.com> Signed-off-by: Jin Wei <wei.a.jin@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com> --- libm/src/s_logb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libm/src/s_logb.c b/libm/src/s_logb.c index 30edb8749..57f91c44d 100644 --- a/libm/src/s_logb.c +++ b/libm/src/s_logb.c @@ -36,9 +36,9 @@ logb(double x) if(ix>=0x7ff00000) return x*x; if(ix<0x00100000) { x *= two54; /* convert subnormal x to normal */ - GET_FLOAT_WORD(ix,x); + GET_HIGH_WORD(ix,x); ix &= 0x7fffffff; - return (float) ((ix>>20)-1023-54); + return (double) ((ix>>20)-1023-54); } else return (double) ((ix>>20)-1023); }