Exemple #1
0
        /// <summary>
        /// A representation of the Double bits formatted for easy readability
        /// </summary>
        /// <param name="bits"></param>
        /// <returns></returns>
        public string ToString(long bits)
        {
            double x      = BitConverter.Int64BitsToDouble(bits);
            string numStr = HexConverter.ConvertAny2Any(bits.ToString(), 10, 2);
            string padStr = "0000000000000000000000000000000000000000000000000000000000000000" + numStr;
            string bitStr = padStr.Substring(padStr.Length - 64);
            string str    = bitStr.Substring(0, 1) + "  " + bitStr.Substring(1, 12) + "(exp) "
                            + bitStr.Substring(12) + " [ " + x + " ]";

            return(str);
        }
Exemple #2
0
        /// <summary>
        /// A representation of the Double bits formatted for easy readability.
        /// </summary>
        public override string ToString()
        {
            string numStr = HexConverter.ConvertAny2Any(xBits.ToString(), 10, 2);

            // 64 zeroes!
            string zero64 = "0000000000000000000000000000000000000000000000000000000000000000";
            string padStr = zero64 + numStr;
            string bitStr = padStr.Substring(padStr.Length - 64);
            string str    = bitStr.Substring(0, 1) + "  "
                            + bitStr.Substring(1, 12) + "(" + Exponent + ") "
                            + bitStr.Substring(12)
                            + " [ " + x + " ]";

            return(str);
        }