Nearest integer function

Nearest integer function

In computer science, the nearest integer function of real number x denoted variously by [x][1], \lfloor x \rceil, \Vert x \Vert,[2] nint(x), or Round(x), is a function which returns the nearest integer to x. To avoid ambiguity when operating on half-integers, a rounding rule must be chosen. On most computer implementations, the selected rule is to round half-integers to the nearest even integer — for example,

[1.25] = 1
[1.50] = 2
[1.75] = 2
[2.25] = 2
[2.50] = 2
[2.75] = 3
[3.25] = 3
[3.50] = 4
[3.75] = 4
[4.50] = 4
etc.

This is in accordance with the IEEE 754 standards and helps reduce bias in the result.

There are many other possible rules for tie breaking when rounding a half integer include rounding up, rounding down, rounding to or away from zero, or random rounding up or down.

See also

References

  1. ^ Weisstein, Eric W., "Nearest Integer Function" from MathWorld.
  2. ^ J.W.S. Cassels (1957). An introduction to Diophantine approximation. Cambridge Tracts in Mathematics and Mathematical Physics. 45. Cambridge University Press. p. 1. 

Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Double exponential function — A double exponential function (red curve) compared to a single exponential function (blue curve). A double exponential function is a constant raised to the power of an exponential function. The general formula is , which grows much more quickly… …   Wikipedia

  • Window function — For the term used in SQL statements, see Window function (SQL) In signal processing, a window function (also known as an apodization function or tapering function[1]) is a mathematical function that is zero valued outside of some chosen interval …   Wikipedia

  • k-nearest neighbor algorithm — KNN redirects here. For other uses, see KNN (disambiguation). In pattern recognition, the k nearest neighbor algorithm (k NN) is a method for classifying objects based on closest training examples in the feature space. k NN is a type of instance… …   Wikipedia

  • K-nearest neighbor algorithm — In pattern recognition, the k nearest neighbor algorithm ( k NN) is a method for classifying objects based on closest training examples in the feature space. k NN is a type of instance based learning, or lazy learning where the function is only… …   Wikipedia

  • Rounding — This article is about numerical rounding. For lip rounding in phonetics, see Labialisation. For other uses, see Rounding (disambiguation). Rounding a numerical value means replacing it by another value that is approximately equal but has a… …   Wikipedia

  • Floor and ceiling functions — In mathematics and computer science, the floor and ceiling functions map real numbers to nearby integers. [Ronald Graham, Donald Knuth and Oren Patashnik. Concrete Mathematics . Addison Wesley, 1999. Chapter 3, Integer Functions .] The floor… …   Wikipedia

  • Generalizations of Fibonacci numbers — In mathematics, the Fibonacci numbers form a sequence defined recursively by:: F (0) = 0: F (1) = 1: F ( n ) = F ( n 1) + F ( n 2), for integer n > 1.That is, after two starting values, each number is the sum of the two preceding numbers.The… …   Wikipedia

  • List of mathematics articles (N) — NOTOC N N body problem N category N category number N connected space N dimensional sequential move puzzles N dimensional space N huge cardinal N jet N Mahlo cardinal N monoid N player game N set N skeleton N sphere N! conjecture Nabla symbol… …   Wikipedia

  • List of mathematical symbols — This is a listing of common symbols found within all branches of mathematics. Each symbol is listed in both HTML, which depends on appropriate fonts being installed, and in TeX, as an image. This list is incomplete; you can help by expanding it.… …   Wikipedia

  • Subfactorial — In mathematics, the subfactorial function is a function from the set of natural numbers to itself, whose value at n gives the number of permutations of a sequence of n distinct values in which none of the elements occur in their original place;… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”