View source code
							
							
						
								Display the source code in std/bigint.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								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.
							
						Function std.bigint.BigInt.opBinaryRight
Implements operators with built-in integers on the left-hand side and
        BigInt on the right-hand side.
						
				BigInt opBinaryRight(string op, T)
				(
				
				  T y
				
				) const pure nothrow @safe
				
				if ((op == "+" || op == "*" || op == "|" || op == "&" || op == "^") && isIntegral!T);
				
				
				BigInt opBinaryRight(string op, T)
				(
				
				  T y
				
				) const pure nothrow @safe
				
				if (op == "-" && isIntegral!T);
				
				
				T opBinaryRight(string op, T)
				(
				
				  T x
				
				) const pure nothrow @safe
				
				if ((op == "%" || op == "/") && isIntegral!T);
						
					
				Example
auto x = BigInt("100");
BigInt y = 123 + x;
writeln(y); // BigInt("223")
BigInt z = 123 - x;
writeln(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));
writeln(1000 / x); // 10
Authors
Don Clugston
License
					Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.