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
trait Ordered[SafeLong]
trait Comparable[SafeLong]
trait ScalaNumericConversions
trait ScalaNumericAnyConversions
class ScalaNumber
class Number
trait Serializable
class Object
trait Matchable
class Any

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 bitLength: Int
def emod(rhs: Long): SafeLong
def equot(rhs: Long): SafeLong
def equotmod(rhs: Long): (SafeLong, SafeLong)
def gcd(that: SafeLong): SafeLong
def getLong: Opt[Long]
def isEven: Boolean
def isOdd: Boolean
def isOne: Boolean
def isValidLong: Boolean
def isZero: Boolean
def signum: Int
def toBigDecimal: BigDecimal
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
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
final
def emod(rhs: BigInt): SafeLong
final
final
def equot(rhs: BigInt): SafeLong
final
final
def equotmod(rhs: BigInt): (SafeLong, SafeLong)
def isPrime: Boolean
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 Params
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
ScalaNumericAnyConversions
override
def toInt: Int
Definition Classes
ScalaNumericAnyConversions
override
def toShort: Short
Definition Classes
ScalaNumericAnyConversions
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
def byteValue(): Byte
Inherited from
Number
def compare(that: SafeLong): Int
Inherited from
Ordered
def compareTo(that: SafeLong): Int
Inherited from
Ordered
def doubleValue: Double
Inherited from
ScalaNumericAnyConversions
def floatValue: Float
Inherited from
ScalaNumericAnyConversions
def intValue: Int
Inherited from
ScalaNumericAnyConversions
def isValidByte: Boolean
Inherited from
ScalaNumericAnyConversions
def isValidChar: Boolean
Inherited from
ScalaNumericAnyConversions
def isValidInt: Boolean
Inherited from
ScalaNumericAnyConversions
def isValidShort: Boolean
Inherited from
ScalaNumericAnyConversions
def longValue: Long
Inherited from
ScalaNumericAnyConversions
def shortValue(): Short
Inherited from
Number
def toChar: Char
Inherited from
ScalaNumericAnyConversions
def toDouble: Double
Inherited from
ScalaNumericAnyConversions
def toFloat: Float
Inherited from
ScalaNumericAnyConversions
def toLong: Long
Inherited from
ScalaNumericAnyConversions
def underlying(): Object
Inherited from
ScalaNumericConversions
protected
def unifiedPrimitiveEquals(x: Any): Boolean
Inherited from
ScalaNumericAnyConversions
protected
Inherited from
ScalaNumericAnyConversions