Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Aug 2015 19:06:36 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r286688 - in stable: 10/lib/msun/src 8/lib/msun/src 9/lib/msun/src
Message-ID:  <201508121906.t7CJ6aqY083949@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Aug 12 19:06:35 2015
New Revision: 286688
URL: https://svnweb.freebsd.org/changeset/base/286688

Log:
  MFC r286515:
  
  In libm's exp2(3), avoid left-shifting a negative integer, which is
  undefined.  Replace it with the intended value, in a defined way.
  
  Reviewed by:	bde

Modified:
  stable/9/lib/msun/src/s_exp2.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/lib/   (props changed)
  stable/9/lib/msun/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/lib/msun/src/s_exp2.c
  stable/8/lib/msun/src/s_exp2.c
Directory Properties:
  stable/10/   (props changed)
  stable/8/   (props changed)
  stable/8/lib/   (props changed)
  stable/8/lib/msun/   (props changed)

Modified: stable/9/lib/msun/src/s_exp2.c
==============================================================================
--- stable/9/lib/msun/src/s_exp2.c	Wed Aug 12 19:00:47 2015	(r286687)
+++ stable/9/lib/msun/src/s_exp2.c	Wed Aug 12 19:06:35 2015	(r286688)
@@ -375,14 +375,14 @@ exp2(double x)
 	/* Compute r = exp2(y) = exp2t[i0] * p(z - eps[i]). */
 	t = tbl[i0];		/* exp2t[i0] */
 	z -= tbl[i0 + 1];	/* eps[i0]   */
-	if (k >= -1021 << 20)
+	if (k >= -(1021 << 20))
 		INSERT_WORDS(twopk, 0x3ff00000 + k, 0);
 	else
 		INSERT_WORDS(twopkp1000, 0x3ff00000 + k + (1000 << 20), 0);
 	r = t + t * z * (P1 + z * (P2 + z * (P3 + z * (P4 + z * P5))));
 
 	/* Scale by 2**(k>>20). */
-	if(k >= -1021 << 20) {
+	if(k >= -(1021 << 20)) {
 		if (k == 1024 << 20)
 			return (r * 2.0 * 0x1p1023);
 		return (r * twopk);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508121906.t7CJ6aqY083949>