16 このような算術関数が Ring にあります。
18 =============== ============================================================================================
20 =============== ============================================================================================
21 sin(x) ラジアン x のサイン角度を返します。
22 cos(x) ラジアン x のコサイン角度を返します。
23 tan(x) ラジアン x のタンジェント角度を返します。
24 asin(x) ラジアン表記によるアークサインの x の主値を返します。
25 acos(x) ラジアン表記によるアークコサインの x の主値を返します。
26 atan(x) ラジアン表記によるアークタンジェントの x の主値を返します。
27 atan2(y,x) ラジアン [-pi,+pi] の区間にある、ラジアン表記によるアークタンジェントの x の主値を返します。
28 sinh(x) ラジアン x の双曲線サインを返します。
29 cosh(x) ラジアン x の双曲線コサインを返します。
30 tanh(x) ラジアン x の双曲線タンジェントを返します。
33 log10(x) x の常用対数を返します (10 を底とする対数)。
34 ceil(x) x 以上の最小整数値を返します。
35 floor(x) x 以下の最大整数値を返します。
37 pow(x,y) x に対する y の累乗を返します。
39 random(x) [0,x] の範囲による乱数を返します。
40 srandom(x) 乱数生成器を初期化します。
41 unsigned(n,n,c) 符号なし数値で演算を実行します。
42 decimals(n) 浮動小数点数、倍精度数の小数点の後にある小数点以下の数値を決定します。
43 =============== ============================================================================================
53 See "Mathematical Functions" + nl
54 See "Sin(0) = " + sin(0) + nl
55 See "Sin(90) radians = " + sin(90) + nl
56 See "Sin(90) degree = " + sin(90*3.14/180) + nl
58 See "Cos(0) = " + cos(0) + nl
59 See "Cos(90) radians = " + cos(90) + nl
60 See "Cos(90) degree = " + cos(90*3.14/180) + nl
62 See "Tan(0) = " + tan(0) + nl
63 See "Tan(90) radians = " + tan(90) + nl
64 See "Tan(90) degree = " + tan(90*3.14/180) + nl
66 See "asin(0) = " + asin(0) + nl
67 See "acos(0) = " + acos(0) + nl
68 See "atan(0) = " + atan(0) + nl
69 See "atan2(1,1) = " + atan2(1,1) + nl
71 See "sinh(0) = " + sinh(0) + nl
72 See "sinh(1) = " + sinh(1) + nl
73 See "cosh(0) = " + cosh(0) + nl
74 See "cosh(1) = " + cosh(1) + nl
75 See "tanh(0) = " + tanh(0) + nl
76 See "tanh(1) = " + tanh(1) + nl
78 See "exp(0) = " + exp(0) + nl
79 See "exp(1) = " + exp(1) + nl
80 See "log(1) = " + log(1) + nl
81 See "log(2) = " + log(2) + nl
82 See "log10(1) = " + log10(1) + nl
83 See "log10(2) = " + log10(2) + nl
84 See "log10(10) = " + log10(10) + nl
86 See "Ceil(1.12) = " + Ceil(1.12) + nl
87 See "Ceil(1.72) = " + Ceil(1.72) + nl
89 See "Floor(1.12) = " + floor(1.12) + nl
90 See "Floor(1.72) = " + floor(1.72) + nl
92 See "fabs(1.12) = " + fabs(1.12) + nl
93 See "fabs(1.72) = " + fabs(1.72) + nl
95 See "pow(2,3) = " + pow(2,3) + nl
97 see "sqrt(16) = " + sqrt(16) + nl
104 Mathematical Functions
106 Sin(90) radians = 0.89
107 Sin(90) degree = 1.00
109 Cos(90) radians = -0.45
110 Cos(90) degree = 0.00
112 Tan(90) radians = -2.00
113 Tan(90) degree = 1255.77
146 Random() 関数は乱数を生成します。また最大値の指定もできます (オプション扱い)。
152 Random(x) ---> [0,x] の範囲による乱数。
159 see "Random number : " + random() + nl +
160 "Random number Max (100) : " + random(100) + nl
167 Random number : 31881
168 Random number Max (100) : 80
170 Random number Max (100) : 63
172 Random number Max (100) : 43
173 Random number : 12946
174 Random number Max (100) : 39
175 Random number : 22934
176 Random number Max (100) : 48
178 Random number Max (100) : 52
179 Random number : 13196
180 Random number Max (100) : 65
181 Random number : 30390
182 Random number Max (100) : 87
184 Random number Max (100) : 77
185 Random number : 12456
186 Random number Max (100) : 17
187 Random number : 28438
188 Random number Max (100) : 13
189 Random number : 30503
190 Random number Max (100) : 6
191 Random number : 31769
192 Random number Max (100) : 94
194 Random number Max (100) : 65
195 Random number : 14390
196 Random number Max (100) : 90
197 Random number : 28866
198 Random number Max (100) : 12
199 Random number : 24558
200 Random number Max (100) : 70
201 Random number : 29981
202 Random number Max (100) : 77
203 Random number : 12847
204 Random number Max (100) : 63
206 Random number Max (100) : 60
209 pair: 算術関数; SRandom()
214 SRandom() 関数は乱数生成器を初期化します。
223 pair: 算術関数; Unsigned()
228 Unsigned() 関数により符号なし整数を使えます。
234 Unsigned(nNum1,nNum2,cOperator)
235 --> nNum1,nNum2 における cOperator の演算結果。
241 see oat_hash("hello") + nl
243 # ジェンキンス法によるハッシュ関数 - https://en.wikipedia.org/wiki/Jenkins_hash_function
247 h = unsigned(h,ascii(x),"+")
248 h = unsigned(h,unsigned(h,10,"<<"),"+")
249 r = unsigned(h,6,">>")
250 h = unsigned(h, r,"^")
252 h = unsigned(h,unsigned(h,3,"<<"),"+")
253 h = unsigned(h,unsigned(h,11,">>"),"^")
254 h = unsigned(h,unsigned(h,15,"<<"),"+")
264 pair: 算術関数; Decimals()
269 Decimals() により浮動小数点数、倍精度数の小数点の後にある小数点以下の数値を決定できます。
275 Decimals(nDecimalsCount)
311 pair: 算術関数; 数値の桁間に _ を使うには
314 =========================
334 pair: 算術関数; 数値の末尾に f を使うには
337 =========================