Actions
Bug #10762
closedMath **
    Bug #10762:
    Math **
  
Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
Description
According to the Maths, "any number raised to the zero power equals one".
Yet:
ruby -e 'puts((-1 ** 0) == 1)'
=> false
        
           Updated by Anonymous almost 11 years ago
          Updated by Anonymous almost 11 years ago
          
          
        
        
      
      It's operator precedence. ** has higher precedence than unary -
irb> -1 ** 0
=> -1
irb> (-1) ** 0
=> 1
irb> -(1 ** 0)
=> -1
        
           Updated by nobu (Nobuyoshi Nakada) almost 11 years ago
          Updated by nobu (Nobuyoshi Nakada) almost 11 years ago
          
          
        
        
      
      - Status changed from Open to Rejected
Actions