Martyn Byng
2011-Nov-21 14:41 UTC
[Rd] a^b when a is large and b < 1 (64bit R on windows 7)
Hi, I'm getting some strange behaviour when trying to use the power operator (a^b) when a is large and b is less than one: big <- .Machine$double.xmax big big^0.5 sqrt(big)> big <- 1.797693134862315708384e+308 > big^0.5[1] Inf> sqrt(big)[1] 1.340781e+154 I'm guessing that this behaviour is not expected, or am I missing something about ^? Cheers Martyn> sessionInfo()R version 2.14.0 (2011-10-31) Platform: x86_64-pc-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_United Kingdom.1252 [2] LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. Th...{{dropped:4}}
Joris Meys
2011-Nov-21 14:54 UTC
[Rd] a^b when a is large and b < 1 (64bit R on windows 7)
I can reproduce on the latest patched build, but this is specific for the 64bit version of R. On a 32bit it works as expected:> big <- 1.797693134862315708385e+308 > sqrt(big)[1] 1.340781e+154> big^0.5[1] 1.340781e+154 The 64bit part might have something to do with it, and now move out of the way for people that actually know what they're talking about... Cheers Joris On Mon, Nov 21, 2011 at 3:41 PM, Martyn Byng <Martyn.Byng at nag.co.uk> wrote:> Hi, > > I'm getting some strange behaviour when trying to use the power operator > (a^b) when a is large and b is less than one: > > big <- .Machine$double.xmax > big > big^0.5 > sqrt(big) > >> big <- 1.797693134862315708384e+308 >> big^0.5 > [1] Inf >> sqrt(big) > [1] 1.340781e+154 > > > I'm guessing that this behaviour is not expected, or am I missing > something about ^? > > Cheers > > Martyn > > > >> sessionInfo() > R version 2.14.0 (2011-10-31) > Platform: x86_64-pc-mingw32/x64 (64-bit) > > locale: > [1] LC_COLLATE=English_United Kingdom.1252 > [2] LC_CTYPE=English_United Kingdom.1252 > [3] LC_MONETARY=English_United Kingdom.1252 > [4] LC_NUMERIC=C > [5] LC_TIME=English_United Kingdom.1252 > > attached base packages: > [1] stats ? ? graphics ?grDevices utils ? ? datasets ?methods ? base > > ________________________________________________________________________ > The Numerical Algorithms Group Ltd is a company registered in England > and Wales with company number 1249803. The registered office is: > Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. > > This e-mail has been scanned for all viruses by Star. Th...{{dropped:4}} > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Mathematical Modelling, Statistics and Bio-Informatics tel : +32 9 264 59 87 Joris.Meys at Ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
Brian G. Peterson
2011-Nov-21 14:58 UTC
[Rd] a^b when a is large and b < 1 (64bit R on windows 7)
On Mon, 2011-11-21 at 14:41 +0000, Martyn Byng wrote:> I'm getting some strange behaviour when trying to use the power > operator > (a^b) when a is large and b is less than one: > > big <- .Machine$double.xmax > big > big^0.5 > sqrt(big) > > > big <- 1.797693134862315708384e+308 > > big^0.5 > [1] Inf > > sqrt(big) > [1] 1.340781e+154 > > > I'm guessing that this behaviour is not expected, or am I missing > something about ^?On a recent Ubuntu 64bit install with R2.14.0 from the repositories, I get:> big <- .Machine$double.xmax > big[1] 1.797693e+308> big^0.5[1] 1.340781e+154> sqrt(big)[1] 1.340781e+154 so it does seem to be specific either to your environment. -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock