![]() ![]() ![]() The exact treatment of error conditions from math functions is tedious. Programmers usually cannot prevent range errors, so the most reliable way to handle them is to detect when they have occurred and act accordingly. The most reliable way to handle domain and pole errors is to prevent them by checking arguments beforehand, as in the following exemplar:įprintf(stderr, "sqrt requires a nonnegative argument") The standard math functions not listed in this table, such as fabs(), have no domain restrictions and cannot result in range or pole errors.įmod(x, y), remainder(x, y), remquo(x, y, quo) The programmer must also check for range errors where they might occur. If a function has a specific domain over which it is defined, the programmer must check its input values. Both float and long double forms of these functions also exist but are omitted from the table for brevity. The following table lists the double forms of standard mathematical functions, along with checks that should be performed to ensure a proper input domain, and indicates whether they can also result in range or pole errors, as reported by the C Standard. Instead of preventing range errors, programmers should attempt to detect them and take alternative action if a range error occurs. Range errors usually cannot be prevented because they are dependent on the implementation of floating-point numbers as well as on the function being applied. Programmers can prevent domain and pole errors by carefully bounds-checking the arguments before calling mathematical functions and taking alternative action if the bounds are violated. An example of a pole error is log(0.0), which results in negative infinity. In both cases, the function will return some value, but the value returned is not the correct result of the computation. Contrastingly, 10 raised to the 1-millionth power, pow(10., 1e6), cannot be represented in many floating-point implementations because of the limited range of the type double and consequently constitutes a range error. Paragraph 2 statesĪ domain error occurs if an input argument is outside the domain over which the mathematical function is defined.Ī pole error (also known as a singularity or infinitary) occurs if the mathematical function has an exact infinite result as the finite input argument(s) are approached in the limit.Ī range error occurs if the mathematical result of the function cannot be represented in an object of the specified type, due to extreme magnitude.Īn example of a domain error is the square root of a negative number, such as sqrt(-1.0), which has no meaning in real arithmetic. The C Standard, 7.12.1, defines three types of errors that relate specifically to math functions in. If the infimum does not exist, one says often that the corresponding endpoint is − ∞. The endpoints of an interval are its supremum, and its infimum, if they exist as real numbers. Definitions and terminology Īn interval is a subset of the real numbers that contains all real numbers lying between any two numbers of the subset. Notable generalizations are summarized in a section below possibly with links to separate articles. Unless explicitly otherwise specified, all intervals considered in this article are real intervals, that is, intervals of real numbers. The notation of integer intervals is considered in the special section below. Intervals are likewise defined on an arbitrary totally ordered set, such as integers or rational numbers. Interval arithmetic consists of computing with intervals instead of real numbers for providing a guaranteed enclosure of the result of a numerical computation, even in the presence of uncertainties of input data and rounding errors. ![]() For example, they occur implicitly in the epsilon-delta definition of continuity the intermediate value theorem asserts that the image of an interval by a continuous function is an interval integrals of real functions are defined over an interval etc. Intervals are ubiquitous in mathematical analysis. An interval can contain neither endpoint, either endpoint, or both endpoints.įor example, the set of real numbers consisting of 0, 1, and all numbers in between is an interval, denoted and called the unit interval the set of all positive real numbers is an interval, denoted (0, ∞) the set of all real numbers is an interval, denoted (−∞, ∞) and any single real number a is an interval, denoted. Each endpoint is either a real number or positive or negative infinity, indicating the interval extends without a bound. In mathematics, a ( real) interval is the set of all real numbers lying between two fixed endpoints with no "gaps". All numbers greater than x and less than x + a fall within that open interval. For other uses, see Interval (disambiguation). For intervals in order theory, see Interval (order theory). ![]() This article is about intervals of real numbers and some generalizations. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |