FixedPoint

final
class FixedPoint(val long: Long) extends AnyVal

FixedPoint is a value class that provides fixed point arithmetic operations (using an implicit denominator) to unboxed Long values.

Working with FixedPoint values is similar to other fractional types, except that most operations require an implicit FixedScale instance (which provides the denominator).

For example:

// interpret FixedPoint(n) as n/1000
implicit val scale = FixedScale(1000)
// these three values are equivalent
val a = FixedPoint("12.345") // decimal repr
val b = FixedPoint(Rational(2469, 200)) // fraction repr
val c = new FixedPoint(12345L) // "raw" repr
Companion
object
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def !=(rhs: FixedPoint): Boolean
def *(rhs: FixedPoint)(implicit scale: FixedScale): FixedPoint
def *(rhs: Long): FixedPoint
def **(k: Int)(implicit scale: FixedScale): FixedPoint
def +(rhs: Long)(implicit scale: FixedScale): FixedPoint
def -(rhs: Long)(implicit scale: FixedScale): FixedPoint
def /(rhs: FixedPoint)(implicit scale: FixedScale): FixedPoint
def /(rhs: Long): FixedPoint
def <(rhs: FixedPoint): Boolean
def <=(rhs: FixedPoint): Boolean
def =!=(rhs: FixedPoint): Boolean
def ===(rhs: FixedPoint): Boolean
def >(rhs: FixedPoint): Boolean
def >=(rhs: FixedPoint): Boolean
def ceil(implicit scale: FixedScale): FixedPoint
def compare(rhs: FixedPoint): Int
def floor(implicit scale: FixedScale): FixedPoint
def fpow(k: FixedPoint)(implicit scale: FixedScale): FixedPoint
def isWhole(implicit scale: FixedScale): Boolean
def nroot(k: Int)(implicit scale: FixedScale): FixedPoint
def pow(k: Int)(implicit scale: FixedScale): FixedPoint
def round(implicit scale: FixedScale): FixedPoint
def signum: Int
def sqrt(implicit scale: FixedScale): FixedPoint
def tmod(rhs: Long)(implicit scale: FixedScale): FixedPoint
def toBigDecimal(implicit scale: FixedScale): BigDecimal
def toDouble(implicit scale: FixedScale): Double
def toLong(implicit scale: FixedScale): Long
def toRational(implicit scale: FixedScale): Rational
def toReal(implicit scale: FixedScale): Real
override
def toString: String
Definition Classes
Any
def toString(implicit scale: FixedScale): String
def tquot(rhs: FixedPoint)(implicit scale: FixedScale): FixedPoint
def tquotmod(rhs: FixedPoint)(implicit scale: FixedScale): (FixedPoint, FixedPoint)

Concrete fields

val long: Long