public void SqrtULong() { string AsString; Assert.IsTrue(mpfr_t.LiveObjectCount() == 0); ulong DefaultPrecision = mpfr_t.DefaultPrecision; mpfr_t.DefaultPrecision = 2048; ulong a = 5040625102UL; using mpfr_t b = new(); mpfr.sqrt_ui(b, a, mpfr_rnd_t.MPFR_RNDN); AsString = b.ToString(); AsString = AsString.Substring(0, 20) + "..." + AsString.Substring(AsString.Length - 3); Assert.AreEqual("7.099735982415120765...E+4", AsString); using mpfr_t c = new mpfr_t(a); AsString = c.ToString(); Assert.AreEqual("5.040625102E+9", AsString); using mpfr_t d = c.Sqrt(); AsString = d.ToString(); AsString = AsString.Substring(0, 20) + "..." + AsString.Substring(AsString.Length - 3); Assert.AreEqual("7.099735982415120765...E+4", AsString); mpfr_t.DefaultPrecision = DefaultPrecision; }
public void PowLong() { string AsString; Assert.IsTrue(mpfr_t.LiveObjectCount() == 0); ulong DefaultPrecision = mpfr_t.DefaultPrecision; mpfr_t.DefaultPrecision = 2048; using mpfr_t a = new mpfr_t("22250983250.3450298345029835740293845720"); AsString = a.ToString(); AsString = AsString.Substring(0, 20) + "..." + AsString.Substring(AsString.Length - 4); Assert.AreEqual("2.225098325034502983...E+10", AsString); using mpfr_t a2 = 1 / a; using mpfr_t a3 = 1 + a2; long b = 5040625102L; using mpfr_t c = a3.Pow(b >> 1); AsString = c.ToString(); AsString = AsString.Substring(0, 30) + "..." + AsString.Substring(AsString.Length - 3); Assert.AreEqual("1.1199314396039264372253958740...E+0", AsString); using mpfr_t d = a3.Pow(b); AsString = d.ToString(); AsString = AsString.Substring(0, 30) + "..." + AsString.Substring(AsString.Length - 3); Assert.AreEqual("1.2542464294133231291486886786...E+0", AsString); using mpfr_t e = c * c; AsString = e.ToString(); AsString = AsString.Substring(0, 30) + "..." + AsString.Substring(AsString.Length - 3); Assert.AreEqual("1.2542464294133231291486886786...E+0", AsString); using mpfr_t f = a3.Pow(-b); AsString = f.ToString(); AsString = AsString.Substring(0, 30) + "..." + AsString.Substring(AsString.Length - 3); Assert.AreEqual("7.9729148638497816923324220753...E-1", AsString); using mpfr_t g = a3.Pow(-(b >> 1)); AsString = g.ToString(); AsString = AsString.Substring(0, 30) + "..." + AsString.Substring(AsString.Length - 3); Assert.AreEqual("8.9291180213108291585559055960...E-1", AsString); using mpfr_t h = g * g; AsString = h.ToString(); AsString = AsString.Substring(0, 30) + "..." + AsString.Substring(AsString.Length - 3); Assert.AreEqual("7.9729148638497816923324220753...E-1", AsString); mpfr_t.DefaultPrecision = DefaultPrecision; }
public void NthRoot() { string AsString; Assert.IsTrue(mpfr_t.LiveObjectCount() == 0); ulong DefaultPrecision = mpfr_t.DefaultPrecision; mpfr_t.DefaultPrecision = 2048; using mpfr_t a = new mpfr_t("22250983250345029834502983.5740293845720"); AsString = a.ToString(); AsString = AsString.Substring(0, 20) + "..." + AsString.Substring(AsString.Length - 4); Assert.AreEqual("2.225098325034502983...E+25", AsString); ulong root = 5040625102UL; root >>= 1; using mpfr_t b = a.NthRoot(root); AsString = b.ToString(); AsString = AsString.Substring(0, 20) + "..." + AsString.Substring(AsString.Length - 3); Assert.AreEqual("1.000000023157615543...E+0", AsString); using mpfr_t c = b.Sqrt(); AsString = c.ToString(); AsString = AsString.Substring(0, 20) + "..." + AsString.Substring(AsString.Length - 3); Assert.AreEqual("1.000000011578807704...E+0", AsString); using mpfr_t d = a.NthRoot(root << 1); AsString = d.ToString(); AsString = AsString.Substring(0, 20) + "..." + AsString.Substring(AsString.Length - 3); Assert.AreEqual("1.000000011578807704...E+0", AsString); using mpfr_t e = b.Pow(root); AsString = e.ToString(); AsString = AsString.Substring(0, 20) + "..." + AsString.Substring(AsString.Length - 4); Assert.AreEqual("2.225098325034502983...E+25", AsString); using mpfr_t f = c.Pow(root << 1); AsString = f.ToString(); AsString = AsString.Substring(0, 20) + "..." + AsString.Substring(AsString.Length - 4); Assert.AreEqual("2.225098325034502983...E+25", AsString); using mpfr_t g = d.Pow(root << 1); AsString = g.ToString(); AsString = AsString.Substring(0, 20) + "..." + AsString.Substring(AsString.Length - 4); Assert.AreEqual("2.225098325034502983...E+25", AsString); mpfr_t.DefaultPrecision = DefaultPrecision; }
private bool ParseTargetTypeTagReq(PgAbility item, object value, string parsedFile, string parsedKey) { if (value is not string AsString || !AsString.StartsWith("AnatomyType_")) { return(false); } string AnatomySkillName = AsString.Substring(12); AnatomySkillName = $"Anatomy_{AnatomySkillName}"; if (!Inserter <PgSkill> .SetItemByKey((PgSkill valueSkill) => item.TargetTypeTagReq_Key = valueSkill.Key, AnatomySkillName)) { return(false); } return(true); }
public void PowULong() { string AsString; Assert.IsTrue(mpfr_t.LiveObjectCount() == 0); ulong DefaultPrecision = mpfr_t.DefaultPrecision; mpfr_t.DefaultPrecision = 2048; using mpfr_t a = new mpfr_t("22250983250.3450298345029835740293845720"); AsString = a.ToString(); AsString = AsString.Substring(0, 20) + "..." + AsString.Substring(AsString.Length - 4); Assert.AreEqual("2.225098325034502983...E+10", AsString); using mpfr_t a2 = 1 / a; using mpfr_t a3 = 1 + a2; ulong b = 5040625102L; using mpfr_t c = a3.Pow(b >> 1); AsString = c.ToString(); AsString = AsString.Substring(0, 30) + "..." + AsString.Substring(AsString.Length - 3); Assert.AreEqual("1.1199314396039264372253958740...E+0", AsString); using mpfr_t d = a3.Pow(b); AsString = d.ToString(); AsString = AsString.Substring(0, 30) + "..." + AsString.Substring(AsString.Length - 3); Assert.AreEqual("1.2542464294133231291486886786...E+0", AsString); using mpfr_t e = c * c; AsString = e.ToString(); AsString = AsString.Substring(0, 30) + "..." + AsString.Substring(AsString.Length - 3); Assert.AreEqual("1.2542464294133231291486886786...E+0", AsString); mpfr_t.DefaultPrecision = DefaultPrecision; }