Fixed.this

Create a new Fixed struct given a string. If round is true, then the number is rounded to the nearest signficiant digit.

  1. this(V i)
  2. this(T i)
  3. this(Range s, bool round)
    struct Fixed(int scaling, V = long, Hook = KeepScalingHook)
    this
    (
    Range
    )
    (
    Range s
    ,
    bool round = false
    )
    if (
    isNarrowString!Range
    )
    if (
    isIntegral!V
    )

Examples

auto p1 = Fixed!4("1.1");
assert(p1.value == 11_000);

auto p2 = Fixed!4("1.");
assert(p2.value == 10_000);

auto p3 = Fixed!4("0");
assert(p3.value == 0);

auto p4 = Fixed!4("");
assert(p4.value == 0);

auto p5 = Fixed!3("1.2345", true);
assert(p5.value == 1235);

Meta