I suggest you ...

add a Math.Ulp function

ULP mean Unit in the Last Place.

It is implemented in Java and is useful in some cases.

Here is some code I have write, but I'm not sure of my implementation :

float absX = Math.Abs(value);

byte[] bytes = BitConverter.GetBytes(absX);
if (BitConverter.IsLittleEndian)
bytes[0]++;
else
bytes[bytes.Length - 1]++;

float nextFloatNumber = BitConverter.ToSingle(bytes, 0);

return (nextFloatNumber - absX);

Take a look at :
http://stackoverflow.com/questions/1668183/find-min-max-of-a-float-double-that-has-the-same-internal-representation

2 votes
Vote 0 votes Vote Vote
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    I agree to the terms of service

    You'll receive a confirmation email with a link to create a password (optional).

    Signed in as (Sign out)
    You have left! (?) (thinking…)
    anonymousanonymous shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      I agree to the terms of service

      You'll receive a confirmation email with a link to create a password (optional).

      Signed in as (Sign out)
      Submitting...

      Knowledge Base and Helpdesk