Structorizer.Desktop icon indicating copy to clipboard operation
Structorizer.Desktop copied to clipboard

Python export of division operators may be improved

Open codemanyak opened this issue 5 years ago • 2 comments

The Python export from Structorizer aims at Python 3. But in contrast to Python 2, the division operator "/" has no longer the adaptive behaviour like in C or Java (and Structorizer). Instead it forces always floating-point division. In order to do an integer division, the operator symbol "//" must be used instead. Unfortunately the static type inference chances are rather poor on Structorizer code export, so in general we won't be able to clarify whether the operands of a division are integral or not. There are some exceptions, though, at least:

  • if the element text uses a div operator (the Pascal integer division operator);
  • if both operands are integer literals or can be inferred to be integer values.

codemanyak avatar May 28 '19 10:05 codemanyak

Partially fixed (for the explicit use of div operators).

codemanyak avatar Jun 13 '19 00:06 codemanyak

Will be accomplished together with #800.

codemanyak avatar Apr 24 '20 18:04 codemanyak