O1Library Docs
Fall 2023
Docs API

# number

o1.util.nice$.number$
object number

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

## Attributes

Graph
Supertypes
  class Object
  trait Matchable
  class Any
Self type
  number.type

## Members list

### Extensions

extension (value: Int)(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)`.

## Attributes

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)`.

## Attributes

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)`.

## Attributes

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.

## Attributes

inline def isEven: Boolean

Determines if the integer is divisible by two.

Determines if the integer is divisible by two.

## Attributes

inline def isOdd: Boolean

Determines if the integer isn’t divisible by two.

Determines if the integer isn’t divisible by two.

## Attributes

extension (value: Double)(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)`.

## Attributes

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)`.

## Attributes

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)`.

## Attributes

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.

## Attributes

extension (value: Float)(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)`.

## Attributes

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)`.

## Attributes

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)`.

## Attributes

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.

## Attributes

extension (value: Long)(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)`.

## Attributes

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)`.

## Attributes

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)`.

## Attributes

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.

## Attributes

inline def isEven: Boolean

Determines if the integer is divisible by two.

Determines if the integer is divisible by two.

## Attributes

inline def isOdd: Boolean

Determines if the integer isn’t divisible by two.

Determines if the integer isn’t divisible by two.

## Attributes