Re: [R] Behaviour of very large numbers

2007-08-31 Thread Robin Hankin
Hello On 30 Aug 2007, at 16:08, willem vervoort wrote: > > What happens when you raise a negative value to a power and the result > is a very large number? > [snip] > I loaded package Brobdingnag and tried: > as.brob(x^B) > [1] NAexp(NaN) NAexp(NaN) NAexp(NaN) NAexp(NaN) NAexp(NaN) >> as.

Re: [R] Behaviour of very large numbers

2007-08-31 Thread willem vervoort
Thanks for all the points. Riding my bike back home I realised that the fractional power was a problem. I also forgot about the operator precedence: > b <- 48.3 > -53.1^b [1] -2.099256e+83 > (-53.1)^b [1] NaN Pretty clear now. Back to my maths than... > version # sorry forgot this last time

Re: [R] Behaviour of very large numbers

2007-08-30 Thread Duncan Murdoch
On 8/30/2007 12:11 PM, Martin Becker wrote: > willem vervoort wrote: >> Dear all, >> I am struggling to understand this. >> >> What happens when you raise a negative value to a power and the result >> is a very large number? >> >> B >> [1] 47.73092 >> >> >>> -51^B >>> >> [1] -3.190824e+81

Re: [R] Behaviour of very large numbers

2007-08-30 Thread Prof Brian Ripley
On Thu, 30 Aug 2007, willem vervoort wrote: > Dear all, > I am struggling to understand this. > > What happens when you raise a negative value to a power and the result > is a very large number? Where are the 'very large numbers' here? R can cope with much larger numbers (over 10^300). > B > [

Re: [R] Behaviour of very large numbers

2007-08-30 Thread Martin Becker
willem vervoort wrote: > Dear all, > I am struggling to understand this. > > What happens when you raise a negative value to a power and the result > is a very large number? > > B > [1] 47.73092 > > >> -51^B >> > [1] -3.190824e+81 > > # seems fine > Well, this seems not to be what you

Re: [R] Behaviour of very large numbers

2007-08-30 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of willem vervoort > Sent: Thursday, August 30, 2007 8:09 AM > To: r-help@stat.math.ethz.ch > Subject: [R] Behaviour of very large numbers > > Dear all, > I am struggling to

Re: [R] Behaviour of very large numbers

2007-08-30 Thread Gustaf Rydevik
On 8/30/07, Gustaf Rydevik <[EMAIL PROTECTED]> wrote: > On 8/30/07, willem vervoort <[EMAIL PROTECTED]> wrote: > > Dear all, > > I am struggling to understand this. > > > > What happens when you raise a negative value to a power and the result > > is a very large number? > > > > B > > [1] 47.73092

Re: [R] Behaviour of very large numbers

2007-08-30 Thread Duncan Murdoch
On 8/30/2007 11:08 AM, willem vervoort wrote: > Dear all, > I am struggling to understand this. > > What happens when you raise a negative value to a power and the result > is a very large number? > > B > [1] 47.73092 > >> -51^B > [1] -3.190824e+81 You should be using parentheses. You evaluat

Re: [R] Behaviour of very large numbers

2007-08-30 Thread Scionforbai
Hello, it seems to be an R bug. It gives strange errors for non-integer exponents: > version platform i686-redhat-linux-gnu version.string R version 2.4.1 (2006-12-18) > x^47.0 [1] -1.802180e+80 -1.768932e+80 -1.736284e+80 -1.704227e+80 -1.672748e+80 [...] > x^47.10 [1] NaN NaN NaN NaN

[R] Behaviour of very large numbers

2007-08-30 Thread willem vervoort
Dear all, I am struggling to understand this. What happens when you raise a negative value to a power and the result is a very large number? B [1] 47.73092 > -51^B [1] -3.190824e+81 # seems fine # now this: > x <- seq(-51,-49,length=100) > x^B [1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN