ULP : Java Glossary
home U words local find no local find frame, full screen Google search web for topic jump to footer translate with Babelfish by Roedy Green ©1996-2008 Canadian Mind Products
Go to : punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all)
ULP
Unit in the Last Place is the smallest possible increment or decrement that can be made using the machine’s floating point arithmetic. In Java’s IEEE format, floating point numbers are stored as finite binary fractions. An 0.5 ulp maximum error is the best you could hope for, since this corresponds to always rounding to the nearest representable floating-point number. In Java, results are usually guaranteed to be accurate to within 1 or 2 ulps. Math.sqrt is guaranteed to be bang on for perfect integral squares where the values can be perfectly represented.

Prof. Kahan came up with the notion of an ulp. An ulp of a real number value is the distance between the floating-point numbers which bracket the real value. Of course since the only reals we can represent happen to be floating-point numbers, this corresponds to the distance between adjacent floating-point values. To avoid ambiguities at powers of two (where the distance between numbers changes), we can define an ulp of a floating-point value to be the distance to the next floating-point value larger in magnitude.

In Java, all the arithmetic operations {+, -, *, /, sqrt} have error of less than 1/2 ulp assuming their inputs are exact; i.e. assuming you want to take the square root of the floating-point number closest to 0.1 not 0.1 exactly. Much of the math library must be accurate to 1 ulp although a few functions only require 2 ulps. Of course even with correct rounding at each step, the final answer could be widely inaccurate due to accumulated and amplified round-off errors.

Learning More

Sun’s Javadoc on the ulp method : available:

CMP_homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.16] The information on this page is for non-military use only.
You are visitor number 8,851. Military use includes use by defence contractors.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/Mindprod website mirror)
http://mindprod.com/jgloss/ulp.html J:\mindprod\jgloss\ulp.html