Информация о человеке

Егор Куняген

Был в онлайне 09 июня 2025 в 02:38:04

Проверка страницы Кунягена Егора ВКонтакте (VK)

Число подписчиков: 24

  • VK ссылка:id380629510
  • Ник:kuniahen_andrec
  • День рождения:21.9.1945
  • Сейчас проживает в:, Львов

Друзья

Актуальный статус

уволился🤗

Интересы и хобби

  • Интересы:

    using System; using System.Globalization; ///

    /// A class to allow the conversion of doubles to string representations of /// their exact decimal values. The implementation aims for readability over /// efficiency. /// public class DoubleConverter { /// /// Converts the given double to a string representation of its /// exact decimal value. /// /// The double to convert. /// A string representation of the double's exact decimal value. public static string ToExactString (double d) { if (double.IsPositiveInfinity(d)) return "+Infinity"; if (double.IsNegativeInfinity(d)) return "-Infinity"; if (double.IsNaN(d)) return "NaN"; // Translate the double into sign, exponent and mantissa. long bits = BitConverter.DoubleToInt64Bits(d); // Note that the shift is sign-extended, hence the test against -1 not 1 bool negative = (bits < 0); int exponent = (int) ((bits >> 52) & 0x7ffL); long mantissa = bits & 0xfffffffffffffL; // Subnormal numbers; exponent is effectively one higher, // but there's no extra normalisation bit in the mantissa if (exponent==0) { exponent++; } // Normal numbers; leave exponent as it is but add extra // bit to the front of the mantissa else { mantissa = mantissa | (1L<<52); } // Bias the exponent. It's actually biased by 1023, but we're // treating the mantissa as m.0 rather than 0.m, so we need // to subtract another 52 from it. exponent -= 1075; if (mantissa == 0) { return "0"; } /* Normalize */ while((mantissa & 1) == 0) { /* i.e., Mantissa is even */ mantissa >>= 1; exponent++; } /// Construct a new decimal expansion with the mantissa ArbitraryDecimal ad = new ArbitraryDecimal (mantissa); // If the exponent is less than 0, we need to repeatedly // divide by 2 - which is the equivalent of multiplying // by 5 and dividing by 10. if (exponent < 0) { for (int i=0; i < -exponent; i++) ad.MultiplyBy(5); ad.Shift(-exponent); } // Otherwise, we need to repeatedly multiply by 2 else { for (int i=0; i < exponent; i++) ad.MultiplyBy(2); } // Finally, return the string with an appropriate sign if (negative) return "-"+ad.ToString(); else return ad.ToString(); } /// Private class used for manipulating class ArbitraryDecimal { /// Digits in the decimal expansion, one byte per digit byte[] digits; /// /// How many digits are *after* the decimal point /// int decimalPoint=0; /// /// Constructs an arbitrary decimal expansion from the given long. /// The long must not be negative. /// internal ArbitraryDecimal (long x) { string tmp = x.ToString(CultureInfo.InvariantCulture); digits = new byte[tmp.Length]; for (int i=0; i < tmp.Length; i++) digits[i] = (byte) (tmp[i]-'0'); Normalize(); } /// /// Multiplies the current expansion by the given amount, which should /// only be 2 or 5. /// internal void MultiplyBy(int amount) { byte[] result = new byte[digits.Length+1]; for (int i=digits.Length-1; i >= 0; i--) { int resultDigit = digits[i]*amount+result[i+1]; result[i]=(byte)(resultDigit/10); result[i+1]=(byte)(resultDigit%10); } if (result[0] != 0) { digits=result; } else { Array.Copy (result, 1, digits, 0, digits.Length); } Normalize(); } /// /// Shifts the decimal point; a negative value makes /// the decimal expansion bigger (as fewer digits come after the /// decimal place) and a positive value makes the decimal /// expansion smaller. /// internal void Shift (int amount) { decimalPoint += amount; } //

  • Любимые цитаты:

    using System;
    using System.Globalization;

    ///


    /// A class to allow the conversion of doubles to string representations of
    /// their exact decimal values. The implementation aims for readability over
    /// efficiency.
    ///

    public class DoubleConverter
    {
    ///
    /// Converts the given double to a string representation of its
    /// exact decimal value.
    ///

    /// The double to convert.
    /// A string representation of the double's exact decimal value.
    public static string ToExactString (double d)
    {
    if (double.IsPositiveInfinity(d))
    return "+Infinity";
    if (double.IsNegativeInfinity(d))
    return "-Infinity";
    if (double.IsNaN(d))
    return "NaN";

    // Translate the double into sign, exponent and mantissa.
    long bits = BitConverter.DoubleToInt64Bits(d);
    // Note that the shift is sign-extended, hence the test against -1 not 1
    bool negative = (bits < 0);
    int exponent = (int) ((bits » 52) & 0x7ffL);
    long mantissa = bits & 0xfffffffffffffL;

    // Subnormal numbers; exponent is effectively one higher,
    // but there's no extra normalisation bit in the mantissa
    if (exponent==0)
    {
    exponent++;
    }
    // Normal numbers; leave exponent as it is but add extra
    // bit to the front of the mantissa
    else
    {
    mantissa = mantissa | (1L«52);
    }

    // Bias the exponent. It's actually biased by 1023, but we're
    // treating the mantissa as m.0 rather than 0.m, so we need
    // to subtract another 52 from it.
    exponent -= 1075;

    if (mantissa == 0)
    {
    return "0";
    }

    /* Normalize */
    while((mantissa & 1) == 0)
    { /* i.e., Mantissa is even */
    mantissa »= 1;
    exponent++;
    }

    /// Construct a new decimal expansion with the mantissa
    ArbitraryDecimal ad = new ArbitraryDecimal (mantissa);

    // If the exponent is less than 0, we need to repeatedly
    // divide by 2 - which is the equivalent of multiplying
    // by 5 and dividing by 10.
    if (exponent < 0)
    {
    for (int i=0; i < -exponent; i++)
    ad.MultiplyBy(5);
    ad.Shift(-exponent);
    }
    // Otherwise, we need to repeatedly multiply by 2
    else
    {
    for (int i=0; i < exponent; i++)
    ad.MultiplyBy(2);
    }

    // Finally, return the string with an appropriate sign
    if (negative)
    return "-"+ad.ToString();
    else
    return ad.ToString();
    }

    /// Private class used for manipulating
    class ArbitraryDecimal
    {
    /// Digits in the decimal expansion, one byte per digit
    byte[] digits;
    ///
    /// How many digits are *after* the decimal point
    ///

    int decimalPoint=0;

    ///
    /// Constructs an arbitrary decimal expansion from the given long.
    /// The long must not be negative.
    ///

    internal ArbitraryDecimal (long x)
    {
    string tmp = x.ToString(CultureInfo.InvariantCulture);
    digits = new byte[tmp.Length]

Фотографии

  • Егор Куняген фотография #1
  • Егор Куняген фотография #2
  • Егор Куняген фотография #3
  • Егор Куняген фотография #4
  • Егор Куняген фотография #5
  • Егор Куняген фотография #6
  • Егор Куняген фотография #7
  • Егор Куняген фотография #8
  • Егор Куняген фотография #9
  • Егор Куняген фотография #10
  • Егор Куняген фотография #11
  • Егор Куняген фотография #12
  • Егор Куняген фотография #13
  • Егор Куняген фотография #14
  • Егор Куняген фотография #15
  • Егор Куняген фотография #16
  • Егор Куняген фотография #17
  • Егор Куняген фотография #18
  • Егор Куняген фотография #19
  • Егор Куняген фотография #20
  • Егор Куняген фотография #21
  • Егор Куняген фотография #22
  • Егор Куняген фотография #23
  • Егор Куняген фотография #24
  • Егор Куняген фотография #25
  • Егор Куняген фотография #26
  • Егор Куняген фотография #27
  • Егор Куняген фотография #28
  • Егор Куняген фотография #29
  • Егор Куняген фотография #30
  • Егор Куняген фотография #31
  • Егор Куняген фотография #32
  • Егор Куняген фотография #33
  • Егор Куняген фотография #34
  • Егор Куняген фотография #35
  • Егор Куняген фотография #36
  • Егор Куняген фотография #37
  • Егор Куняген фотография #38
  • Егор Куняген фотография #39