1

A literal of 0.25 can be expressed with 1*2^(-2) so that we can get 1 as significand and -2 as exponent.

What function can I get the significand/exponent with C#?

int significand = GetSignificand(0.25); // 1 
int exponent = GetExponent(0.25); // -2

As the floating point numbers are stored in sign/significand/exponent format, I think there should be a straightforward way to read them.

prosseek
  • 182,215
  • 215
  • 566
  • 871
  • 1
    Why is it 1*2^(-2) ? Why not 2^-4*4 ? – flq Nov 07 '11 at 20:27
  • you'd better write 4*2^(-4)... what you write is bit different. and to your question, I think, he would something like a * 2 ^ b where a and b are to found... – sasjaq Nov 07 '11 at 20:40
  • sasjaq, that's my point, based on what rules do you further restrict the infinite number of combinations of a and b that satisfy the outlined condition? – flq Nov 07 '11 at 20:54
  • Does this answer your question? [Extracting mantissa and exponent from double in c#](https://stackoverflow.com/questions/389993/extracting-mantissa-and-exponent-from-double-in-c-sharp) – Clément Apr 22 '22 at 21:05

0 Answers0