[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Old Question



Jacques Basson <jfb37@mrao.cam.ac.uk> writes:

>Ben Tupper wrote:
>> 
>> Jacques Basson wrote:
>> 
>> > Hi all
>> >
>> > Sorry, this has got to be an old question, but I can't seem to locate
>> > the answer.  What is the way around the following problem?
>> >
>> > IDL> a = -1
>> > IDL> print, -1^(1./3)
>> >      -1.00000
>> > IDL> print, a^(1./3)
>> >           NaN
>> > % Program caused arithmetic error: Floating illegal operand
>> >
>> > Thanks
>> > Jacques
>> 

	(stuff deleted)

>I resorted to creating a simple function which basically does
>	abs(a)^(1./3) * (2*(a gt 0) - 1)
>Slightly messy, but it works.

>Jacques

I agree that it doesn't generate any errors, but what is its physical or
mathematical meaning?  The only justification I can think of for this would be
if negative values of A where physically meaningless, and only represented
measurement error.  The above procedure would then preserve the distribution of
noise about zero without introducing any biases towards positive or negative
numbers.  If that's the case, then I agree that the above procedure is proper.

William Thompson