1 import checkedint.sticky : safeOp; // use IntFlagPolicy.sticky 2 3 assert(safeOp.pow(-10, 3) == -1_000); 4 static assert(!__traits(compiles, safeOp.pow(16, 4uL))); 5 safeOp.pow(2, -1); 6 assert(IntFlags.local.clear() == IntFlag.undef); 7 8 safeOp.pow(-3, 27); 9 assert(IntFlags.local.clear() == IntFlag.negOver); 10 safeOp.pow(0, -5); 11 assert(IntFlags.local.clear() == IntFlag.undef);
Raise base to the exp power.
Errors that may be signalled if neither input is floating-point: