The OpenD Programming Language

Fp.opCast

  1. T opCast()
  2. T opCast()
  3. T opCast()
    struct Fp(uint size)
    nothrow const
    T
    opCast
    (
    T : Fp!newSize
    bool noSpecial = false
    size_t newSize
    )
    ()
    if (
    newSize != size
    )
    if (
    size % (uint.sizeof * 8) == 0 &&
    size >= (uint.sizeof * 8)
    )

Examples

import mir.bignum.fixed: UInt;
auto fp = cast(Fp!64) Fp!128(UInt!128.fromHexString("afbbfae3cd0aff2784a1de7022b0029d"));
assert(fp.exponent == 64);
assert(fp.coefficient == UInt!64.fromHexString("afbbfae3cd0aff28"));

assert(Fp!128(-double.infinity) * Fp!128(1) == Fp!128(-double.infinity));

Meta