Date: Tue, 3 Feb 2015 14:17:30 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278154 - head/lib/msun/src Message-ID: <201502031417.t13EHU9g074687@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Tue Feb 3 14:17:29 2015 New Revision: 278154 URL: https://svnweb.freebsd.org/changeset/base/278154 Log: Reduce confusion in scalbnl() family of functions. The changes unrelated to the bug in r277948 made the code very difficult to understand to both coverity and regular humans so take a step back to something that is much easier to understand for both and follows better the original code. CID: 1267992, 1267993, 1267994 Discussed with: kargl Modified: head/lib/msun/src/s_scalbln.c Modified: head/lib/msun/src/s_scalbln.c ============================================================================== --- head/lib/msun/src/s_scalbln.c Tue Feb 3 13:45:06 2015 (r278153) +++ head/lib/msun/src/s_scalbln.c Tue Feb 3 14:17:29 2015 (r278154) @@ -35,7 +35,9 @@ scalbln (double x, long n) { int in; - in = (n > INT_MAX) ? INT_MAX : (n < INT_MIN) ? INT_MIN : n; + in = (int)n; + if (in != n) + in = (n > 0) ? INT_MAX: INT_MIN; return (scalbn(x, in)); } @@ -44,7 +46,9 @@ scalblnf (float x, long n) { int in; - in = (n > INT_MAX) ? INT_MAX : (n < INT_MIN) ? INT_MIN : n; + in = (int)n; + if (in != n) + in = (n > 0) ? INT_MAX: INT_MIN; return (scalbnf(x, in)); } @@ -53,6 +57,9 @@ scalblnl (long double x, long n) { int in; - in = (n > INT_MAX) ? INT_MAX : (n < INT_MIN) ? INT_MIN : n; + in = (int)n; + if (in != n) { + in = (n > 0) ? INT_MAX: INT_MIN; + } return (scalbnl(x, in)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502031417.t13EHU9g074687>