Checked integer math types and operations.
To use this package, run the following command in your project's root directory:
Put the following dependency into your project's dependences section:
This package provides sub packages which can be used individually:
checkedint:tests - Exhaustive tests for the checkedint package. Verifies correctness and measures performance.
Checked integer math module for the D Programming Language
As with many other languages (C, C++, Java, etc.), D's built-in integer data types are quite difficult to use correctly.
It is tempting to think of
int, for example, as if it were an actual mathematical integer. Doing so, however leads to buggy code due to unintuitive behaviour like:
- Wrapped overflow
- Reinterpretation of signed values as unsigned in mixed expressions
Floating Point Exceptions which aren't
Exceptions and have nothing to do with floating point
- Formally "undefined behaviour" with some inputs for various operations
checkedint module provides alternative operations and types that protect the user from most difficulties of this sort, while maintaining good performance (provided that inlining and optimizations are enabled).
The main downsides to using
- Some added friction when interfacing to non-
- Slower compilation and larger binaries.
dub build -b docs to generate more extensive documentation for this package.
This library is available as a DUB package: http://code.dlang.org/packages/checkedint
- Registered by Thomas Stuart Bockman
- 0.7.0 released a year ago
- Copyright © 2015, Thomas Stuart Bockman
- Sub packages:
0.7.0 2020-Apr-18 0.6.1 2020-Apr-18 0.6.0 2020-Apr-18 0.5.3 2016-Jun-09 0.5.2 2016-Jun-08
- Download Stats:
0 downloads today
0 downloads this week
1 downloads this month
91 downloads total
- Short URL: