From 3731fc42ae994578b67d7a9ec1a3f8674471c365 Mon Sep 17 00:00:00 2001 From: Markus Ewald Date: Sun, 14 Dec 2008 18:05:14 +0000 Subject: [PATCH] Documented what an 'ulp' is supposed to be in the FloatHelper class :) git-svn-id: file:///srv/devel/repo-conversion/nusu@109 d2e56fa2-650e-0410-a79f-9358c0239efd --- Source/FloatHelper.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Source/FloatHelper.cs b/Source/FloatHelper.cs index 431eb96..ff27a1b 100644 --- a/Source/FloatHelper.cs +++ b/Source/FloatHelper.cs @@ -26,8 +26,21 @@ namespace Nuclex.Support { /// Helper routines for working with floating point numbers /// - /// The floating point comparison code is based on this excellent article: - /// http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm + /// + /// The floating point comparison code is based on this excellent article: + /// http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm + /// + /// + /// "ULP" means Unit in the Last Place and in the context of this library refers to + /// the distance between two adjacent floating point numbers. IEEE floating point + /// numbers can only represent a finite subset of natural numbers, with greater + /// accuracy on the lower end of the range and lower accuracy for very large numbers. + /// + /// + /// If a comparison is allowed "2 ulps" of deviation, that means the values are + /// allowed to deviate by up to 2 adjacent floating point values, which might be + /// as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. + /// /// public static class FloatHelper { @@ -85,7 +98,7 @@ namespace Nuclex.Support { /// True if both numbers are equal or close to being equal /// /// - /// Floating point values can only represent a limited series of natural numbers. + /// Floating point values can only represent a finite subset of natural numbers. /// For example, the values 2.00000000 and 2.00000024 can be stored in a float, /// but nothing inbetween them. ///