File: Float.schelp

package info (click to toggle)
supercollider 1%3A3.6.6~repack-2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 23,792 kB
  • ctags: 25,269
  • sloc: cpp: 177,129; lisp: 63,421; ansic: 11,297; python: 1,787; perl: 766; yacc: 311; sh: 286; lex: 181; ruby: 173; makefile: 168; xml: 13
file content (65 lines) | stat: -rw-r--r-- 1,687 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Class:: Float
summary:: Floating point number
categories:: Math

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

ClassMethods::

method:: from32Bits
returns:: a new Float from a 32 bit word.

method:: from64Bits
returns:: a new Float from a 64 bit word.

InstanceMethods::

method:: do
iterates a link::Classes/Function:: from code::0:: to code::this-1::. See also: link::Classes/Integer#-do::, link::Classes/Collection#-do::
argument:: function
The function to iterate.

method:: reverseDo
iterates function from this-1 to 0
argument:: function
The function to iterate.

method:: coin
Perform a random test whose probability of success in a range from
zero to one is this and return the result.
returns:: a link::Classes/Boolean::
discussion::
code::
0.2.coin; // 20 % chance for true.
::
See also: link::Guides/Randomness::

method:: isFloat
returns:: code::true:: since this is a Float.

method:: asFloat
returns:: code::this:: since this is a Float.

method:: as32Bits
returns:: an Integer which is the bit pattern of this as a 32bit single precision float

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

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

method:: asStringPrec
Returns a string representation of the number, with the desired precision (i.e. number of significant figures).
discussion::
code::
// example:
pi
pi.asStringPrec(3)
pi.asStringPrec(6)
(pi * 0.0001).asStringPrec(3)
7.4.asStringPrec(5)
7.4.asStringPrec(50)
::