Talk:Unit in the last place

Latest comment: 2 months ago by Vincent Lefèvre in topic Minimal exponent in the definition of ULP

Gap

edit

Please define gap. Thanks, --Abdull (talk) 15:13, 6 October 2009 (UTC)Reply

C++ and Boost.MathToolkit library

edit

The Boost Math Toolkit library [1] brings you here. So maybe a section showing usage of would be appropriate and useful:

#include <boost/math/special_functions/next.hpp>
float_distance(float_next(a), a);  // always returns 1

Robbiemorrison (talk) 11:44, 1 November 2010 (UTC)Reply

I doubt it is worth to use some random library to demonstrate usage. Especially when standard C (C99) and C++ (yet unfinished C++0x) will have this feature as nextafterf function in math.h. 1exec1 (talk) 20:26, 3 November 2010 (UTC)Reply
Okay. It was the float_distance function I wished to focus on. Perhaps using a and b would be better? Robbiemorrison (talk) 16:21, 12 November 2010 (UTC)Reply

What is ULP again?

edit

It seems to me that half of this article discusses the ULP as if it's a really small number (1 or less) and the other half as if it's a really big number (224 or 253). This should be clarified in the examples. Also, what's the name of the latter type of number (biggest integer that can be represented in floating point with full accuracy)? I know I've heard a term for it before... - dcljr (talk) 19:56, 11 January 2011 (UTC)Reply

edit

Most links are marked 'citation needed' but the links are correct, current and the info and source areaccurate and I don't see that any further info is needed. May I delete these items if these criteria are met?

Paul A Bristow (talk) 11:47, 26 May 2015 (UTC)Reply

Links to Wikipedia pages are not considered citations. As per Citing Sources each Wikipedia article is expected to be self-contained in terms of providing reference sources and citation to them to support facts. Links to other articles are merely aids to navigation and to finding additional information. This can be important when articles are reused or printed. DES (talk) 20:07, 27 May 2015 (UTC)Reply
It is statements (often sentences) which are marked 'citation needed', not links. DES (talk) 20:09, 27 May 2015 (UTC)Reply

OK - see the Wikipedia requirements now. I have provided a citation for the Boost entry (ulp function is new unreleased and I will update when the full link is known - added 1 Sep 215).

Paul A Bristow (talk) 08:45, 28 May 2015 (UTC)Reply

Does the article still need further "citations for verification" or can we assume that at this point we could remove the template? I think it might not be perfect yet but it should probably be enough? --Evotopid (talk) 12:19, 1 December 2016 (UTC)Reply

Minimal exponent in the definition of ULP

edit

User:Vincent_Lefèvre The sole purpose of   in [Handbook of Floating-Point Arithmetic] is to support subnormal numbers represented using  . That is,   by itself introduces a dependency on the encoding. If   is defined as "minimal exponent of the normal numbers" then, in my opinion, this definition hides that purpose of   but still implies subnormal numbers and their encoding. So it seams appropriate to either:

  • mention the purpose of   in the definition and that it can be ignored (or set to  ) when subnormals are not taken into account;
  • or remove   from the first definition completely and provide a less confusing Goldberg's one:  , moving information about handling of subnormals via   below the basic definition or to a footnote.

Personally, I am in favor of the latter, because (a)   seems like an overcomplicating detail unnecessary for a basic definition and (b) it introduces the said dependency on floating-point encoding. 86.102.214.55 (talk) 10:10, 8 April 2024 (UTC)Reply

I further studied the source [Handbook of Floating-Point Arithmetic] which the article cites, and this first definition of ULP given in the article seems to be entirely incorrect.

First, the authors quote Goldberg's definition of ULP, which is  .

Then they introduce Definition 5, which they call "Goldberg's definition, extended to reals", which is the definition used in the Wikipedia article, stating that it is used "if we want to handle the subnormal numbers properly".

For simplicity here let not want to do that, and assume that  , where   and   are two adjacent floating-point numbers.

That is, by the definition of the authors and the Wikipedia article,   which is the Harrison's ulp as opposed to the Goldberg's one. The Goldberg's ulp, which the cited handbook quotes, is: "if the floating-point number   is used to represent  , then it is in error by   units in the last place" [I changed the variables here to correspond to the Wikipedia article].

That is, the Goldberg's ulp, as opposed to the Harrison's ulp, depends on which floating-point number is chosen as the approximate value of  . Particularly, if approximate value of   is  , then the difference between the definitions arise: in this case   contrary to the Wikipedia article and Harrison's definition.

Indeed, by the Goldberg's definition, 1 ulp in this case equals   for some   which is one Goldberg's unit in the last place less than  . But this implies that   which is   times greater than the both the Harrison's definition and what the Wikipedia article (together with the cited book) states.

Given this, and my earlier comment, I suggest the following correction to the article:

  • move   out of the first definition to a footnote;
  • correct the first definition to " , where   is the exponent of the floating-point approximation chosen for  ".

If there are no objections to these, I will correct the article as stated in the coming days.

Regards. 86.102.214.55 (talk) 13:02, 8 April 2024 (UTC)Reply

First,   is a property of the floating-point system. It is defined at the representation level (Level 3 of IEEE 754), without the necessity to specify the encoding (Level 4).
Concerning Goldberg's paper, the subnormal range is ignored, as in a footnote, Goldberg says: "Numbers which are out of range in this fashion will not be considered until further notice."
Concerning  , this corresponds to Goldberg's ulp for the normal range. There are no such simple formulas for Harrison's ulp, where 2 cases need to be distinguished (whether x is or isn't a power of the radix).
One possibility would be to give a first definition for the normal range (also valid with an unbounded exponent range, where   does not exist, but that's purely theory), thus exactly corresponding to Goldberg's definition. And then give the more general definition for a floating-point system with or without subnormals (note that in practice,   exists whether the system has subnormals or not, and the general formula   remains valid in both cases).
Regards,
Vincent Lefèvre (talk) 13:50, 8 April 2024 (UTC)Reply