Menu

Order of operations involving MOD?

2019-06-08
2019-06-08
  • Yet Another Troll

    The order of operations appears inconsistent with the 1.26 manual in expressions involving MOD. I have yet to check other operators closely. Without the parens, it appears addition's precedence is higher:

     
  • Markus Hoffmann

    Markus Hoffmann - 2019-06-08

    confirmed. Hm. I have not checked it. Looking at the X11-Basic parser, the precedence is like folowing (lowest first):

    comma
    OR
    AND
    NAND
    NOR
    XOR
    EOR
    EQV
    IMP
    MOD
    DIV
    NOT
    =, <>, >,<,<=,>=
    +,-
    *,/,^
    +,- (sign)
    (,)
    I see this is completely different from what was stated in the manual (and maybe how It should be. Looks like a real problem, because I am not even sure is the compiler and the interpreter do it exactly the same.

    So my suggestion would be, make sure, that it is the same in the compiler and then just change the manual and not change the language (since this would probably break compatibility to existing BASIC programs). WHat do you think?

     
  • Yet Another Troll

    Not breaking existing code assets is the main thing, that and consistency between the interpreter and compiler. The rest of us green-fielders writing new code can use parentheses and keep the manual open in the background.

    EDIT: Yes, I am still rather sore about the VB6 to VB.NET thing, nearly 20 years later.

     

    Last edit: Yet Another Troll 2019-06-08

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.