       Re: Bug in calculating -3^49999.0

• To: mathgroup at smc.vnet.net
• Subject: [mg66025] Re: [mg65989] Bug in calculating -3^49999.0
• From: "Erickson Paul-CPTP18" <Paul.Erickson at Motorola.com>
• Date: Thu, 27 Apr 2006 02:26:23 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Hmmm,

You appear to have two problems.
Since ^ is higher precedence than -, -3^49999 is evaluated as -(3^49999)
which I think is not what you want. This can easily be seen as:
In:=
-3^ 49998 // N

Out=
-1.2837884783228*10^23855

Which being negative clear illustrates the order of precedence. Now I
assume you want to take the result of some calculation which may turn
out negative to some integer power, perhaps also the result of some
calculation.

If the number is positive then either (number or power) or both can be
real or integer with a positive (integer or real, depending) result.

However, if the number is negative, then either the power must be
integer or the result complex.

So if the desire is that the power is calculated using real arithmetic,
but you know the power function must be integer, then

(-3)^Round[ 49999.] //N

Should give you a good answer (the number "3" could be real and / or a
function that returns real and the 49999. Could be a function that
results in a real answer (assumed to be very close the actual integer
value).

If the number is negative and the power has a fractional part (not
integer) then the result will have to be complex.

Paul

-----Original Message-----
From: kowald at molgen.mpg.de [mailto:kowald at molgen.mpg.de]
To: mathgroup at smc.vnet.net
Subject: [mg66025] [mg65989] Bug in calculating -3^49999.0

Hello everybody,

I'm using Mathematica 5.1 under Win2k and I found a bug when I try to
compute -3^49999. I get:

-3^49999 //N  =>  -3.85 * 10^23855          okay
-3^49999.      =>  -3.85 * 10^23855          okay
(-3)^49999.    =>  -3.85 * 10^23855 + 4.56*10^23844 i       wrong
(-3)^49999     =>  -3.85 * 10^23855          okay

Is this a known problem?
Is there a work around ?
Obviously this is part of a more complicated calculation and so I cannot
simply leave out the brackets.

Many thanks,

Axel

```

• Prev by Date: Re: Bug in calculating -3^49999.0
• Next by Date: Re: Illusory Multicore Support in 5.2?
• Previous by thread: Re: Bug in calculating -3^49999.0
• Next by thread: LinearSolve and System Equation