Project

General

Profile

Bug #16677

Updated by sawa (Tsuyoshi Sawada) almost 2 years ago

Not sure if my understanding is wrong or if this is an unexpected behavior. 

 This works seems to be working as I expect: expect it would: 

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

 But when I change changing a bit the code a bit, code, for something that seemingly shouldn't have that big an impact, it gives me a complex: 

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

 Also, this seems to behave the same way: 
 ``` 
 a = -2; a ** 2.2 # 
 => (3.717265962412589+2.7007518095995273i) 
 ``` 

 This seems to happen only be happening with negative numbers and float powers. I think it might be related to how `Fixnum` is Fixnum are treated differently from other classes by separately when applying the power function. function, but I did not dig further. 
 Sorry if this is an intended behavior and I did simply not understand it was! 

 Thank you!

Back