Skip to content

Define remainder (and/or modulo) #621

Open
@domenic

Description

What is the issue with the Infra Standard?

whatwg/streams#1145 wants to use the equivalent of JavaScript's % operator. This is surprisingly subtle because of the difference between modulo and remainder. See discussion in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Remainder .

I suggest the terminology "the [remainder after dividing] |dividend| by |divisor|".

I also suggest that we add a clear note about how this maps to some language's % operator (JavaScript, C, C++) but mismatches others (Python, Perl).

There might also be some subtlety here about rounding toward 0 vs. not?

We should probably delegate the actual definition to https://tc39.es/ecma262/#sec-numeric-types-number-remainder , although I guess ideally we'd figure out #87 first.

/cc @MattiasBuelens

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions