-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Now that arithmetic operators are aligned with common conventions (% as remainder instead of //), it appears there is no longer a dedicated integer division operator. Is this intentional, or is there an alternative I’ve overlooked?
gap = 101
new=gap/2
say new
This produces: 50.5
I am referring to the documented operators:
- Under
OPTIONS NUMERIC_COMMON: (which is standard)%performs the remainder operation./performs integer division if both operands are integers; otherwise, it performs normal division.//is not strickly a valid operator, however, to support legacy code, it is treated as an alias for%.
Given this, I would expect gap / 2 to yield 50 rather than 50.5.
At the moment, I’m using the IDIV assembler instruction as a workaround.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels