Unit in the last place

Unit in the last place

In computer science, Unit in the Last Place or Unit of Least Precision (ULP) is the gap between two very close floating-point numbers. To be exact, ulp(x) is the gap between the two floating-point numbers closest to the value x.

The amount of error in the evaluation of a floating-point operation is often expressed in ULP. An average error of 1 ULP is often seen as a tolerable error.

Example

If the ULP is less than or equal to 1, then adding 1 to a floating-point number will succeed. Otherwise, adding 1 will have no effect. This is demonstrated in the following Haskell code typed at an interactive prompt:

> until (x -> x = x+1) (+1) 0 :: Float 1.6777216e7 > it-1 1.6777215e7 > it+1 1.6777216e7

Here, we start with 32-bit single-precision 0 and keep adding 1 until the operation is idempotent. The result is about 17 million.

Another example, in Python, is (typed at an interactive prompt):

>>> x = 1.0 >>> while (x != x + 1.0): ... x = x * 10.0 ... >>> print x 1e+16

using double-precision floating-point.

Language support

Since Java 1.5, the Java standard library has included Javadoc:SE|java/lang|Math|ulp(double) and Javadoc:SE|java/lang|Math|ulp(float) functions.

References

* [ftp://ftp.inria.fr/INRIA/publication/publi-pdf/RR/RR-5504.pdf On the definition of ulp(x)] by Jean-Michel Muller, INRIA Technical Report 5504.

See also

* IEEE 754
* Least significant bit


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • The Last Starfighter — Theatrical release poster Directed by Nick Castle Produced by …   Wikipedia

  • The Last Time — Single par The Rolling Stones extrait de l’album Out of Our Heads Pays  Royaume Uni …   Wikipédia en Français

  • The Last Sontaran — Épisode de The Sarah Jane Adventures Titre original The Last Sontaran Numéro d’épisode Saison 2 Épisode 1 Code de production 2.1 2.2 Réalisation Charles Martin Scénario Phil Ford Pr …   Wikipédia en Français

  • The Last Sontaran — Doctorwhobox number=07 serial name=The Last Sontaran caption=As Kaagh, the last Sontaran of the Tenth Sontaran Battle Fleet, attempts to take Luke, Clyde, Maria and Sarah Jane captive, Maria creates a distraction by pointing to UNIT troops… …   Wikipedia

  • The Last Samurai — This article is about the film. For the unrelated novel, see The Last Samurai (novel). The Last Samurai Theatrical release poster Directed by Edward Zwick …   Wikipedia

  • Indiana Jones and the Last Crusade — This article is about the film. For the video games, see Indiana Jones and the Last Crusade (video game). Indiana Jones and the Last Crusade Theatrical poster by Drew Struzan …   Wikipedia

  • List of Y: The Last Man characters — Yorick Brown …   Wikipedia

  • Nora: The Last Chronicle of Devildom — North American cover of Nora: The Last Chronicle of Devildom volume 1 NORA ノラ …   Wikipedia

  • The Man with the Golden Gun (film) — Infobox Film Bond name = The Man with the Golden Gun caption = The Man with the Golden Gun film poster by Robert McGinnis bond = Roger Moore stars = Christopher Lee Britt Ekland Maud Adams writer = Ian Fleming screenplay = Richard Maibaum Tom… …   Wikipedia

  • UNIT dating controversy — The UNIT dating controversy is an ongoing debate in Doctor Who fandom, concerning exactly when the stories featuring the fictional military organization known as United Nations Intelligence Taskforce or more recently as the Unified Intelligence… …   Wikipedia

Share the article and excerpts

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