fusionlanguage / fut

Fusion programming language. Transpiling to C, C++, C#, D, Java, JavaScript, Python, Swift, TypeScript and OpenCL C.

Home Page:https://fusion-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parentheses dropped, resulting in changed arithmetic order.

epi opened this issue · comments

Consider

class Foo {
	int Bar(int a, int b) => a * (b / 100);
}

Bar gets translated to the following C++:

int Foo::bar(int a, int b) const
{
        return a * b / 100;
}

resulting in arithmetic overflow in cases which the parentheses should prevent.

Thanks for reporting this! Fixed now. It was also causing rounding errors.