Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec: clarification needed for remainder operator on float operands #682

Open
peterhuene opened this issue Aug 26, 2024 · 0 comments
Open

Comments

@peterhuene
Copy link
Contributor

peterhuene commented Aug 26, 2024

Currently the remainder % operator (i.e. modulo) is accepting of Int and Float as operand types.

For two Int types, there is no question as to how the operation should be performed as it involves only integer division, e.g. a - ((a / b) * b), where a / b naturally truncates.

However, for Float operands or Int operands implicitly coerced to Float because the other operand is Float, floating point division is involved and there are several different methods for performing the operation.

I would assume the intention is to define the operator in terms of truncation to align with most programming languages, but some notable languages are flooring instead (e.g. Python, Ruby), so an explicit clarification is probably required for the WDL specification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@peterhuene and others