public BigNumber(double val) { if (val == Math.Floor(val)) { integerVal = new BigInt((int)val); Type = NumberType2.integer; } else { rationalVal = new BigRational(val); Type = NumberType2.rational; } }
public BigNumber(float val, NumberType2 type) { Type = type; switch (type) { case NumberType2.integer: integerVal = new BigInt((int)val); break; case NumberType2.rational: rationalVal = new BigRational(val); break; case NumberType2.irrational: irrationalVal = new BigIrrational(val); break; } }
public BigNumber(Decimal val, NumberType2 type) { Type = type; switch (type) { case NumberType2.integer: integerVal = new BigInt((int)val); break; case NumberType2.rational: rationalVal = new BigRational(val); break; case NumberType2.irrational: irrationalVal = new BigIrrational((double)val); break; } }
public BigNumber(BigRational val) { Type = NumberType2.rational; rationalVal = val; }
public BigNumber(BigInteger val) { integerVal = new BigInt(val); Type = NumberType2.integer; }