spire.math.extras

FixedPoint

final class FixedPoint 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

Self Type
FixedPoint
Linear Supertypes
AnyVal, NotNull, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. FixedPoint
  2. AnyVal
  3. NotNull
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new FixedPoint(long: Long)

Value Members

  1. def !=(rhs: FixedPoint): Boolean

  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    Any
  4. def %(rhs: Long)(implicit scale: FixedScale): FixedPoint

  5. def %(rhs: FixedPoint): FixedPoint

  6. def *(rhs: Long): FixedPoint

  7. def *(rhs: FixedPoint)(implicit scale: FixedScale): FixedPoint

  8. def **(k: Int)(implicit scale: FixedScale): FixedPoint

  9. def +(rhs: Long)(implicit scale: FixedScale): FixedPoint

  10. def +(rhs: FixedPoint): FixedPoint

  11. def -(rhs: Long)(implicit scale: FixedScale): FixedPoint

  12. def -(rhs: FixedPoint): FixedPoint

  13. def /(rhs: Long): FixedPoint

  14. def /(rhs: FixedPoint)(implicit scale: FixedScale): FixedPoint

  15. def /%(rhs: FixedPoint)(implicit scale: FixedScale): (FixedPoint, FixedPoint)

  16. def /~(rhs: FixedPoint)(implicit scale: FixedScale): FixedPoint

  17. def <(rhs: FixedPoint): Boolean

  18. def <=(rhs: FixedPoint): Boolean

  19. def =!=(rhs: FixedPoint): Boolean

  20. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  21. def ===(rhs: FixedPoint): Boolean

  22. def >(rhs: FixedPoint): Boolean

  23. def >=(rhs: FixedPoint): Boolean

  24. def abs: FixedPoint

  25. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  26. def ceil(implicit scale: FixedScale): FixedPoint

  27. def compare(rhs: FixedPoint): Int

  28. def floor(implicit scale: FixedScale): FixedPoint

  29. def fpow(k: FixedPoint)(implicit scale: FixedScale): FixedPoint

  30. def gcd(rhs: FixedPoint): FixedPoint

  31. def getClass(): Class[_ <: AnyVal]

    Definition Classes
    AnyVal → Any
  32. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  33. def isWhole(implicit scale: FixedScale): Boolean

  34. val long: Long

  35. def nroot(k: Int)(implicit scale: FixedScale): FixedPoint

  36. def pow(k: Int)(implicit scale: FixedScale): FixedPoint

  37. def round(implicit scale: FixedScale): FixedPoint

  38. def signum: Int

  39. def sqrt(implicit scale: FixedScale): FixedPoint

  40. def toBigDecimal(implicit scale: FixedScale): BigDecimal

  41. def toDouble(implicit scale: FixedScale): Double

  42. def toLong(implicit scale: FixedScale): Long

  43. def toRational(implicit scale: FixedScale): Rational

  44. def toReal(implicit scale: FixedScale): Real

  45. def toString(implicit scale: FixedScale): String

  46. def toString(): String

    Definition Classes
    FixedPoint → Any
  47. def unary_-(): FixedPoint

Inherited from AnyVal

Inherited from NotNull

Inherited from Any

Ungrouped