From: Joel VanderWerf Date: 2006-11-06T08:42:31+09:00 Subject: Re: [ ruby-Bugs-6468 ] the sign of a number is omitted when squaring it. -2**2 vs (-2)**2 M. Edward (Ed) Borasky wrote: > depending on which meaning the programmer intended. And I can't for the > life of me understand why anyone would code > > (-x).abs Ok, irb(main):006:0> -2.5.ceil => -2 irb(main):007:0> -(2.5.ceil) => -3 irb(main):008:0> x = 2.5 => 2.5 irb(main):009:0> -x.ceil => -3 irb(main):010:0> -(x.ceil) => -3 To a mathematician (me) the operators appear to take different precedence depending on whether you have a literal or a variable. What's really happening is not fully explained by precedence. The lexical rules are important too and they are not simple. I'll agree with you on the importance of explicit bracketing, especially if you have to communicate with scientists or mathematicians who are not programmers. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407