From: Matthew Kerwin Date: 2012-11-11T17:44:14+09:00 Subject: [ruby-core:49214] Re: [ruby-trunk - Feature #7328] Move ** operator precedence under unary + and - --e89a8ff1c99c68db0904ce34308e Content-Type: text/plain; charset=ISO-8859-1 It woudl never be -i. (-1) ** 0.5 => i (or, in complex coordinates, 0+1i, which is basically what (6.123233995736766e-17+1.0i) means. On 11 November 2012 18:01, alexeymuranov (Alexey Muranov) < redmine@ruby-lang.org> wrote: > > Issue #7328 has been updated by alexeymuranov (Alexey Muranov). > > > (-1) ** 0.5 should not be defined! I just tried it and it gave me > (6.123233995736766e-17+1.0i) -- approximately the complex i. Why not -i ?? > ---------------------------------------- > Feature #7328: Move ** operator precedence under unary + and - > https://bugs.ruby-lang.org/issues/7328#change-32768 > > Author: boris_stitnicky (Boris Stitnicky) > Status: Open > Priority: Normal > Assignee: > Category: > Target version: > > > I would like to ask to consider decreasing ** operator precedence just > below that of -/+ unary operators. I know that other languages (eg. Python) > have ** operator bind tighter than negation, but seeing -1 ** 0.5 give the > result -1 and having to type parenthesis (-1) ** 0.5... Even if it's not > worth changing, I'd like to hear this rationalized. I've asked about > rationalization of this on SO, and nobody seems to know why this precedence > is the way it is. > > > -- > http://bugs.ruby-lang.org/ > > -- Matthew Kerwin, B.Sc (CompSci) (Hons) http://matthew.kerwin.net.au/ ABN: 59-013-727-651 "You'll never find a programming language that frees you from the burden of clarifying your ideas." - xkcd --e89a8ff1c99c68db0904ce34308e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable It woudl never be -i. =A0(-1) ** 0.5 =3D> i (or, in complex coordinates,= 0+1i, which is basically what (6.123233995736766e-17+1.0i) means.


On 11 November 2012 18:01, alexeymuranov= (Alexey Muranov) <redmine@ruby-lang.org> wrote:

Issue #7328 has been updated by alexeymuranov (Alexey Muranov).


(-1) ** 0.5 should not be defined! I just tried it and it gave me (6.123233= 995736766e-17+1.0i) -- approximately the complex i. Why not -i ??
----------------------------------------
Feature #7328: Move ** operator precedence under unary + and -
https://bugs.ruby-lang.org/issues/7328#change-32768

Author: boris_stitnicky (Boris Stitnicky)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:


I would like to ask to consider decreasing ** operator precedence just belo= w that of -/+ unary operators. I know that other languages (eg. Python) hav= e ** operator bind tighter than negation, but seeing -1 ** 0.5 give the res= ult -1 and having to type parenthesis (-1) ** 0.5... Even if it's not w= orth changing, I'd like to hear this rationalized. I've asked about= rationalization of this on SO, and nobody seems to know why this precedenc= e is the way it is.


--
http://bugs.ruby-l= ang.org/




--
= =A0 Matthew Kerwin, B.Sc (CompSci) (Hons)
=A0 http://matthew.kerwin.net.au/
=A0 = ABN: 59-013-727-651

=A0 "You'll never find a programming language that frees
= =A0 you from the burden of clarifying your ideas." - xkcd
--e89a8ff1c99c68db0904ce34308e--