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

Numerics implementation #6

Open
jxy-s opened this issue Apr 26, 2024 · 1 comment
Open

Numerics implementation #6

jxy-s opened this issue Apr 26, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@jxy-s
Copy link
Collaborator

jxy-s commented Apr 26, 2024

Description of the feature, modification, idea, or suggestion.

It is a common pattern to want to fail cleanly if some numeric boundary condition is met. As an example, Microsoft provides intsafe.h and ntintsafe.h functions. In a similar vein, Radiant should provide objects that aid in this and lean toward encouraging/providing safe constructs.

Proposed implementation details (optional)

Rust has a good story and semantics around their numeric handling (e.g. u8, u32, etc.). The Rust APIs here give checked, unchecked, and saturating APIs that seem reasonable. We should consider borrowing from their semantics.

@jxy-s jxy-s added the enhancement New feature or request label Apr 26, 2024
@jxy-s
Copy link
Collaborator Author

jxy-s commented Apr 26, 2024

This was partially implemented for up to 32 bit wide integers. More compiler-specific support is necessary to support optimizing 64 bit integers. The initial work provides a limited set of operations against the integers - such as saturating and checked addition, subtraction, and multiplication.

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

No branches or pull requests

1 participant