[feature request] mod operator, like %

Issue #723 new
Mihai Ionescu created an issue

coming from ccalc, i find it cumbersome to write mod function name, plus parentheses too much for such a common operation

405 % 360

//instead of current
mod(450;360)

or why not, if % character is reserved for future business percentage operations, then pascal style at least:

361 mod 360

Comments (6)

  1. Tey'

    The % operator used to be a percentage operator. We removed it because its behavior was incoherent, and blacklisted it to prevent confusion. Also, we cannot use mod as an operator because it's already the name of a builtin function.

    But I agree it would be useful to have binary operators for modulo and some bitwise operations (AND, OR, XOR, ...). I'm not sure why they don't exist already, @heldercorreia can you shed some light?

  2. Mihai Ionescu reporter

    well, then % operator can be used? it would be super nice.

    Percentages would be done with specific functions (from what i saw, in android calculators, there are 2 ways to think about percentages, or multiple ways, and they require you to choose what you like as default)

  3. Helder Correia repo owner

    @Teyut They don't exist yet because of priority and time management only. The functions have been there for some time now and we haven't received that many requests for operators. PRs with new justifiable operators (that don't break existing tests) are of course mostly welcome.

  4. Musor

    I fully support and agree. Please add a user-configurable operator"%". So that everyone can choose for themselves how this function will work.

  5. Log in to comment