My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
topic "Math utility";
[2 $$0,0#00000000000000000000000000000000:Default]
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
[l288;2 $$2,0#27521748481378242620020725143825:desc]
[0 $$3,0#96390100711032703541132217272105:end]
[H6;0 $$4,0#05600065144404261032431302351956:begin]
[i448;a25;kKO9;2 $$5,0#37138531426314131252341829483370:item]
[l288;a4;*@5;1 $$6,6#70004532496200323422659154056402:requirement]
[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param]
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
[b42;2 $$9,9#13035079074754324216151401829390:normal]
[{_}
[ {{10000@(113.42.0) [s0;%% [*@7;4 Math utility]]}}&]
[s3; &]
[s0;%% A number of mathematical functions and constants.&]
[s3; &]
[s0; &]
[ {{10000F(128)G(128)@1 [s0;%% [* Constant List]]}}&]
[s3; &]
[s5;:M`_E: [* M`_E]&]
[s2;%% [/ e-|-|-|]2.71828182845904523536&]
[s3;%% &]
[s4; &]
[s5;:M`_LOG2E: [* M`_LOG2E]&]
[s2;%% [/ log][/, 2][/ e-|-|-|]1.44269504088896340736&]
[s3;%% &]
[s4; &]
[s5;:M`_LOG10E: [* M`_LOG10E]&]
[s2;%% [/ log10e]-|-|-|0.434294481903251827651&]
[s3;%% &]
[s4; &]
[s5;:M`_LN2: [* M`_LN2]&]
[s2;%% [/ ln2]-|-|-|0.693147180559945309417&]
[s3;%% &]
[s4; &]
[s5;:M`_LN10: [* M`_LN10]&]
[s2;%% [/ ln10]-|-|-|2.30258509299404568402&]
[s3;%% &]
[s4; &]
[s5;:M`_PI: [* M`_PI]&]
[s2;%% [/ Pi]-|-|-|3.14159265358979323846&]
[s3;%% &]
[s4; &]
[s5;:M`_PI`_2: [* M`_PI`_2]&]
[s2;%% [/ Pi / 2]-|-|-|1.57079632679489661923&]
[s3;%% &]
[s4; &]
[s5;:M`_PI`_4: [* M`_PI`_4]&]
[s2;%% [/ Pi / 4]-|-|-|0.785398163397448309616&]
[s3;%% &]
[s4; &]
[s5;:M`_1`_PI: [* M`_1`_PI]&]
[s2;%% [/ 1 / Pi]-|-|-|0.318309886183790671538&]
[s3;%% &]
[s4; &]
[s5;:M`_2`_PI: [* M`_2`_PI]&]
[s2;%% [/ 2 / Pi]-|-|-|0.636619772367581343076&]
[s3;%% &]
[s4; &]
[s5;:M`_1`_SQRTPI: [* M`_1`_SQRTPI]&]
[s2;%% [/ 1 / sqrt(Pi)]-|-|0.564189583547756286948&]
[s3;%% &]
[s4; &]
[s5;:M`_2`_SQRTPI: [* M`_2`_SQRTPI]&]
[s2;%% [/ 2 / sqrt(Pi)]-|-|1.12837916709551257390&]
[s3;%% &]
[s4; &]
[s5;:M`_SQRT2: [* M`_SQRT2]&]
[s2;%% 1.41421356237309504880&]
[s3;%% &]
[s4; &]
[s5;:M`_SQRT`_2: [* M`_SQRT`_2]&]
[s2;%% 0.707106781186547524401&]
[s3;%% &]
[s4; &]
[s5;:M`_2PI: [* M`_2PI]&]
[s2;%% [/ 2Pi]&]
[s3; &]
[s0;%% &]
[ {{10000F(128)G(128)@1 [s0;%% [* Function List]]}}&]
[s3; &]
[s5;:Random`(`): [_^dword^ dword]_[* Random]()&]
[s2;%% Returns the next random generated number. MT safe and efficient
variant of Merssene twister MT19937 by Takuji Nishimura and Makoto
Matsumoto is used to get random numbers, with the seed obtained
from host platform specific resources (`'/dev/urandom`' in Posix
systems, GUID generator in Win32).&]
[s3;%% &]
[s4; &]
[s5;:SeedRandom`(dword`*`,int`): [@(0.0.255) void]_[* SeedRandom]([_^dword^ dword]_`*[*@3 see
d],[@(0.0.255) int]_[*@3 len])&]
[s2;%% Seeds random with buffer.&]
[s3;%% &]
[s4; &]
[s5;:SeedRandom`(dword`): [@(0.0.255) void]_[* SeedRandom]([_^dword^ dword]_[*@3 seed]_`=_[@3 0
])&]
[s2;%% Seeds random with single value [%-*@3 seed]. This is good to
get always the same sequence of numbers (for the same seed)&]
[s3;%% &]
[s4; &]
[s5;:ZeroArray`(x`): [* ZeroArray]([*@3 x])&]
[s2;%% Fills C array [%-*@3 x] with zeros.&]
[s3;%% &]
[s4; &]
[s5;:Random`(dword`): [_^dword^ dword]_[* Random]([_^dword^ dword]_[*@3 n])&]
[s2; Returns the next random generated number smaller than [*@3 n].&]
[s3;%% &]
[s4; &]
[s5;:Random64`(`): [_^qword^ qword]_[* Random64]()&]
[s2;%% Returns the 64bit random number.&]
[s3; &]
[s4; &]
[s5;:Random64`(qword`): [_^qword^ qword]_[* Random64]([_^qword^ qword]_[*@3 n])&]
[s2; [%% Returns the 64bit random number] smaller than [*@3 n].&]
[s3;%% &]
[s4; &]
[s5;:Randomf`(`): [@(0.0.255) double]_[* Randomf]()&]
[s2;%% Returns the floating point number 0..1.&]
[s3; &]
[s4; &]
[s5;:sqr`(double`): [@(0.0.255) double]_[* sqr]_([@(0.0.255) double]_[*@3 a])&]
[s2;%% Returns the square of [%-*@3 a].&]
[s3;%% &]
[s4; &]
[s5;:argsinh`(double`): [@(0.0.255) double]_[* argsinh]_([@(0.0.255) double]_[*@3 s])&]
[s2;%% Returns the hyperbolic arcsin of [%-*@3 s].&]
[s3;%% &]
[s4; &]
[s5;:argcosh`(double`): [@(0.0.255) double]_[* argcosh]_([@(0.0.255) double]_[*@3 c])&]
[s2;%% Returns the hyperbolic arcsin of [%-*@3 c].&]
[s3;%% &]
[s4; &]
[s5;:argtanh`(double`): [@(0.0.255) double]_[* argtanh]_([@(0.0.255) double]_[*@3 t])&]
[s2;%% Returns the hyperbolic arctan of [%-*@3 t].&]
[s3;%% &]
[s4; &]
[s5;:iscale`(int`,int`,int`): [@(0.0.255) int]_[* iscale]([@(0.0.255) int]_[*@3 x],
[@(0.0.255) int]_[*@3 y], [@(0.0.255) int]_[*@3 z])&]
[s2;%% Returns [%-*@3 x] `* [%-*@3 y] / [%-*@3 z].&]
[s3;%% &]
[s4; &]
[s5;:iscalefloor`(int`,int`,int`): [@(0.0.255) int]_[* iscalefloor]([@(0.0.255) int]_[*@3 x],
[@(0.0.255) int]_[*@3 y], [@(0.0.255) int]_[*@3 z])&]
[s2;%% Returns [%-*@3 x] `* [%-*@3 y] / [%-*@3 z][%-* ,][%- rounded towards
negative infinity].&]
[s3;%% &]
[s4; &]
[s5;:iscaleceil`(int`,int`,int`): [@(0.0.255) int]_[* iscaleceil]([@(0.0.255) int]_[*@3 x],
[@(0.0.255) int]_[*@3 y], [@(0.0.255) int]_[*@3 z])&]
[s2;%% Returns [%-*@3 x] `* [%-*@3 y] / [%-*@3 z][%-* ,][%- rounded towards
positive infinity].&]
[s3;%% &]
[s4; &]
[s5;:idivfloor`(int`,int`): [@(0.0.255) int]_[* idivfloor]([@(0.0.255) int]_[*@3 x],
[@(0.0.255) int]_[*@3 y])&]
[s2;%% Returns [%-*@3 x] / [%-*@3 y], truncated towards [%- negative infinity].&]
[s3;%% &]
[s4; &]
[s5;:idivceil`(int`,int`): [@(0.0.255) int]_[* idivceil]([@(0.0.255) int]_[*@3 x],
[@(0.0.255) int]_[*@3 y])&]
[s2;%% Returns [%-*@3 x] / [%-*@3 y], truncated towards [%- positive infinity].&]
[s3;%% &]
[s4; &]
[s5;:itimesfloor`(int`,int`): [@(0.0.255) int]_[* itimesfloor]([@(0.0.255) int]_[*@3 x],
[@(0.0.255) int]_[*@3 y])&]
[s2; Moves [*@3 x] to nearest lower multiple of [*@3 y].&]
[s3;%% &]
[s4; &]
[s5;:itimesceil`(int`,int`): [@(0.0.255) int]_[* itimesceil]([@(0.0.255) int]_[*@3 x],
[@(0.0.255) int]_[*@3 y])&]
[s2; Moves [*@3 x] to nearest higher multiple of [*@3 y].&]
[s3;%% &]
[s4; &]
[s5;:fround`(double`): [@(0.0.255) int]_[* fround]([@(0.0.255) double]_[*@3 x])&]
[s2; Converts double [*@3 x ]to nearest integer. Checks integer limits.&]
[s3;%% &]
[s4; &]
[s5;:ffloor`(double`): [@(0.0.255) int]_[* ffloor]([@(0.0.255) double]_[*@3 x])&]
[s2; Converts double [*@3 x ]to integer rounding towards negative infinity.
Checks integer limits.&]
[s3;%% &]
[s4; &]
[s5;:fceil`(double`): [@(0.0.255) int]_[* fceil]([@(0.0.255) double]_[*@3 x])&]
[s2; Converts double [*@3 x ]to integer rounding towards `+infinity.
Checks integer limits.&]
[s3;%% &]
[s4; &]
[s5;:fround64`(double`): [_^int64^ int64]_[* fround64]([@(0.0.255) double]_[*@3 x])&]
[s2; Converts double [*@3 x ]to nearest integer. Checks integer limits.&]
[s3;%% &]
[s4; &]
[s5;:ffloor64`(double`): [_^int64^ int64]_[* ffloor64]([@(0.0.255) double]_[*@3 x])&]
[s2; Converts double [*@3 x ]to integer rounding towards negative infinity.
Checks integer limits.&]
[s3;%% &]
[s4; &]
[s5;:fceil64`(double`): [_^int64^ int64]_[* fceil64]([@(0.0.255) double]_[*@3 x])&]
[s2; Converts double [*@3 x ]to integer rounding towards `+infinity.
Checks integer limits.&]
[s3;%% &]
[s4; &]
[s5;:modulo`(double`,double`): [@(0.0.255) double]_[* modulo]([@(0.0.255) double]_[*@3 x],
[@(0.0.255) double]_[*@3 y])&]
[s2;%% Returns the floating`-point remainder of [%-*@3 x]/[%-*@3 y].&]
[s2;%% &]
[s2;%% The remainder of a division operation is the result of subtracting
the integral quotient multiplied by the denominator from the
numerator:&]
[s2;%% &]
[s2;%% remainder `= numerator `- quotient `* denominator.&]
[s3;%% &]
[s4; &]
[s5;:ilog10`(double`): [@(0.0.255) int]_[* ilog10]_([@(0.0.255) double]_[*@3 d])&]
[s2;%% [%-*@3 d].&]
[s3;%% &]
[s4; &]
[s5;:ipow10`(int`): [@(0.0.255) double]_[* ipow10]_([@(0.0.255) int]_[*@3 i])&]
[s2;%% [%-*@3 i].&]
[s3;%% &]
[s4; &]
[s5;:normalize`(double`,int`&`): [@(0.0.255) double]_[* normalize]_([@(0.0.255) double]_[*@3 d
], [@(0.0.255) int`&]_[*@3 exponent])&]
[s2;%% [%-*@3 d] [%-*@3 exponent].&]
[s3;%% &]
[s4; &]
[s5;:roundr`(double`,int`): [@(0.0.255) double]_[* roundr]_([@(0.0.255) double]_[*@3 d],
[@(0.0.255) int]_[*@3 digits])&]
[s2;%% [%-*@3 d] [%-*@3 digits].&]
[s3;%% &]
[s4; &]
[s5;:floorr`(double`,int`): [@(0.0.255) double]_[* floorr]_([@(0.0.255) double]_[*@3 d],
[@(0.0.255) int]_[*@3 digits])&]
[s2;%% [%-*@3 d] [%-*@3 digits].&]
[s3;%% &]
[s4; &]
[s5;:ceilr`(double`,int`): [@(0.0.255) double]_[* ceilr]_([@(0.0.255) double]_[*@3 d],
[@(0.0.255) int]_[*@3 digits])&]
[s2;%% [%-*@3 d] [%-*@3 digits].&]
[s3;%% &]
[s4; &]
[s5;:AsString`(double`,int`): [_^String^ String]_[* AsString]([@(0.0.255) double]_[*@3 x],
[@(0.0.255) int]_[*@3 nDigits])&]
[s2;%% [%- Returns the string representation of ][%-*@3 x][%- with] [%-*@3 nDigits][%-
precision].&]
[s3; &]
[s0; ]

Change log

r4439 by cxl on Jan 18, 2012   Diff
Core: Some new Random number generator
functions
Go to: 
Project members, sign in to write a code review

Older revisions

r3630 by koldo on Jul 10, 2011   Diff
Core: Added doc
r1984 by cbpporter on Jan 29, 2010   Diff
Documentation update
r1021 by cxl on Mar 29, 2009   Diff
MT docs
All revisions of this file

File info

Size: 8952 bytes, 246 lines
Powered by Google Project Hosting