Library Documentation Index

Safe Numerics

PrevUpHomeNext

enum class safe_numerics_error

The following values are those which a numeric result might return. They resemble the standard error codes used by C++ standard exceptions. This resemblance is coincidental and they are wholly unrelated to any codes of similar names. The reason for the resemblance is that the library started it's development using the standard library codes. But as development progressed it became clear that the original codes weren't sufficient so now they stand on their own. Here are a list of error codes. The description of what they mean is

Symbol Description
success successful operation - no error returned
positive_overflow_error A positive number is too large to be represented by the data type
negative_overflow_error The absolute value of a negative number is too large to be represented by the data type.
underflow_error A number is too close to zero to be represented by the data type.
range_error an argument to a function or operator is outside the legal range - e.g. sqrt(-1).
domain_error the result of an operation is outside the legal range of the result.
implementation_defined_behavior operation may or may not return the expected result.
undefined_behavior According to the C++ standard, the result is undefined. e.g. 10 << 80 shifts bits off the left and returns an unexpected result of 0 on most machines.
uninitialized_value According to the C++ standard, the result may be defined by the application. e.g. 16 >> 10 will result the expected result of 0 on most machines.

The above listed codes can be transformed to a instance of type std::error_code with the function:

std::error_code make_error_code(safe_numerics_error e)

This object can be


PrevUpHomeNext