public void FloatConstructorFromDoubleNegative() { using (var a = new HugeFloat(-123456789123456.75)) { FloatAssert.AreEqual("-123456789123456.75", a); } }
public void FloatPower() { using (var a = new HugeFloat("-902340.945098345")) { a.Value = a ^ 5; FloatAssert.AreEqual("-598209523815275040074985233466.4619735146023546465747916785912044", a); } }
public void FloatSqrt() { using (var a = new HugeFloat("9023404035982394058230584.9434590783455098345")) { a.Value = a.SquareRoot(); FloatAssert.AreEqual("3003898140081.0504277325488426221152130989784856425363142756", a); } }
public void FloatConstructorFromIntExpression() { using (var a = new HugeInt("2340958273409578234095823045723490587")) using (var b = new HugeFloat(a + 1)) { FloatAssert.AreEqual("2340958273409578234095823045723490588.", b); } }
public void FloatDivideSignedLimbBy() { using (var a = new HugeFloat("115756986.6683039458029384723405203984572")) { var b = Platform.Si(-5931690917503076532, -1288574029); a.Value = b / a; FloatAssert.AreEqual(Platform.Select("-51242616866.833708737257760720580856722540469109813901673959", "-11.13171710915684632967551560098368670502676808644707224"), a); } }
public void FloatAssignInt() { using (var a = new HugeInt("222509832503450298345029835740293845720")) using (var b = new HugeFloat()) { b.SetTo(a); FloatAssert.AreEqual("222509832503450298345029835740293845720.", b); } }
public void FloatAssignRational() { using (var a = new HugeRational(1, 3)) using (var b = new HugeFloat()) { b.SetTo(a); FloatAssert.AreEqual(".33333333333333333333333333333333333333333333333333333333333333333333333333333333333", b); } }
public void FloatToStringDecimal() { var n = "-234293847562.98357462983476598345623984756"; using (var a = new HugeFloat(n)) { FloatAssert.AreEqual(n, a); } }
public void FloatDivideLimbBy() { using (var a = new HugeFloat("115756986.6683039458029384723405203984572")) { var b = Platform.Ui(5931690917503076532, 3931690917); a.Value = b / a; FloatAssert.AreEqual(Platform.Select("51242616866.833708737257760720580856722540469109813901673959", "33.96504202606854669329208733080818384500235983519843605"), a); } }
public void FloatFromLong() { using (var a = new HugeFloat()) { var b = Platform.Si(-0x784739ABCDEF4876, -0x784739AB); a.SetTo(b); FloatAssert.AreEqual(b + ".", a); } }
public void FloatStringConstructor() { var n = "5432109876543212345789.70515331128527330659"; using (var a = new HugeFloat(n)) { FloatAssert.AreEqual(n, a); } }
public void FloatStringConstructorWithAlternativeExponentMarker2() { var n = "5432109876543212345789.70515331128527330659E3"; using (var a = new HugeFloat(n)) { FloatAssert.AreEqual("5432109876543212345789705.15331128527330659", a); } }
public void FloatDivideHugeFloat() { using (var a = new HugeFloat("1157569866683036578989624354347957.394580293847")) using (var b = new HugeFloat("593169091750307653294.549782395235784")) { a.Value = a / b; FloatAssert.AreEqual("1951500647593.2689953514865540344827449639493356367018584357", a); } }
public void FloatDivideLimb() { using (var a = new HugeFloat("1157569866683036578989624354347957.394580293847")) { var b = Platform.Ui(5931690917503076532, 3931690917); a.Value = a / b; FloatAssert.AreEqual(Platform.Select("195150064759326.89956625512472902395197480398952074748799190", "294420362922703412240180.51527521877035185414779643015361677"), a); } }
public void FloatDivideSignedLimb() { using (var a = new HugeFloat("1157569866683036578989624354347957.394580293847")) { var b = Platform.Si(-5931690917503076532, -1288574029); a.Value = a / b; FloatAssert.AreEqual(Platform.Select("-195150064759326.89956625512472902395197480398952074748799190", "-898334003814565921993779.6482998629445295873233838084750038"), a); } }
public void FloatMakeAbsolute() { using (var a = new HugeFloat("-9023409872309847509847.9385345098345")) { a.Value = a.Abs(); FloatAssert.AreEqual("9023409872309847509847.9385345098345", a); a.Value = a.Abs(); FloatAssert.AreEqual("9023409872309847509847.9385345098345", a); } }
public void FloatNegate() { using (var a = new HugeFloat("9023409872309847509847.9385345098345")) { a.Value = -a; FloatAssert.AreEqual("-9023409872309847509847.9385345098345", a); a.Value = -a; FloatAssert.AreEqual("9023409872309847509847.9385345098345", a); } }
public void FloatSqrtLimb() { using (var a = new HugeFloat()) { var source = Platform.Ui(2540928740928357403U, 254092874U); var expected = Platform.Select("1594029090.3645257511790832426801336140951314995369452070983", "15940.290900733273631771121246631364490515292845317661757570"); a.Value = HugeFloat.SquareRoot(source); FloatAssert.AreEqual(expected, a); } }
public void FloatCompoundOperators() { using (var a = new HugeFloat("938475092834705928347523452345.115756986668303657898962467957")) { a.Value += 1; a.Value *= 10; a.Precision = 224; FloatAssert.AreEqual("9384750928347059283475234523461.15756986668303657898962467957", a); } }
public void FloatSubtractHugeFloat() { using (var a = new HugeFloat("22250983250345029834502983.5740293845720")) using (var b = new HugeFloat("2229874359879827.30594288574029879874539")) using (var c = new HugeFloat(a - b)) { FloatAssert.AreEqual("22250983248115155474623156.26808649883170120125461", c); c.Value = b - (a + 1); FloatAssert.AreEqual("-22250983248115155474623157.26808649883170120125461", c); } }
public void FloatAssignCopy() { var s = "-1.22250983250345029834502983574029384572"; using (var a = new HugeFloat(s)) using (var b = new HugeFloat()) { b.Value = a; FloatAssert.AreEqual(s, b); } }
public void FloatTruncate() { using (var a = new HugeFloat("-9023409872309847509847.9385345098345")) using (var b = new HugeFloat()) { b.Value = a.Truncate(); FloatAssert.AreEqual("-9023409872309847509847", b); b.Value = (-a).Truncate(); FloatAssert.AreEqual("9023409872309847509847", b); } }
public void FloatMultiplyByHugeFloat() { using (var a = new HugeFloat("90234098723098475098479385.345098345")) using (var b = new HugeFloat("78594873598734.59872354987610987897")) using (var c = new HugeFloat(a * b)) { FloatAssert.AreEqual("7091937583437663707014199538801620613535.95657143399816050772069730465", c); c.Value = b * (a + 1); FloatAssert.AreEqual("7091937583437663707014199617396494212270.55529498387427038669069730465", c); } }
public void FloatAddHugeFloat() { using (var a = new HugeFloat("22250983250345029834502983.5740293845720")) using (var b = new HugeFloat("2229874359879827.30594288574029879874539")) using (var c = new HugeFloat(a + b)) { FloatAssert.AreEqual("22250983252574904194382810.87997227031229879874539", c); c.Value = a + (b + 1); FloatAssert.AreEqual("22250983252574904194382811.87997227031229879874539", c); } }
public void FloatToAndFromInt() { using (var a = new HugeFloat()) { long b = -0x784739AB; a.SetTo(b); FloatAssert.AreEqual(b + ".", a); long c = a.ToInt(); Assert.AreEqual(b, c); } }
public void FloatAddSignedLimb() { using (var a = new HugeFloat("22250983250345029834502983.5740293845720")) using (var c = new HugeFloat()) { var b = Platform.Si(-4288574029879874539, -1288574029); var expected = Platform.Select("22250978961770999954628444.5740293845720", "22250983250345028545928954.5740293845720"); c.Value = a + b; FloatAssert.AreEqual(expected, c); c.Value = b + a; FloatAssert.AreEqual(expected, c); } }
public void FloatSubtractLimb() { using (var a = new HugeFloat("22250983250345029834502983.5740293845720")) using (var c = new HugeFloat()) { var b = Platform.Ui(4288574029879874539UL, 2885740298U); var expected = Platform.Select("22250978961770999954628444.5740293845720", "22250983250345026948762685.5740293845720"); c.Value = a - b; FloatAssert.AreEqual(expected, c); c.Value = b - a; FloatAssert.AreEqual("-" + expected, c); } }
public void FloatSubtractSignedLimb() { using (var a = new HugeFloat("22250983250345029834502983.5740293845720")) using (var c = new HugeFloat()) { var b = Platform.Si(-4288574029879874539, -1885740298); var expected = Platform.Select("22250987538919059714377522.5740293845720", "22250983250345031720243281.5740293845720"); c.Value = a - b; FloatAssert.AreEqual(expected, c); c.Value = b - a; FloatAssert.AreEqual("-" + expected, c); } }
public void FloatMultiplyByLimb() { using (var a = new HugeFloat("9023409872309847509847.9385345098345")) using (var c = new HugeFloat()) { var b = Platform.Ui(17390538260286101342, 1500450271); var expected = Platform.Select("156921954622647727368660197878904460649174.746962647899", "13539177788251386092120014542896.6240276901495"); c.Value = a * b; FloatAssert.AreEqual(expected, c); c.Value = b * -a; FloatAssert.AreEqual("-" + expected, c); } }
public void FloatMultiplyBySignedLimb() { using (var a = new HugeFloat("9023409872309847509847.9385345098345")) using (var c = new HugeFloat()) { var b = Platform.Si(-7390538260286101342, -1500450271); var expected = Platform.Select("66687855899549252270180812533806115649174.746962647899", "13539177788251386092120014542896.6240276901495"); c.Value = a * b; FloatAssert.AreEqual("-" + expected, c); c.Value = b * -a; FloatAssert.AreEqual(expected, c); } }