Project

General

Profile

Bug #16677

Updated by sawa (Tsuyoshi Sawada) about 4 years ago

Not sure if this is an unexpected behavior. 

 This works as I expect: 

 ``` 
 -2 ** 2.2 # => -4.59479341998814 
 ``` 

 But when I change the code a bit, it gives me a complex: 

 ```ruby ``` 
 -2.to_i ** 2.2 # => (3.717265962412589+2.7007518095995273i) 

 a = -2; a ** 2.2 # => (3.717265962412589+2.7007518095995273i) 
 ``` 

 This seems to happen only with negative numbers and float powers. I think it might be related to how `Fixnum` is treated differently from other classes by the power function.

Back