number

object number

Provides nice extensions to the interface of basic numerical types, for convenience.

class Object
trait Matchable
class Any
number.type

Extensions

Extensions

extension (value: Double)
infix inline def atLeast(minimum: Double): Double

num atLeast limit is equivalent to num.max(limit).

num atLeast limit is equivalent to num.max(limit).

infix inline def atMost(maximum: Double): Double

num atMost limit is equivalent to num.min(limit).

num atMost limit is equivalent to num.min(limit).

inline def clamp(low: Double, high: Double): Double

num.clamp(low, high) is equivalent to num.max(low).min(high).

num.clamp(low, high) is equivalent to num.max(low).min(high).

inline def isBetween(low: Double, high: Double): Boolean

Determines if the at least as large as low and less than high. Note that the lower bound is inclusive and the upper bound exclusive.

Determines if the at least as large as low and less than high. Note that the lower bound is inclusive and the upper bound exclusive.

extension (value: Int)
infix inline def atLeast(minimum: Int): Int

num atLeast limit is equivalent to num.max(limit).

num atLeast limit is equivalent to num.max(limit).

infix inline def atMost(maximum: Int): Int

num atMost limit is equivalent to num.min(limit).

num atMost limit is equivalent to num.min(limit).

inline def clamp(low: Int, high: Int): Int

num.clamp(low, high) is equivalent to num.max(low).min(high).

num.clamp(low, high) is equivalent to num.max(low).min(high).

inline def isBetween(low: Int, high: Int): Boolean

Determines if the at least as large as low and less than high. Note that the lower bound is inclusive and the upper bound exclusive.

Determines if the at least as large as low and less than high. Note that the lower bound is inclusive and the upper bound exclusive.

inline def isEven: Boolean

Determines if the integer is divisible by two.

Determines if the integer is divisible by two.

inline def isOdd: Boolean

Determines if the integer isn’t divisible by two.

Determines if the integer isn’t divisible by two.

extension (value: Long)
infix inline def atLeast(minimum: Long): Long

num atLeast limit is equivalent to num.max(limit).

num atLeast limit is equivalent to num.max(limit).

infix inline def atMost(maximum: Long): Long

num atMost limit is equivalent to num.min(limit).

num atMost limit is equivalent to num.min(limit).

inline def clamp(low: Long, high: Long): Long

num.clamp(low, high) is equivalent to num.max(low).min(high).

num.clamp(low, high) is equivalent to num.max(low).min(high).

inline def isBetween(low: Long, high: Long): Boolean

Determines if the at least as large as low and less than high. Note that the lower bound is inclusive and the upper bound exclusive.

Determines if the at least as large as low and less than high. Note that the lower bound is inclusive and the upper bound exclusive.

inline def isEven: Boolean

Determines if the integer is divisible by two.

Determines if the integer is divisible by two.

inline def isOdd: Boolean

Determines if the integer isn’t divisible by two.

Determines if the integer isn’t divisible by two.

extension (value: Float)
infix inline def atLeast(minimum: Float): Float

num atLeast limit is equivalent to num.max(limit).

num atLeast limit is equivalent to num.max(limit).

infix inline def atMost(maximum: Float): Float

num atMost limit is equivalent to num.min(limit).

num atMost limit is equivalent to num.min(limit).

inline def clamp(low: Float, high: Float): Float

num.clamp(low, high) is equivalent to num.max(low).min(high).

num.clamp(low, high) is equivalent to num.max(low).min(high).

inline def isBetween(low: Float, high: Float): Boolean

Determines if the at least as large as low and less than high. Note that the lower bound is inclusive and the upper bound exclusive.

Determines if the at least as large as low and less than high. Note that the lower bound is inclusive and the upper bound exclusive.