Float:
Filter:
Classes | Math

Float : SimpleNumber : Number : Magnitude : Object

Floating point number
Source: Float.sc

Description

A 64-bit double precision floating point number. Float inherits most of its behaviour from its superclass.

Note that despite its name, FloatArray only holds 32-bit (single precision) floats. For a raw array of 64-bit floats, use DoubleArray.

Class Methods

Float.from32Bits(word)

Returns:

a new Float from a 32 bit word.

Float.from64Bits(hiWord, loWord)

Returns:

a new Float from a 64 bit word.

Inherited class methods

Instance Methods

.do(function)

iterates a Function from 0 to this-1. See also: Integer: -do, Collection: -do

Arguments:

function

The function to iterate.

.reverseDo(function)

iterates function from this-1 to 0

Arguments:

function

The function to iterate.

.coin

Let x be the receiver clipped to the range [0, 1]. With probability x, return true. With probability 1 - x, return false.

Returns:

Discussion:

0.2.coin; // 20 % chance for true.

See also: Randomness

.isFloat

Returns:

true since this is a Float.

.asFloat

Returns:

this since this is a Float.

.as32Bits

Returns:

an Integer which is the bit pattern of this as a 32bit single precision float

.high32Bits

Returns:

an Integer which is the bit pattern of high 32 bits of the 64 bit double precision floating point value

.low32Bits

Returns:

an Integer which is the bit pattern of high 32 bits of the 64 bit double precision floating point value

.asStringPrec(precision)

Returns a string representation of the number, with the desired precision (i.e. number of significant figures).

Discussion:

// example:
pi
pi.asStringPrec(3)
pi.asStringPrec(6)
(pi * 0.0001).asStringPrec(3)
7.4.asStringPrec(5)
7.4.asStringPrec(50)

Inherited instance methods

Undocumented instance methods

*(aNumber, adverb)

+(aNumber, adverb)

-(aNumber, adverb)

.archiveAsCompileString

.asCompileString

.clip(lo, hi)

.fold(lo, hi)

.schedBundle(bundle, server, timeOfRequest)

From extension in /usr/local/share/SuperCollider/SCClassLibrary/Common/Control/schedBundle.sc

.switch( ... cases)

.wrap(lo, hi)

.xrand2