Skip to content

Integer utilities #122

@eisenwave

Description

@eisenwave

We already have P3605 for isqrt and P3724 for integer division, but there are many more integer utilities that could be provided, such as:

  • std::ipow(base, exp) for integer expontentiation
  • std::ilog(base, x) for integer logarithms
  • much faster versions of the above that accept a constant base
  • std::uabs (added to C2y, could be ported over pre-emptively or during C2y rebase in a few years)
  • std::max_mag and std::min_mag for picking the value with greater or lower magnitude
  • modular exponentionation, modular logarithm, and other modular arithmetic utilities
  • wrapping signed arithmetic operations without UB, like std::add_wrap(x, y)

Metadata

Metadata

Assignees

No one assigned

    Labels

    new-proposalIdea/discussion for possible new proposals

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions