What does errno 34 (ERANGE) mean?

 

Could be also:

ConstantTypeOS
ERROR_WRONG_DISKWin32 errorWindows
KERN_INVALID_MEMORY_CONTROLKern returnMac
ippStsStreamEndIntel Ipp StatusAny
FILE_SYSTEMBugCheck CodeWindows
Previous Next
EDOM EDEADLK

ERANGE

Valid input, unusable result

ERANGE usually indicates that an operation is meaningful, but its result cannot be represented by the destination type or interface. Mathematical functions can use it for overflow and underflow. A pole error, such as log(0), also produces ERANGE because the exact mathematical result is an infinity.

The same error is not restricted to floating-point math. strtol() returns LONG_MAX or LONG_MIN and sets errno to ERANGE when a parsed integer overflows or underflows long. A caller that only looks at the returned boundary value cannot distinguish a real boundary value from a conversion failure.

How it differs from EDOM

ConditionMeaningTypical example
EDOMThe input lies outside the function’s domain.log(-1) or a negative base with a nonintegral pow() exponent.
ERANGEThe operation is defined, but the result does not fit the target representation.Overflow in pow() or an out-of-range integer parsed by strtol().

Checking and handling the condition

  • For integer conversion, set errno to zero before strtol(), keep the end-pointer result, and then test for ERANGE.
  • For mathematical functions, clear floating-point exceptions before the call and inspect FE_OVERFLOW, FE_UNDERFLOW, and FE_DIVBYZERO together with the function result and errno.
  • Choose deliberately between rejecting the input, storing a wider type, scaling the value, or applying a documented saturation rule. Silent clamping can conceal an earlier data or unit error.

References

About “What is” service

Many of users are faced with the problem of interpreting errors that occur during the work of operating systems. In some cases, the operating system reports that an error has occurred and displays only an integer error code value. Often it is difficult to even roughly understand the cause of the error from the information given out. Our “what is” service contains a database of errors in Windows, Linux, Macos and Solaris operating systems. The database contains tens of thousands of values. In most cases, the online service will be able to help with the definition of the short name of the error and its detailed description.

Categories

Current version of service supports following types of error and status codes:

NTSTATUSMany kernel-mode standard driver routines and driver support routines use the NTSTATUS type for return values. Additionally, drivers provide an NTSTATUS-typed value in an IRP’s IO_STATUS_BLOCK structure when completing IRPs. The NTSTATUS type is defined in Ntdef.h, and system-supplied status codes are defined in Ntstatus.h.
Win32 errorWin32 error codes MUST be in the range 0x0000 to 0xFFFF, although Win32 error codes can be used both in 16-bit fields (such as within the HRESULT type specified in section in this article) as well as 32-bit fields. Most values also have a default message defined, which can be used to map the value to a human-readable text message; when this is done, the Win32 error code is also known as a message identifier.
HRESULTHRESULT is a data type used in Windows operating systems, and the earlier IBM/Microsoft OS/2 operating system, to represent error conditions, and warning conditions.
The original purpose of HRESULTs was to formally lay out ranges of error codes for both public and Microsoft internal use in order to prevent collisions between error codes in different subsystems of the OS/2 operating system.
HRESULTs are numerical error codes. Various bits within an HRESULT encode information about the nature of the error code, and where it came from.
HRESULT error codes are most commonly encountered in COM programming, where they form the basis for a standardized COM error handling convention.
HTTP Status CodeHypertext Transfer Protocol (HTTP) response status codes. Status codes are issued by a server in response to a client’s request made to the server. It includes codes from IETF Request for Comments (RFCs), other specifications, and some additional codes used in some common applications of the HTTP. The first digit of the status code specifies one of five standard classes of responses. The message phrases shown are typical, but any human-readable alternative may be provided.
errnoInteger value, which is returned by system calls and some library functions in the event of an error to indicate what went wrong. errno is defined by the ISO C standard to be a modifiable lvalue of type int, and must not be explicitly declared; errno may be a macro. errno is thread-local; setting it in one thread does not affect its value in any other thread.
Kern ReturnApple Kernel return codes.
Ipp StatusThe IppStatus constant enumerates the status values returned by the Intel IPP functions, indicating
whether the operation is error-free.

Source code

The service is based on the open source library AllStat. Its sources are available on our git server. We will be grateful for your participation in the finalization of the library and ideas for the development of the service. You can also download ErrorLookup utility and libraries from our site.