 # Rounding

## Rounding Topics

Sort by:

### Roundoff error

Roundoff error is the difference between an approximation of a number used in computation and its exact (correct) value. In certain types of computation, roundoff error can be magnified as any initial errors are carried through one or more intermediate steps.An egregious example of roundoff error is provided by a short-lived index devised at the Vancouver stock exchange (McCullough and Vinod 1999). At its inception in 1982, the index was given a value of 1000.000. After 22 months of recomputing the index and truncating to three decimal places at each change in market value, the index stood at 524.881, despite the fact that its "true" value should have been 1009.811.Other sorts of roundoff error can also occur. A notorious example is the fate of the Ariane rocket launched on June 4, 1996 (European Space Agency 1996). In the 37th second of flight, the inertial reference system attempted to convert a 64-bit floating-point number to a 16-bit..

### Power fractional parts

Hardy and Littlewood (1914) proved that the sequence , where is the fractional part, is equidistributed for almost all real numbers (i.e., the exceptional set has Lebesgue measure zero). Exceptional numbers include the positive integers, the silver ratio (Finch 2003), and the golden ratio . The plots above illustrate the distribution of for , , , and . Candidate members of the measure one set are easy to find, but difficult to prove. However, Levin has explicitly constructed such an example (Drmota and Tichy 1997).The properties of , the simplest such sequence for a rational number , have been extensively studied (Finch 2003). The first few terms are 0, 1/2, 1/4, 3/8, 1/16, 19/32, 25/64, 11/128, 161/256, 227/512, ... (OEIS A002380 and A000079; Pillai 1936; Lehmer 1941), plotted above (Wolfram 2002, pp. 121-122). For example, has infinitely many accumulation points in both and (Pisot 1938, Vijayaraghavan 1941). Furthermore, Flatto..

### Power floors

The sequence is given by 1, 1, 2, 3, 5, 7, 11, 17, 25, 38, ... (OEIS A002379). The first few composite occur for , 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 23, ... (OEIS A046037), corresponding to the composites 25, 38, 57, 86, 129, 194, 291, 437, 656, ... (OEIS A070758). Similarly, the first few prime occur for , 4, 5, 6, 7, 21, 22, 98, ... (OEIS A070759), corresponding to the primes 2, 3, 5, 7, 11, 17, 4987, 7481, 180693856682317883, ... (OEIS A067904).The sequence is given by 1, 1, 2, 3, 4, 5, 7, 9, 13, 17, 23, ... (OEIS A064628). The first few composite occur for , 8, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, ... (OEIS A046038), corresponding to composites 4, 9, 42, 56, 74, 99, 133, 177, 236, ... (OEIS A070761). Similarly, the first few prime occur for , 6, 7, 9, 10, 11, 12, 38, 42, 59, 96,... (OEIS A070762), corresponding to the primes 2, 3, 5, 7, 13, 17, 23, 31, 55933, 176777, 23517191, ... (OEIS A067905).There are infinitely many integers of the form and which are composite,..

### Power floor prime sequence

A power floor prime sequence is a sequence of prime numbers , where is the floor function and is real number. It is unknown if, though extremely unlikely that, infinite sequences of this type exist. An example having eight consecutive primes is , which gives 2, 5, 13, 31, 73, 173, 409, and 967 and has the smallest possible numerator and denominators for an 8-term sequence (D. Terr, pers. comm., Sep. 1, 2004). D. Terr (pers. comm., Jan. 21, 2003) has found a sequence of length 100.

### Power ceilings

Consider the sequence defined by andwhere is the ceiling function. For , 1, ..., the first few terms are 1, 2, 3, 5, 8, 12, 18, 27, 41, 62, ... (OEIS A061419; Wolfram 2002, p. 100, Fig. (b)).Odlyzko and Wilf (1991) have shown that satisfiesfor all , where (OEIS A083286) is analogous to Mills' constant in the sense that the formula is useless unless is known exactly ahead of time (Odlyzko and Wilf 1991, Finch 2003).

### Nearest integer function

The nearest integer function, also called nint or the round function, is defined such that is the integer closest to . While the notation is sometimes used to denote the nearest integer function (Hastad et al. 1988), this notation is rather cumbersome and is not recommended. Also note that while is sometimes used to denote the nearest integer function, is also commonly used to denote the floor function (including by Gauss in his third proof of quadratic reciprocity in 1808), so this notational use is also discouraged.Since the definition is ambiguous for half-integers, the additional rule that half-integers are always rounded to even numbers is usually added in order to avoid statistical biasing. For example, , , , , etc. This convention is followed in the C math.h library function rint, as well as in the Wolfram Language, where the nearest integer function is implemented as Round[x].Since usage concerning fractional part/value and integer..

### Floor function

The floor function , also called the greatest integer function or integer value (Spanier and Oldham 1987), gives the largest integer less than or equal to . The name and symbol for the floor function were coined by K. E. Iverson (Graham et al. 1994).Unfortunately, in many older and current works (e.g., Honsberger 1976, p. 30; Steinhaus 1999, p. 300; Shanks 1993; Ribenboim 1996; Hilbert and Cohn-Vossen 1999, p. 38; Hardy 1999, p. 18), the symbol is used instead of (Graham et al. 1994, p. 67). In fact, this notation harks back to Gauss in his third proof of quadratic reciprocity in 1808. However, because of the elegant symmetry of the floor function and ceiling function symbols and , and because is such a useful symbol when interpreted as an Iverson bracket, the use of to denote the floor function should be deprecated. In this work, the symbol is used to denote the nearest integer function since it naturally..

### Ceiling function

The function which gives the smallest integer , shown as the thick curve in the above plot. Schroeder (1991) calls the ceiling function symbols the "gallows" because of the similarity in appearance to the structure used for hangings. The name and symbol for the ceiling function were coined by K. E. Iverson (Graham et al. 1994). Min Max Re Im The ceiling function is implemented in the Wolfram Language as Ceiling[z], where it is generalized to complex values of as illustrated above.Although some authors used the symbol to denote the ceiling function (by analogy with the older notation for the floor function), this practice is strongly discouraged (Graham et al. 1994, p. 67). Also strongly discouraged is the use of the symbol to denote the ceiling function (e.g., Harary 1994, pp. 91, 93, and 118-119), since this same symbol is more commonly used to denote the fractional part of .Since usage concerning fractional..