View source code
Display the source code in std/bigint.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function std.bigint.BigInt.opBinaryRight
Implements operators with built-in integers on the left-hand side and
BigInt
on the right-hand side.
Prototypes
BigInt opBinaryRight(string op, T)( T y ) const pure nothrow if ((op == "+" || op == "*" || op == "|" || op == "&" || op == "^") && isIntegral!T); BigInt opBinaryRight(string op, T)( T y ) const pure nothrow if (op == "-" && isIntegral!T); T opBinaryRight(string op, T)( T x ) const pure nothrow if ((op == "%" || op == "/") && isIntegral!T);
Example
auto x = BigInt("100"); BigInt y = 123 + x; assert(y == BigInt("223")); BigInt z = 123 - x; assert(z == BigInt("23")); // Dividing a built-in integer type by BigInt always results in // something that fits in a built-in type, so the built-in type is // returned, not BigInt. assert(is(typeof(1000 / x) == int)); assert(1000 / x == 10);
Authors
Don Clugston