Decimal.this

Undocumented in source.
  1. this(bool value)
  2. this(string str)
  3. this(U r)
  4. this(U coefficient)
  5. this(U coefficient)
  6. this(D that)
  7. this(U coefficient, int exponent)
  8. this(U coefficient, int exponent, bool sign)
    struct Decimal(immutable Context _context = DefaultContext)
    this
    (
    U
    )
    if (
    is(U == BigInt) ||
    isIntegral!U
    )

Examples

Constructs a number from a boolean sign, an integer coefficient and an optional integer exponent. The sign of the number is the value of the sign parameter regardless of the sign of the coefficient. The intial precision of the number is deduced from the number of decimal digits in the coefficient.

// this(u,i,b)
  static struct S { BigInt cf; int exp; bool sign; TD expect; }
  S[] s =
  [
    { 7254, 94, true, "-7.254E+97" },
    // NOTE: new constructions aren't rounded and may be too large for type
    { 1,   194, true, "-1E+194" },
  ];
  auto f = FunctionTest!(S,TD)("this(uib)");
  foreach (t; s) f.test(t, TD(t.cf, t.exp, t.sign));
    writefln(f.report);

Meta