Skip to content
This repository has been archived by the owner on Mar 29, 2018. It is now read-only.
pNre edited this page Jun 21, 2014 · 4 revisions

Contents

#Instance methods

abs

  • abs () -> Float

Equivalent to fabsf(self).


sqrt

  • sqrt () -> Float

Equivalent to sqrtf(self).


floor

  • floor () -> Float

Equivalent to floorf(self).


ceil

  • ceil () -> Float

Equivalent to ceilf(self).


round

  • round () -> Float

Equivalent to roundf(self).


digits

  • digits () -> (integerPart: Int[], fractionalPart: Int[])

Returns couple of Int[]: integer and fractional part of self.

Example

let f = 3.120
f.digits()
// → ([3], [1, 1, 9, ...])

#Class methods

random

  • random(min: Float = 0, max: Float) -> Float

Returns a random Float between min and max (inclusive).

Example

Float.random(min: 5, max: 10)
// → 5.302852
Clone this wiki locally