## mingw-w64-public

 [Mingw-w64-public] Minor infelicity in pow() in 1.0 From: Prof Brian Ripley - 2011-11-22 22:09:38 ```Assuming you are still updating 1.0, this comes from a bug report on R built with a toolchain from Sept 2010 (but the bug is still present in the 1.0 branch). Suppose x is what is called in the C code MAXNUM, the maximum normalized double. Then pow(x, y) is computed as INF for 0 < y <= 1, when it should be a perfectly good normalized double. The bug is at line 382 of pow.c, which has if (x >= MAXNUM) { #if INFINITIES if (y > 0.0) return (INFINITY); #else if (y > 0.0) return (MAXNUM); #endif return (0.0); } It should of course be x > MAXNUM. There is a similar problem at line 410, which should be x < -MAXNUM . The code in 2.0 and trunk is completely different, and does these corner cases correctly. -- Brian D. Ripley, ripley@... Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ```
 Re: [Mingw-w64-public] Minor infelicity in pow() in 1.0 From: Ozkan Sezer - 2011-11-23 07:18:36 ```On Tue, Nov 22, 2011 at 11:30 PM, Prof Brian Ripley wrote: > Assuming you are still updating 1.0, this comes from a bug report on > R built with a toolchain from Sept 2010 (but the bug is still present > in the 1.0 branch). > > Suppose x is what is called in the C code MAXNUM, the maximum > normalized double.  Then pow(x, y) is computed as INF for 0 < y <= 1, > when it should be a perfectly good normalized double. The bug is at > line 382 of pow.c, which has > >         if (x >= MAXNUM) >         { > #if INFINITIES >                 if (y > 0.0) >                         return (INFINITY); > #else >                 if (y > 0.0) >                         return (MAXNUM); > #endif >                 return (0.0); >         } > > It should of course be x > MAXNUM. > > There is a similar problem at line 410, which should be x < -MAXNUM . > > The code in 2.0 and trunk is completely different, and does these > corner cases correctly. > > -- > Brian D. Ripley,                  ripley@... > Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/ > University of Oxford,             Tel:  +44 1865 272861 (self) > 1 South Parks Road,                     +44 1865 272866 (PA) > Oxford OX1 3TG, UK                Fax:  +44 1865 272595 Kai: can you approve that the changes are correct? -- O.S. ```
 Re: [Mingw-w64-public] Minor infelicity in pow() in 1.0 From: Kai Tietz - 2011-11-23 07:54:12 ```2011/11/23 Ozkan Sezer : > On Tue, Nov 22, 2011 at 11:30 PM, Prof Brian Ripley > wrote: >> Assuming you are still updating 1.0, this comes from a bug report on >> R built with a toolchain from Sept 2010 (but the bug is still present >> in the 1.0 branch). >> >> Suppose x is what is called in the C code MAXNUM, the maximum >> normalized double.  Then pow(x, y) is computed as INF for 0 < y <= 1, >> when it should be a perfectly good normalized double. The bug is at >> line 382 of pow.c, which has >> >>         if (x >= MAXNUM) >>         { >> #if INFINITIES >>                 if (y > 0.0) >>                         return (INFINITY); >> #else >>                 if (y > 0.0) >>                         return (MAXNUM); >> #endif >>                 return (0.0); >>         } >> >> It should of course be x > MAXNUM. >> >> There is a similar problem at line 410, which should be x < -MAXNUM . >> >> The code in 2.0 and trunk is completely different, and does these >> corner cases correctly. >> >> -- >> Brian D. Ripley,                  ripley@... >> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/ >> University of Oxford,             Tel:  +44 1865 272861 (self) >> 1 South Parks Road,                     +44 1865 272866 (PA) >> Oxford OX1 3TG, UK                Fax:  +44 1865 272595 > > Kai: can you approve that the changes are correct? > > -- > O.S. Hi Ozkan, Yes, for my understanding of valid value-ranges here, the the check should be indeed x > MAXNUM. Brian is right. Otherwise we disallow the case for MAXNUM. A patch for this is approved. Kai ```
 Re: [Mingw-w64-public] Minor infelicity in pow() in 1.0 From: Ozkan Sezer - 2011-11-23 08:16:33 ```On Wed, Nov 23, 2011 at 9:54 AM, Kai Tietz wrote: > 2011/11/23 Ozkan Sezer : >> On Tue, Nov 22, 2011 at 11:30 PM, Prof Brian Ripley >> wrote: >>> Assuming you are still updating 1.0, this comes from a bug report on >>> R built with a toolchain from Sept 2010 (but the bug is still present >>> in the 1.0 branch). >>> >>> Suppose x is what is called in the C code MAXNUM, the maximum >>> normalized double.  Then pow(x, y) is computed as INF for 0 < y <= 1, >>> when it should be a perfectly good normalized double. The bug is at >>> line 382 of pow.c, which has >>> >>>         if (x >= MAXNUM) >>>         { >>> #if INFINITIES >>>                 if (y > 0.0) >>>                         return (INFINITY); >>> #else >>>                 if (y > 0.0) >>>                         return (MAXNUM); >>> #endif >>>                 return (0.0); >>>         } >>> >>> It should of course be x > MAXNUM. >>> >>> There is a similar problem at line 410, which should be x < -MAXNUM . >>> >>> The code in 2.0 and trunk is completely different, and does these >>> corner cases correctly. >>> >>> -- >>> Brian D. Ripley,                  ripley@... >>> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/ >>> University of Oxford,             Tel:  +44 1865 272861 (self) >>> 1 South Parks Road,                     +44 1865 272866 (PA) >>> Oxford OX1 3TG, UK                Fax:  +44 1865 272595 >> >> Kai: can you approve that the changes are correct? >> >> -- >> O.S. > > Hi Ozkan, > > Yes, for my understanding of valid value-ranges here, the the check > should be indeed x > MAXNUM.  Brian is right.  Otherwise we disallow > the case for MAXNUM. > > A patch for this is approved. > > Kai > Applied rev. 4636 http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64?view=revision&revision=4636 -- O.S. ```