On May 12, 2011, at 2:30 PM, Josh Cheek wrote:

> On Thu, May 12, 2011 at 10:26 AM, Colin Bartlett <colinb2r / googlemail.com 
> >wrote:
>
>> On Thu, May 12, 2011 at 2:54 PM, serialhex <serialhex / gmail.com>  
>> wrote:
>>> ...
>>> instead of using floats you can try to use rational numbers in ruby:
>>> ruby-1.9.2-p180 :001 > require 'mathn'
>> which also changes this:
>> (-1) ** (1.0 / 3) #=> NaN
>> to:
>> (-1) ** (1.0 / 3) #=> (0.5+0.866025403784439i)
>> so we can also get complex roots if we want them!
>>
>>
> Which we don't here, given that the cube root of -1 isn't imaginary :/


ONE of the cube roots of -1 isn't imaginary, but the other two are.   
Since (1.0/3) isn't exactly one-third, raising -1 to (1.0/3) isn't  
exactly the same as taking the cube root either.

-Rob

Rob Biedenharn		
Rob / AgileConsultingLLC.com	http://AgileConsultingLLC.com/
rab / GaslightSoftware.com		http://GaslightSoftware.com/