1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"949.43">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica
}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000}
15 span
.s1
{font: 18.0px Helvetica
}
16 span
.s2
{color: #0000ff}
17 span
.s3
{color: #000000}
18 span
.Apple-tab-span
{white-space:pre
}
22 <p class=
"p1"><span class=
"s1"><b>Float
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>floating point number
</b></p>
23 <p class=
"p2"><br></p>
24 <p class=
"p1"><b>superclass:
</b><a href=
"SimpleNumber.html"><span class=
"s2">SimpleNumber
</span></a></p>
25 <p class=
"p2"><br></p>
26 <p class=
"p1">A
64 bit double precision floating point number. Float inherits most of its behaviour from its superclass.
</p>
27 <p class=
"p2"><br></p>
28 <p class=
"p2"><br></p>
29 <p class=
"p1"><b>*from32Bits(word)
</b></p>
30 <p class=
"p2"><br></p>
31 <p class=
"p1">Answer a new Float from a
32 bit word.
</p>
32 <p class=
"p2"><br></p>
33 <p class=
"p1"><b>*from64Bits(word)
</b></p>
34 <p class=
"p2"><br></p>
35 <p class=
"p1">Answer a new Float from a
64 bit word.
</p>
36 <p class=
"p2"><br></p>
37 <p class=
"p2"><br></p>
38 <p class=
"p2"><br></p>
39 <p class=
"p3"><b>Instance Methods
</b></p>
40 <p class=
"p2"><br></p>
41 <p class=
"p1"><b>do(function)
</b></p>
42 <p class=
"p1">iterates function from
0 to this-
1. See also:
<a href=
"../Core/Kernel/Function.html"><span class=
"s2">Function
</span></a>,
<a href=
"Integer.html"><span class=
"s2">Integer
</span></a>,
<a href=
"../Collections/Collection.html"><span class=
"s2">Collection
</span></a></p>
43 <p class=
"p2"><br></p>
44 <p class=
"p1"><b>reverseDo(function)
</b></p>
45 <p class=
"p1">iterates function from this-
1 to
0</p>
46 <p class=
"p2"><br></p>
47 <p class=
"p1"><b>coin
</b></p>
48 <p class=
"p2"><br></p>
49 <p class=
"p1">Answers a Boolean which is the result of a random test whose probability of success in a range from
<span class=
"Apple-converted-space"> </span></p>
50 <p class=
"p1">zero to one is this. See also:
<a href=
"../Other Topics/Randomness.html"><span class=
"s2">Randomness
</span></a></p>
51 <p class=
"p2"><br></p>
52 <p class=
"p4"><span class=
"s3">0.2.coin;
</span>//
20 % chance for true.
</p>
53 <p class=
"p2"><br></p>
54 <p class=
"p1"><b>isFloat
</b></p>
55 <p class=
"p2"><br></p>
56 <p class=
"p1">Answer true since this is a Float.
</p>
57 <p class=
"p2"><br></p>
58 <p class=
"p1"><b>asFloat
</b></p>
59 <p class=
"p2"><br></p>
60 <p class=
"p1">Answer this since this is a Float.
</p>
61 <p class=
"p2"><br></p>
62 <p class=
"p1"><b>as32Bits
</b></p>
63 <p class=
"p2"><br></p>
64 <p class=
"p1">Answer an Integer which is the bit pattern of this as a
32bit single precision float
</p>
65 <p class=
"p2"><br></p>
66 <p class=
"p1"><b>high32Bits
</b></p>
67 <p class=
"p2"><br></p>
68 <p class=
"p1">Answer an Integer which is the bit pattern of high
32 bits of the
64 bit double precision floating point value
</p>
69 <p class=
"p2"><br></p>
70 <p class=
"p1"><b>low32Bits
</b></p>
71 <p class=
"p2"><br></p>
72 <p class=
"p1">Answer an Integer which is the bit pattern of high
32 bits of the
64 bit double precision floating point value
</p>
73 <p class=
"p2"><br></p>
74 <p class=
"p1"><b>asStringPrec(precision)
</b></p>
75 <p class=
"p2"><br></p>
76 <p class=
"p1">Returns a string representation of the number, with the desired precision (i.e. number of significant figures).
</p>
77 <p class=
"p2"><br></p>
78 <p class=
"p4">// example:
</p>
80 <p class=
"p5">pi.asStringPrec(
3)
</p>
81 <p class=
"p5">pi.asStringPrec(
6)
</p>
82 <p class=
"p5">(pi *
0.0001).asStringPrec(
3)
</p>
83 <p class=
"p5">7.4.asStringPrec(
5)
</p>
84 <p class=
"p5">7.4.asStringPrec(
50)
</p>