Summary
- Namespace
- TCLite
.Constraints - Base Types
-
- object
Syntax
public class FloatingPointNumerics
Remarks
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 for smaller numbers 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.
Methods
Name | Value | Summary |
---|---|---|
AreAlmostEqualUlps |
bool |
Compares two double precision floating point values for equality
static
|
AreAlmostEqualUlps |
bool |
Compares two floating point values for equality
static
|
ReinterpretAsDouble |
double |
Reinterprets the memory contents of an integer value as a double precision
floating point value
static
|
ReinterpretAsFloat |
float |
Reinterprets the memory contents of an integer as a floating point value
static
|
ReinterpretAsInt |
int |
Reinterprets the memory contents of a floating point value as an integer value
static
|
ReinterpretAsLong |
long |
Reinterprets the memory contents of a double precision floating point
value as an integer value
static
|