Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>1) Floating-point numbers have significands (with linear scale, also called the fraction portion), not mantissas (with logarithmic scales).</p> <p>2) Your function is declared to return an <code>int</code>, but you attempt to return <code>resultString</code>, which is an array of <code>char</code>. An array of <code>char</code> is not an <code>int</code> and cannot be automatically converted to an <code>int</code>.</p> <p>3) If you did return <code>resultString</code>, it would fail because the lifetime of <code>resultString</code> is only the time during function execution; it cannot be used after the function returns. If you do intend to return characters from the function, it should be declared so that the caller passes in an existing array of suitable size or the function dynamically allocates an array (as with <code>malloc</code>) and returns its address to the caller, who is responsible for eventually deallocating it (with <code>free</code>).</p> <p>4) If you want to return an <code>int</code> with the bits of the encoded significand, and <code>number</code> contains the encoded floating-point number with the encoded significand in the low bits, then all you have to do is remove the high bits with an AND operation and return the low bits.</p> <p>5) If the array of char is to form a printable numeral rather than numeric bits, then <code>'0'</code> should be added to each one, to convert it from the integer 0 or 1 to the character “0” or “1”. In this case, you may also want a null character at the end of <code>resultString</code>.</p> <p>6) The bits are assigned to <code>resultString</code> in order from low bit to high bit, which may be the opposite order from desired if <code>resultString</code> is intended to be printed later. (The order may be fine if <code>resultString</code> will only be used for calculation, not printing.)</p> <p>7) The above presume you want to return only the encoded significand, which is the explicit bits in the floating-point encoding. If you want to return the represented significand, including the implicit bit, then you need a 24<sup>th</sup> position, and it is 1 if the exponent is non-zero and 0 otherwise. (And presuming, of course, that the number is not a NaN or infinity.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload