本文整理汇总了C#中HugeFloat.Reallocate方法的典型用法代码示例。如果您正苦于以下问题:C# HugeFloat.Reallocate方法的具体用法?C# HugeFloat.Reallocate怎么用?C# HugeFloat.Reallocate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HugeFloat
的用法示例。
在下文中一共展示了HugeFloat.Reallocate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FloatInputOutputStr62
public void FloatInputOutputStr62()
{
using(var a = new HugeFloat("10123456789ABCDEF012345.6789ABCDE", 16))
using(var b = HugeFloat.Allocate(12800))
using(var ms = new MemoryStream())
{
a.Reallocate(12800);
a.Value = a ^ 100;
using(var writer = new StreamWriter(ms, Encoding.UTF8, 1024, true))
a.Write(writer, 62, 0, false, false);
ms.Position = 0;
using(var reader = new StreamReader(ms, Encoding.UTF8, false, 1024, true))
b.Read(reader, 62, false);
Assert.AreEqual(a.ToString(62), b.ToString(62));
Assert.AreEqual(ms.Length, ms.Position);
Assert.AreEqual((char)0xFEFF + a.ToString(62), Encoding.UTF8.GetString(ms.ToArray()));
}
}
示例2: ExpressionsCalculatedToDestinationPrecision
public void ExpressionsCalculatedToDestinationPrecision()
{
using (var a = new HugeFloat(1))
using (var b = new HugeFloat(3))
using (var c = new HugeFloat(5))
using (var d = new HugeFloat(a / b + c))
{
Assert.AreEqual("[email protected]", d.ToString());
d.Reallocate(256);
d.Value = a / b + c;
Assert.AreEqual("0.533333333333333[email protected]1", d.ToString());
}
}