SafeLong

sealed abstract class SafeLong extends ScalaNumber with ScalaNumericConversions with Ordered[SafeLong]

Provides a type to do safe long arithmetic. This type will never overflow, but rather convert the underlying long to a BigInteger as need and back down to a Long when possible.

Companion:
object

Value members

Abstract methods

def %(rhs: Long): SafeLong
def &(rhs: Long): SafeLong
def *(rhs: Long): SafeLong
def +(rhs: Long): SafeLong
def -(rhs: Long): SafeLong
def /(rhs: Long): SafeLong
def /%(rhs: Long): (SafeLong, SafeLong)
def <<(n: Int): SafeLong
def >>(n: Int): SafeLong
def ^(rhs: Long): SafeLong
def emod(rhs: Long): SafeLong
def equot(rhs: Long): SafeLong
def gcd(that: SafeLong): SafeLong
def signum: Int
def |(rhs: Long): SafeLong

Concrete methods

final def %(rhs: SafeLong): SafeLong
final def %(rhs: BigInt): SafeLong
final def &(rhs: SafeLong): SafeLong
final def &(rhs: BigInt): SafeLong
final def *(rhs: SafeLong): SafeLong
final def *(rhs: BigInt): SafeLong
final def **(k: Int): SafeLong

Exponentiation function, e.g. x ** y

Exponentiation function, e.g. x ** y

If base ** exponent doesn't fit in a Long, the result will overflow (unlike scala.math.pow which will return +/- Infinity).

final def +(rhs: SafeLong): SafeLong
final def +(rhs: BigInt): SafeLong
final def -(rhs: SafeLong): SafeLong
final def -(rhs: BigInt): SafeLong
final def /(rhs: SafeLong): SafeLong
final def /(rhs: BigInt): SafeLong
final def /%(rhs: SafeLong): (SafeLong, SafeLong)
final def /%(rhs: BigInt): (SafeLong, SafeLong)
final def /~(rhs: SafeLong): SafeLong
def =!=(that: SafeLong): Boolean
def ===(that: SafeLong): Boolean
final def ^(rhs: SafeLong): SafeLong
final def ^(rhs: BigInt): SafeLong
final def emod(rhs: SafeLong): SafeLong
final def emod(rhs: BigInt): SafeLong
final def equot(rhs: SafeLong): SafeLong
final def equot(rhs: BigInt): SafeLong
final def equotmod(rhs: SafeLong): (SafeLong, SafeLong)
final def equotmod(rhs: BigInt): (SafeLong, SafeLong)
final def isProbablePrime(certainty: Int): Boolean

Returns true if this SafeLong is probably prime, false if it's definitely composite. If certainty is ≤ 0, true is returned.

Returns true if this SafeLong is probably prime, false if it's definitely composite. If certainty is ≤ 0, true is returned.

Value parameters:
certainty

a measure of the uncertainty that the caller is willing to tolerate: if the call returns true the probability that this BigInteger is prime exceeds (1 - 1/2^certainty).

final def isWhole: Boolean
def lcm(that: SafeLong): SafeLong
final def max(that: SafeLong): SafeLong
final def min(that: SafeLong): SafeLong
final def modPow(k: Int, mod: SafeLong): SafeLong
final def pow(k: Int): SafeLong
final def toBigInt: BigInt
override def toByte: Byte
Definition Classes
override def toInt: Int
Definition Classes
override def toShort: Short
Definition Classes
override def toString: String
Definition Classes
Any
final def |(rhs: SafeLong): SafeLong
final def |(rhs: BigInt): SafeLong

Inherited methods

def <(that: SafeLong): Boolean
Inherited from:
Ordered
def <=(that: SafeLong): Boolean
Inherited from:
Ordered
def >(that: SafeLong): Boolean
Inherited from:
Ordered
def >=(that: SafeLong): Boolean
Inherited from:
Ordered
Inherited from:
Number
def compare(that: SafeLong): Int
Inherited from:
Ordered
def compareTo(that: SafeLong): Int
Inherited from:
Ordered
Inherited from:
Number
protected def unifiedPrimitiveEquals(x: Any): Boolean