SMath Studio Forum
»
SMath Studio
»
Bugs & Problems
»
Hard to create the expression a:=b|c
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,988 Was thanked: 1126 time(s) in 723 post(s)
|
Hi, when trying to generate a table of function values for boolean operators I found the input behaviour of OR, AND and XOR quite confusing. typing a:1|0 or a:1&0 I get a:1|0 and a:1|0This is not what I expected. Instead, I have to use braces to make sure the boolean operation is evaluated before the assignment operation: a1|0) and a1|0) by typing a: (1|0 This implies that the assignment operator has higher priority than boolean AND, OR and XOR, which is odd. I guess that the design intent is that AND, OR and XOR take lower priority than numeric comparison operations. This facilitates writing conditionals like 0<x&x<1 by just typing 0<x&x<1 However, precedence over assignment is confusing. What sensible boolean result is the assignment operator supposed to provide? Thus I propose to re-adjust the operator precedence, such that there is no need to bracket the rhs of an assignment. Edit: Additionally, the equal and not-equal operators silently adopt the same lower precedence like the mentioned boolean operators, but do not enforce brackets around their operators. This leads to wrong results. Martin Kraska Edited by user 23 March 2014 17:57:03(UTC)
| Reason: Not specified File Attachment(s): mkraska attached the following image(s): |
|
1 user thanked mkraska for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,988 Was thanked: 1126 time(s) in 723 post(s)
|
Originally Posted by: mkraska Edit: Additionally, the equal and not-equal operators silently adopt the same lower precedence like the mentioned boolean operators, but do not enforce brackets around their operators. This leads to wrong results.
The issues remain open in 0.96, in particular the cited issue is dangerous. mkraska attached the following image(s): |
|
|
|
|
SMath Studio Forum
»
SMath Studio
»
Bugs & Problems
»
Hard to create the expression a:=b|c
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.