Skip to content

Revisit % operator semantics #284

@osa1

Description

@osa1

Currently % works the same way as Rust %.

This is not a deliberate choice: I needed a remainder operation with positive dividend and divisor. And because the interpreter is in Rust, using Rust's % for this operation was the easiest implementation that gave me what I wanted.

For the long term though, we should consider the alternative implementations. I found this blog post which has a survey of different implementations in different languages, and thoughts on which one should be used in new languages: https://julesjacobs.com/2023/09/23/on-div-and-mod.html.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions