Overview:
-
For a given floating point number, the function ulp(num) returns the distance between the number and the next floating point number. This is applicable to signed floating point numbers as well.
-
As the magnitude of a floating point number increases the precision with which it can be represented decreases. The ulp also differs as the value range of the floating point number changes.
Example:
# Example Python program that prints the # A big magnitude in floating point representation |
Output:
Number:100000000000000000.000000 ulp:16.000000 Next floating point number:100000000000000016.000000 |