oakscriptjs 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/array/index.d.ts +84 -27
- package/dist/cjs/array/index.d.ts.map +1 -1
- package/dist/cjs/array/index.js +235 -78
- package/dist/cjs/array/index.js.map +3 -3
- package/dist/cjs/callsite/index.d.ts +81 -2
- package/dist/cjs/callsite/index.d.ts.map +1 -1
- package/dist/cjs/callsite/index.js +62 -1
- package/dist/cjs/callsite/index.js.map +2 -2
- package/dist/cjs/color/index.d.ts +7 -3
- package/dist/cjs/color/index.d.ts.map +1 -1
- package/dist/cjs/color/index.js +6 -1
- package/dist/cjs/color/index.js.map +2 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/label/index.d.ts.map +1 -1
- package/dist/cjs/label/index.js +2 -1
- package/dist/cjs/label/index.js.map +2 -2
- package/dist/cjs/linefill/index.d.ts.map +1 -1
- package/dist/cjs/linefill/index.js +1 -0
- package/dist/cjs/linefill/index.js.map +2 -2
- package/dist/cjs/math/index.d.ts +76 -21
- package/dist/cjs/math/index.d.ts.map +1 -1
- package/dist/cjs/math/index.js +155 -41
- package/dist/cjs/math/index.js.map +3 -3
- package/dist/cjs/matrix/index.d.ts.map +1 -1
- package/dist/cjs/matrix/index.js +42 -36
- package/dist/cjs/matrix/index.js.map +2 -2
- package/dist/cjs/runtime/series.d.ts +9 -0
- package/dist/cjs/runtime/series.d.ts.map +1 -1
- package/dist/cjs/runtime/series.js +16 -2
- package/dist/cjs/runtime/series.js.map +2 -2
- package/dist/cjs/script/index.d.ts +15 -31
- package/dist/cjs/script/index.d.ts.map +1 -1
- package/dist/cjs/script/index.js +32 -0
- package/dist/cjs/script/index.js.map +2 -2
- package/dist/cjs/session/calendar.d.ts.map +1 -1
- package/dist/cjs/session/calendar.js +15 -2
- package/dist/cjs/session/calendar.js.map +2 -2
- package/dist/cjs/str/index.d.ts +50 -38
- package/dist/cjs/str/index.d.ts.map +1 -1
- package/dist/cjs/str/index.js +43 -15
- package/dist/cjs/str/index.js.map +2 -2
- package/dist/cjs/str/messageformat.d.ts +2 -1
- package/dist/cjs/str/messageformat.d.ts.map +1 -1
- package/dist/cjs/str/messageformat.js +4 -1
- package/dist/cjs/str/messageformat.js.map +2 -2
- package/dist/cjs/str/numberformat.d.ts +4 -0
- package/dist/cjs/str/numberformat.d.ts.map +1 -1
- package/dist/cjs/str/numberformat.js +26 -4
- package/dist/cjs/str/numberformat.js.map +3 -3
- package/dist/cjs/ta/index.d.ts +86 -43
- package/dist/cjs/ta/index.d.ts.map +1 -1
- package/dist/cjs/ta/index.js +173 -267
- package/dist/cjs/ta/index.js.map +3 -3
- package/dist/cjs/ta/running-sum.d.ts +54 -2
- package/dist/cjs/ta/running-sum.d.ts.map +1 -1
- package/dist/cjs/ta/running-sum.js +132 -52
- package/dist/cjs/ta/running-sum.js.map +2 -2
- package/dist/cjs/ta-series.d.ts +4 -4
- package/dist/cjs/ta-series.d.ts.map +1 -1
- package/dist/cjs/ta-series.js +4 -3
- package/dist/cjs/ta-series.js.map +2 -2
- package/dist/cjs/time/datestring.d.ts +1 -0
- package/dist/cjs/time/datestring.d.ts.map +1 -1
- package/dist/cjs/time/datestring.js +7 -0
- package/dist/cjs/time/datestring.js.map +2 -2
- package/dist/cjs/time/index.d.ts.map +1 -1
- package/dist/cjs/time/index.js +2 -1
- package/dist/cjs/time/index.js.map +2 -2
- package/dist/cjs/time/session.d.ts +28 -9
- package/dist/cjs/time/session.d.ts.map +1 -1
- package/dist/cjs/time/session.js +74 -28
- package/dist/cjs/time/session.js.map +2 -2
- package/dist/cjs/time/timezone.d.ts +5 -0
- package/dist/cjs/time/timezone.d.ts.map +1 -1
- package/dist/cjs/time/timezone.js +15 -1
- package/dist/cjs/time/timezone.js.map +2 -2
- package/dist/esm/array/index.d.ts +84 -27
- package/dist/esm/array/index.d.ts.map +1 -1
- package/dist/esm/array/index.js +373 -111
- package/dist/esm/array/index.js.map +1 -1
- package/dist/esm/callsite/index.d.ts +81 -2
- package/dist/esm/callsite/index.d.ts.map +1 -1
- package/dist/esm/callsite/index.js +145 -3
- package/dist/esm/callsite/index.js.map +1 -1
- package/dist/esm/color/index.d.ts +7 -3
- package/dist/esm/color/index.d.ts.map +1 -1
- package/dist/esm/color/index.js +15 -3
- package/dist/esm/color/index.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/label/index.d.ts.map +1 -1
- package/dist/esm/label/index.js +2 -1
- package/dist/esm/label/index.js.map +1 -1
- package/dist/esm/linefill/index.d.ts.map +1 -1
- package/dist/esm/linefill/index.js +3 -0
- package/dist/esm/linefill/index.js.map +1 -1
- package/dist/esm/math/index.d.ts +76 -21
- package/dist/esm/math/index.d.ts.map +1 -1
- package/dist/esm/math/index.js +227 -61
- package/dist/esm/math/index.js.map +1 -1
- package/dist/esm/matrix/index.d.ts.map +1 -1
- package/dist/esm/matrix/index.js +57 -43
- package/dist/esm/matrix/index.js.map +1 -1
- package/dist/esm/runtime/series.d.ts +9 -0
- package/dist/esm/runtime/series.d.ts.map +1 -1
- package/dist/esm/runtime/series.js +18 -1
- package/dist/esm/runtime/series.js.map +1 -1
- package/dist/esm/script/index.d.ts +15 -31
- package/dist/esm/script/index.d.ts.map +1 -1
- package/dist/esm/script/index.js +44 -1
- package/dist/esm/script/index.js.map +1 -1
- package/dist/esm/session/calendar.d.ts.map +1 -1
- package/dist/esm/session/calendar.js +22 -2
- package/dist/esm/session/calendar.js.map +1 -1
- package/dist/esm/str/index.d.ts +50 -38
- package/dist/esm/str/index.d.ts.map +1 -1
- package/dist/esm/str/index.js +103 -52
- package/dist/esm/str/index.js.map +1 -1
- package/dist/esm/str/messageformat.d.ts +2 -1
- package/dist/esm/str/messageformat.d.ts.map +1 -1
- package/dist/esm/str/messageformat.js +7 -2
- package/dist/esm/str/messageformat.js.map +1 -1
- package/dist/esm/str/numberformat.d.ts +4 -0
- package/dist/esm/str/numberformat.d.ts.map +1 -1
- package/dist/esm/str/numberformat.js +38 -4
- package/dist/esm/str/numberformat.js.map +1 -1
- package/dist/esm/ta/index.d.ts +86 -43
- package/dist/esm/ta/index.d.ts.map +1 -1
- package/dist/esm/ta/index.js +296 -348
- package/dist/esm/ta/index.js.map +1 -1
- package/dist/esm/ta/running-sum.d.ts +54 -2
- package/dist/esm/ta/running-sum.d.ts.map +1 -1
- package/dist/esm/ta/running-sum.js +166 -71
- package/dist/esm/ta/running-sum.js.map +1 -1
- package/dist/esm/ta-series.d.ts +4 -4
- package/dist/esm/ta-series.d.ts.map +1 -1
- package/dist/esm/ta-series.js +5 -4
- package/dist/esm/ta-series.js.map +1 -1
- package/dist/esm/time/datestring.d.ts +1 -0
- package/dist/esm/time/datestring.d.ts.map +1 -1
- package/dist/esm/time/datestring.js +12 -0
- package/dist/esm/time/datestring.js.map +1 -1
- package/dist/esm/time/index.d.ts.map +1 -1
- package/dist/esm/time/index.js +3 -1
- package/dist/esm/time/index.js.map +1 -1
- package/dist/esm/time/session.d.ts +28 -9
- package/dist/esm/time/session.d.ts.map +1 -1
- package/dist/esm/time/session.js +113 -42
- package/dist/esm/time/session.js.map +1 -1
- package/dist/esm/time/timezone.d.ts +5 -0
- package/dist/esm/time/timezone.d.ts.map +1 -1
- package/dist/esm/time/timezone.js +21 -1
- package/dist/esm/time/timezone.js.map +1 -1
- package/package.json +1 -1
- package/src/array/index.ts +352 -127
- package/src/callsite/index.ts +147 -3
- package/src/color/index.ts +15 -5
- package/src/index.ts +1 -1
- package/src/label/index.ts +2 -1
- package/src/linefill/index.ts +2 -0
- package/src/math/index.ts +256 -74
- package/src/matrix/index.ts +52 -52
- package/src/runtime/series.ts +22 -1
- package/src/script/index.ts +53 -1
- package/src/session/calendar.ts +22 -2
- package/src/str/index.ts +95 -51
- package/src/str/messageformat.ts +7 -2
- package/src/str/numberformat.ts +39 -4
- package/src/ta/index.ts +306 -386
- package/src/ta/running-sum.ts +187 -74
- package/src/ta-series.ts +8 -7
- package/src/time/datestring.ts +10 -0
- package/src/time/index.ts +3 -1
- package/src/time/session.ts +97 -47
- package/src/time/timezone.ts +21 -1
package/dist/cjs/math/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(math_exports, {
|
|
|
24
24
|
atan: () => atan,
|
|
25
25
|
avg: () => avg,
|
|
26
26
|
ceil: () => ceil,
|
|
27
|
+
constant: () => constant,
|
|
27
28
|
cos: () => cos,
|
|
28
29
|
e: () => e,
|
|
29
30
|
exp: () => exp,
|
|
@@ -36,9 +37,11 @@ __export(math_exports, {
|
|
|
36
37
|
pi: () => pi,
|
|
37
38
|
pow: () => pow,
|
|
38
39
|
random: () => random,
|
|
40
|
+
resetRandom: () => resetRandom,
|
|
39
41
|
round: () => round,
|
|
40
42
|
round_to_mintick: () => round_to_mintick,
|
|
41
43
|
rphi: () => rphi,
|
|
44
|
+
seededRandom: () => seededRandom,
|
|
42
45
|
sign: () => sign,
|
|
43
46
|
sin: () => sin,
|
|
44
47
|
sqrt: () => sqrt,
|
|
@@ -96,27 +99,75 @@ function round(value, precision) {
|
|
|
96
99
|
if (value instanceof import_series.Series) {
|
|
97
100
|
const bars = value.bars;
|
|
98
101
|
const valueArray = value.toArray();
|
|
99
|
-
const length = bars.length;
|
|
100
102
|
const result = [];
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const v = valueArray[i] ?? NaN;
|
|
104
|
-
result.push(Math.round(v));
|
|
105
|
-
}
|
|
106
|
-
} else {
|
|
107
|
-
const multiplier2 = Math.pow(10, precision);
|
|
108
|
-
for (let i = 0; i < length; i++) {
|
|
109
|
-
const v = valueArray[i] ?? NaN;
|
|
110
|
-
result.push(Math.round(v * multiplier2) / multiplier2);
|
|
111
|
-
}
|
|
103
|
+
for (let i = 0; i < bars.length; i++) {
|
|
104
|
+
result.push(roundValue(valueArray[i] ?? NaN, precision));
|
|
112
105
|
}
|
|
113
106
|
return import_series.Series.fromArray(bars, result);
|
|
114
107
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
108
|
+
return roundValue(value, precision);
|
|
109
|
+
}
|
|
110
|
+
const TIE_SCALE = 10n ** 10n;
|
|
111
|
+
const TIE_HALF = 5n * 10n ** 9n - 1n;
|
|
112
|
+
const INT_LIMIT = 2 ** 52;
|
|
113
|
+
function exactRatio(x) {
|
|
114
|
+
const view = new DataView(new ArrayBuffer(8));
|
|
115
|
+
view.setFloat64(0, x);
|
|
116
|
+
const hi = view.getUint32(0);
|
|
117
|
+
const lo = view.getUint32(4);
|
|
118
|
+
const expField = hi >>> 20 & 2047;
|
|
119
|
+
let mantissa = BigInt(hi & 1048575) << 32n | BigInt(lo);
|
|
120
|
+
let exp2 = -1074;
|
|
121
|
+
if (expField !== 0) {
|
|
122
|
+
mantissa |= 1n << 52n;
|
|
123
|
+
exp2 = expField - 1075;
|
|
124
|
+
}
|
|
125
|
+
return exp2 >= 0 ? [mantissa << BigInt(exp2), 1n] : [mantissa, 1n << BigInt(-exp2)];
|
|
126
|
+
}
|
|
127
|
+
function reachesTie(num, den, units) {
|
|
128
|
+
return (num - units * den) * TIE_SCALE >= TIE_HALF * den;
|
|
129
|
+
}
|
|
130
|
+
function tenToMinus(p) {
|
|
131
|
+
return Number.isInteger(p) ? Number(`1e-${p}`) : Math.pow(10, -p);
|
|
132
|
+
}
|
|
133
|
+
function roundValue(value, precision) {
|
|
134
|
+
if (!Number.isFinite(value)) return NaN;
|
|
135
|
+
const negative = value < 0;
|
|
136
|
+
const magnitude = negative ? -value : value;
|
|
137
|
+
if (precision === void 0 || Number.isNaN(precision) || precision <= 0) {
|
|
138
|
+
if (magnitude >= INT_LIMIT) return value;
|
|
139
|
+
let units2 = Math.floor(magnitude);
|
|
140
|
+
if (magnitude - units2 >= 0.5) units2++;
|
|
141
|
+
return negative ? 0 - units2 : units2;
|
|
142
|
+
}
|
|
143
|
+
const scale = 1 / tenToMinus(Math.min(precision, 16));
|
|
144
|
+
const fraction = magnitude % 1;
|
|
145
|
+
const scaled = fraction * scale;
|
|
146
|
+
let units = Math.floor(scaled);
|
|
147
|
+
const offset = scaled - units - 0.5;
|
|
148
|
+
const slack = 1e-9 + scaled * 18e-16;
|
|
149
|
+
if (-slack < offset && offset < slack) {
|
|
150
|
+
const [fn, fd] = exactRatio(fraction);
|
|
151
|
+
const [sn, sd] = exactRatio(scale);
|
|
152
|
+
if (reachesTie(fn * sn, fd * sd, BigInt(units))) units++;
|
|
153
|
+
} else if (offset > 0) {
|
|
154
|
+
units++;
|
|
155
|
+
}
|
|
156
|
+
const result = magnitude - fraction + units / scale;
|
|
157
|
+
return negative ? 0 - result : result;
|
|
158
|
+
}
|
|
159
|
+
const CONSTANT_SCALE = 10n ** 16n;
|
|
160
|
+
function constant(value) {
|
|
161
|
+
const magnitude = Math.abs(value);
|
|
162
|
+
if (!(magnitude >= 1e-3 && magnitude < 0.5)) return value;
|
|
163
|
+
const [num, den] = exactRatio(magnitude);
|
|
164
|
+
const scaled = num * CONSTANT_SCALE;
|
|
165
|
+
let units = scaled / den;
|
|
166
|
+
const twiceRest = (scaled - units * den) * 2n;
|
|
167
|
+
if (twiceRest > den || twiceRest === den && (units & 1n) === 1n) units++;
|
|
168
|
+
const digits = units.toString().padStart(17, "0");
|
|
169
|
+
const result = Number(`${digits.slice(0, -16)}.${digits.slice(-16)}`);
|
|
170
|
+
return value < 0 ? -result : result;
|
|
120
171
|
}
|
|
121
172
|
function max(...values) {
|
|
122
173
|
const hasSeries = values.some((v) => v instanceof import_series.Series);
|
|
@@ -161,7 +212,7 @@ function min(...values) {
|
|
|
161
212
|
function avg(...values) {
|
|
162
213
|
const hasSeries = values.some((v) => v instanceof import_series.Series);
|
|
163
214
|
if (!hasSeries) {
|
|
164
|
-
return values
|
|
215
|
+
return avgOf(values);
|
|
165
216
|
}
|
|
166
217
|
const firstSeries = values.find((v) => v instanceof import_series.Series);
|
|
167
218
|
const bars = firstSeries.bars;
|
|
@@ -174,14 +225,29 @@ function avg(...values) {
|
|
|
174
225
|
const nums = values.map(
|
|
175
226
|
(v, idx) => valueArrays[idx] ? valueArrays[idx][i] ?? NaN : v
|
|
176
227
|
);
|
|
177
|
-
|
|
178
|
-
result.push(sum2 / nums.length);
|
|
228
|
+
result.push(avgOf(nums));
|
|
179
229
|
}
|
|
180
230
|
return import_series.Series.fromArray(bars, result);
|
|
181
231
|
}
|
|
232
|
+
function avgOf(nums) {
|
|
233
|
+
if (nums.length <= 2) {
|
|
234
|
+
let sum3 = 0;
|
|
235
|
+
for (const n of nums) sum3 = sum3 + n;
|
|
236
|
+
return sum3 / nums.length;
|
|
237
|
+
}
|
|
238
|
+
let sum2 = 0;
|
|
239
|
+
let c = 0;
|
|
240
|
+
for (const n of nums) {
|
|
241
|
+
const y = n - c;
|
|
242
|
+
const t = sum2 + y;
|
|
243
|
+
c = t - sum2 - y;
|
|
244
|
+
sum2 = t;
|
|
245
|
+
}
|
|
246
|
+
return (sum2 - c) / nums.length;
|
|
247
|
+
}
|
|
182
248
|
function sum(source, length) {
|
|
183
249
|
const sourceArray = source instanceof import_series.Series ? source.toArray() : source;
|
|
184
|
-
const result = (0, import_running_sum.runningSum)(sourceArray, length);
|
|
250
|
+
const result = typeof length === "number" ? (0, import_running_sum.runningSum)(sourceArray, length) : (0, import_running_sum.runningSumSeries)(sourceArray, length instanceof import_series.Series ? length.toArray() : length, "math.sum");
|
|
185
251
|
if (source instanceof import_series.Series) {
|
|
186
252
|
return import_series.Series.fromArray(source.bars, result);
|
|
187
253
|
}
|
|
@@ -373,7 +439,33 @@ function todegrees(radians) {
|
|
|
373
439
|
}
|
|
374
440
|
return radians * (180 / Math.PI);
|
|
375
441
|
}
|
|
376
|
-
function
|
|
442
|
+
function seededRandom(seed) {
|
|
443
|
+
const mask = (1n << 48n) - 1n;
|
|
444
|
+
let state = (BigInt(Math.trunc(seed)) ^ 0x5deece66dn) & mask;
|
|
445
|
+
const next = (bits) => {
|
|
446
|
+
state = 0x5deece66dn * state + 11n & mask;
|
|
447
|
+
return state >> 48n - bits;
|
|
448
|
+
};
|
|
449
|
+
return (min2 = 0, max2 = 1) => {
|
|
450
|
+
const hi = next(26n);
|
|
451
|
+
const lo = next(27n);
|
|
452
|
+
const unit = Number((hi << 27n) + lo) / 2 ** 53;
|
|
453
|
+
return min2 + unit * (max2 - min2);
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
const seeded = /* @__PURE__ */ new Map();
|
|
457
|
+
function resetRandom() {
|
|
458
|
+
seeded.clear();
|
|
459
|
+
}
|
|
460
|
+
function random(min2, max2, seed) {
|
|
461
|
+
if (seed !== void 0 && seed !== null && !Number.isNaN(seed)) {
|
|
462
|
+
let gen = seeded.get(seed);
|
|
463
|
+
if (!gen) {
|
|
464
|
+
gen = seededRandom(seed);
|
|
465
|
+
seeded.set(seed, gen);
|
|
466
|
+
}
|
|
467
|
+
return gen(min2 ?? 0, max2 ?? 1);
|
|
468
|
+
}
|
|
377
469
|
const rand = Math.random();
|
|
378
470
|
if (min2 !== void 0 && max2 !== void 0) {
|
|
379
471
|
return min2 + rand * (max2 - min2);
|
|
@@ -398,26 +490,14 @@ function round_to_mintick(number, mintick) {
|
|
|
398
490
|
if (number instanceof import_series.Series) {
|
|
399
491
|
const bars = number.bars;
|
|
400
492
|
const valueArray = number.toArray();
|
|
401
|
-
const length = bars.length;
|
|
402
493
|
if (mintick === void 0) {
|
|
403
494
|
throw new Error(
|
|
404
495
|
"math.round_to_mintick() requires mintick value. Either pass it explicitly or use createContext({ syminfo: { mintick } }) for implicit data."
|
|
405
496
|
);
|
|
406
497
|
}
|
|
407
498
|
const result = [];
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
result.push(valueArray[i] ?? NaN);
|
|
411
|
-
}
|
|
412
|
-
} else {
|
|
413
|
-
for (let i = 0; i < length; i++) {
|
|
414
|
-
const v = valueArray[i];
|
|
415
|
-
if (v === void 0 || isNaN(v)) {
|
|
416
|
-
result.push(NaN);
|
|
417
|
-
} else {
|
|
418
|
-
result.push(Math.round(v / mintick) * mintick);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
499
|
+
for (let i = 0; i < bars.length; i++) {
|
|
500
|
+
result.push(roundToTick(valueArray[i] ?? NaN, mintick));
|
|
421
501
|
}
|
|
422
502
|
return import_series.Series.fromArray(bars, result);
|
|
423
503
|
}
|
|
@@ -429,13 +509,47 @@ function round_to_mintick(number, mintick) {
|
|
|
429
509
|
"math.round_to_mintick() requires mintick value. Either pass it explicitly or use createContext({ syminfo: { mintick } }) for implicit data."
|
|
430
510
|
);
|
|
431
511
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
512
|
+
return roundToTick(number, mintick);
|
|
513
|
+
}
|
|
514
|
+
function tickPair(mintick) {
|
|
515
|
+
for (let k = 0; k <= 15; k++) {
|
|
516
|
+
const pricescale = Number(`1e${k}`);
|
|
517
|
+
const scaled = mintick * pricescale;
|
|
518
|
+
const minmove = Math.round(scaled);
|
|
519
|
+
if (minmove >= 1 && Math.abs(scaled - minmove) <= 1e-9 * minmove) return [minmove, pricescale];
|
|
520
|
+
}
|
|
521
|
+
return null;
|
|
522
|
+
}
|
|
523
|
+
function roundToTick(number, mintick) {
|
|
524
|
+
if (!Number.isFinite(number)) return NaN;
|
|
525
|
+
if (mintick === 0) return number;
|
|
526
|
+
const pair = tickPair(mintick);
|
|
527
|
+
const negative = number < 0;
|
|
528
|
+
const magnitude = negative ? -number : number;
|
|
529
|
+
if (pair === null) {
|
|
530
|
+
const scaled2 = magnitude / mintick;
|
|
531
|
+
let units2 = Math.trunc(scaled2);
|
|
532
|
+
if (scaled2 - units2 >= 0.5) units2++;
|
|
533
|
+
return (negative ? 0 - units2 : units2) * mintick;
|
|
534
|
+
}
|
|
535
|
+
const [minmove, pricescale] = pair;
|
|
536
|
+
const scaled = magnitude * pricescale / minmove;
|
|
537
|
+
let units = Math.trunc(scaled);
|
|
538
|
+
const offset = scaled - units - 0.5;
|
|
539
|
+
const slack = 1e-6 + scaled * 18e-16;
|
|
540
|
+
if (-slack < offset && offset < slack) {
|
|
541
|
+
const [n, d] = exactRatio(magnitude);
|
|
542
|
+
const num = n * BigInt(pricescale);
|
|
543
|
+
const den = d * BigInt(minmove);
|
|
544
|
+
const whole = num / den;
|
|
545
|
+
units = Number(whole) + (reachesTie(num, den, whole) ? 1 : 0);
|
|
546
|
+
} else if (offset > 0) {
|
|
547
|
+
units++;
|
|
548
|
+
}
|
|
549
|
+
return (negative ? 0 - units : units) * minmove / pricescale;
|
|
436
550
|
}
|
|
437
551
|
const pi = Math.PI;
|
|
438
552
|
const e = Math.E;
|
|
439
553
|
const phi = 1.618033988749895;
|
|
440
|
-
const rphi = 0.
|
|
554
|
+
const rphi = 0.6180339887498948;
|
|
441
555
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/math/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Math namespace\n * Mirrors PineScript's math.* functions for mathematical operations and calculations.\n *\n * @remarks\n * All math functions in this namespace follow PineScript v6 API specifications.\n * Functions include basic arithmetic, algebraic operations, trigonometry, and combinatorics.\n *\n * Known difference: `log10`, `exp`, `log`, `pow`, `sin`, `cos`, `tan` use JavaScript's `Math`. PineScript uses\n * other algorithms, whose results differ by 1 or 2 units in the last place on part of the inputs (`log10` about 4 %,\n * `exp` about 9 %, `sin` / `cos` / `tan` about 3 %, `log` 0.4 %, `pow` 0.05 % of random inputs). A constant argument\n * (`math.log10(2)`) can differ by up to 3 units in the last place. This is visible only when a script amplifies\n * these tiny differences (e.g. `ma > ma[1]` on values of 1e195); `sqrt`, `atan`, `asin`, `acos` are equal.\n *\n * @version 6\n */\n\nimport type { float, int, simple_int, series_float } from '../types/index.js';\nimport { Series } from '../runtime/series.js';\nimport { runningSum } from '../ta/running-sum.js';\n\n/**\n * Returns the absolute value of a number.\n *\n * @param value - The number or Series\n * @returns The absolute value (always non-negative)\n *\n * @remarks\n * - Returns the distance from zero on the number line\n * - |x| = x if x \u2265 0, -x if x < 0\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.abs(5) // Returns: 5\n * math.abs(-5) // Returns: 5\n * math.abs(0) // Returns: 0\n * ```\n */\nexport function abs(value: Series): Series;\nexport function abs(value: float): float;\nexport function abs(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.abs(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.abs(value);\n}\n\n/**\n * Returns the smallest integer greater than or equal to a given number (rounds up).\n *\n * @param value - The number to round up or Series\n * @returns The ceiling value (smallest integer \u2265 value)\n *\n * @remarks\n * - Always rounds towards positive infinity\n * - For positive numbers, rounds away from zero\n * - For negative numbers, rounds towards zero\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.ceil(4.2) // Returns: 5\n * math.ceil(4.8) // Returns: 5\n * math.ceil(-4.2) // Returns: -4\n * math.ceil(5) // Returns: 5\n * ```\n */\nexport function ceil(value: Series): Series;\nexport function ceil(value: float): int;\nexport function ceil(value: float | Series): int | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.ceil(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.ceil(value);\n}\n\n/**\n * Returns the largest integer less than or equal to a given number (rounds down).\n *\n * @param value - The number to round down or Series\n * @returns The floor value (largest integer \u2264 value)\n *\n * @remarks\n * - Always rounds towards negative infinity\n * - For positive numbers, rounds towards zero\n * - For negative numbers, rounds away from zero\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.floor(4.2) // Returns: 4\n * math.floor(4.8) // Returns: 4\n * math.floor(-4.2) // Returns: -5\n * math.floor(5) // Returns: 5\n * ```\n */\nexport function floor(value: Series): Series;\nexport function floor(value: float): int;\nexport function floor(value: float | Series): int | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.floor(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.floor(value);\n}\n\n/**\n * Returns the value rounded to the nearest integer or to a specified precision.\n *\n * @param value - The number to round or Series\n * @param precision - Optional number of decimal places (default: 0)\n * @returns The rounded value\n *\n * @remarks\n * - Rounds to nearest integer by default\n * - With precision, rounds to that many decimal places\n * - Uses \"round half up\" strategy (0.5 rounds to 1)\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.round(4.2) // Returns: 4\n * math.round(4.5) // Returns: 5\n * math.round(4.8) // Returns: 5\n * math.round(4.567, 2) // Returns: 4.57\n * math.round(4.567, 1) // Returns: 4.6\n * ```\n */\nexport function round(value: Series, precision?: int): Series;\nexport function round(value: float, precision?: int): float;\nexport function round(value: float | Series, precision?: int): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n if (precision === undefined) {\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.round(v));\n }\n } else {\n const multiplier = Math.pow(10, precision);\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.round(v * multiplier) / multiplier);\n }\n }\n \n return Series.fromArray(bars, result);\n }\n \n if (precision === undefined) {\n return Math.round(value);\n }\n const multiplier = Math.pow(10, precision);\n return Math.round(value * multiplier) / multiplier;\n}\n\n/**\n * Returns the maximum value from the arguments.\n *\n * @param values - Variable number of values to compare (numbers or Series)\n * @returns The largest value\n *\n * @remarks\n * - Accepts any number of arguments\n * - Returns -Infinity if no arguments provided\n * - Returns NaN if any argument is NaN\n * - If any argument is a Series, returns a Series; otherwise returns a number\n *\n * @example\n * ```typescript\n * math.max(1, 2, 3) // Returns: 3\n * math.max(-1, -5, -2) // Returns: -1\n * math.max(10) // Returns: 10\n * math.max(5, 10, 3, 8) // Returns: 10\n * ```\n */\nexport function max(...values: (float | Series)[]): float | Series {\n // Check if any value is a Series\n const hasSeries = values.some(v => v instanceof Series);\n \n if (!hasSeries) {\n // All scalars - use native Math.max\n return Math.max(...(values as number[]));\n }\n \n // At least one Series - return a Series\n const firstSeries = values.find(v => v instanceof Series) as Series;\n const bars = firstSeries.bars;\n const length = bars.length;\n \n // Convert all values to arrays (scalars become constant arrays)\n const valueArrays = values.map(v => \n v instanceof Series ? v.toArray() : null\n );\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const nums = values.map((v, idx) => \n valueArrays[idx] ? valueArrays[idx]![i] ?? NaN : (v as number)\n );\n result.push(Math.max(...nums));\n }\n \n return Series.fromArray(bars, result);\n}\n\n/**\n * Returns the minimum value from the arguments.\n *\n * @param values - Variable number of values to compare (numbers or Series)\n * @returns The smallest value\n *\n * @remarks\n * - Accepts any number of arguments\n * - Returns Infinity if no arguments provided\n * - Returns NaN if any argument is NaN\n * - If any argument is a Series, returns a Series; otherwise returns a number\n *\n * @example\n * ```typescript\n * math.min(1, 2, 3) // Returns: 1\n * math.min(-1, -5, -2) // Returns: -5\n * math.min(10) // Returns: 10\n * math.min(5, 10, 3, 8) // Returns: 3\n * ```\n */\nexport function min(...values: (float | Series)[]): float | Series {\n // Check if any value is a Series\n const hasSeries = values.some(v => v instanceof Series);\n \n if (!hasSeries) {\n // All scalars - use native Math.min\n return Math.min(...(values as number[]));\n }\n \n // At least one Series - return a Series\n const firstSeries = values.find(v => v instanceof Series) as Series;\n const bars = firstSeries.bars;\n const length = bars.length;\n \n // Convert all values to arrays (scalars become constant arrays)\n const valueArrays = values.map(v => \n v instanceof Series ? v.toArray() : null\n );\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const nums = values.map((v, idx) => \n valueArrays[idx] ? valueArrays[idx]![i] ?? NaN : (v as number)\n );\n result.push(Math.min(...nums));\n }\n \n return Series.fromArray(bars, result);\n}\n\n/**\n * Returns the average (arithmetic mean) of the arguments.\n *\n * @param values - Variable number of values (numbers or Series)\n * @returns The arithmetic mean\n *\n * @remarks\n * - Calculates sum of all values divided by count\n * - Returns NaN if no arguments provided (division by zero)\n * - If any argument is a Series, returns a Series; otherwise returns a number\n *\n * @example\n * ```typescript\n * math.avg(1, 2, 3) // Returns: 2\n * math.avg(10, 20) // Returns: 15\n * math.avg(5) // Returns: 5\n * math.avg(1, 2, 3, 4, 5) // Returns: 3\n * ```\n */\nexport function avg(...values: (float | Series)[]): float | Series {\n // Check if any value is a Series\n const hasSeries = values.some(v => v instanceof Series);\n \n if (!hasSeries) {\n // All scalars - calculate simple average\n return (values as number[]).reduce((a, b) => a + b, 0) / values.length;\n }\n \n // At least one Series - return a Series\n const firstSeries = values.find(v => v instanceof Series) as Series;\n const bars = firstSeries.bars;\n const length = bars.length;\n \n // Convert all values to arrays (scalars become constant arrays)\n const valueArrays = values.map(v => \n v instanceof Series ? v.toArray() : null\n );\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const nums = values.map((v, idx) => \n valueArrays[idx] ? valueArrays[idx]![i] ?? NaN : (v as number)\n );\n const sum = nums.reduce((a, b) => a + b, 0);\n result.push(sum / nums.length);\n }\n \n return Series.fromArray(bars, result);\n}\n\n/**\n * Returns the sum of values over a sliding window.\n *\n * @param source - Series of values or array\n * @param length - Window length for summation\n * @returns Series or array with rolling sum values\n *\n * @remarks\n * - Calculates the sum of the last `length` non-`na` values at each point; an `na` value (also +/-Infinity) is\n * skipped and the bar keeps the previous result (as in PineScript)\n * - Returns NaN until `length` non-`na` values are available\n * - A compensated running sum, as in PineScript, so the result can differ from the exact window sum in the last\n * bits (bit for bit with PineScript)\n * - When passed a Series, returns a Series; when passed an array, returns an array\n *\n * @example\n * ```typescript\n * math.sum([1, 2, 3, 4, 5], 3) // Returns: [NaN, NaN, 6, 9, 12]\n * // Explanation: [NaN, NaN, 1+2+3, 2+3+4, 3+4+5]\n * ```\n */\nexport function sum(source: Series, length: simple_int): Series;\nexport function sum(source: series_float, length: simple_int): series_float;\nexport function sum(source: series_float | Series, length: simple_int): series_float | Series {\n // Handle Series objects - extract to array first\n const sourceArray = source instanceof Series ? source.toArray() : source;\n // PineScript: the sum of the last `length` non-na values (also +/-Infinity skipped); an na bar keeps the previous\n // result. A compensated running sum, bit for bit as PineScript.\n const result: series_float = runningSum(sourceArray, length);\n\n // If input was a Series, return a Series\n if (source instanceof Series) {\n return Series.fromArray(source.bars, result);\n }\n\n return result;\n}\n\n/**\n * Returns the square root of a number.\n *\n * @param value - The number (must be non-negative) or Series\n * @returns The square root (\u221Avalue)\n *\n * @remarks\n * - Returns NaN for negative numbers\n * - \u221Ax \u00D7 \u221Ax = x (for non-negative x)\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.sqrt(9) // Returns: 3\n * math.sqrt(16) // Returns: 4\n * math.sqrt(2) // Returns: 1.414...\n * math.sqrt(0) // Returns: 0\n * ```\n */\nexport function sqrt(value: Series): Series;\nexport function sqrt(value: float): float;\nexport function sqrt(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.sqrt(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.sqrt(value);\n}\n\n/**\n * Returns base raised to the power of exponent.\n *\n * @param base - The base number or Series\n * @param exponent - The exponent (power) or Series\n * @returns base^exponent\n *\n * @remarks\n * - 0^0 returns 1\n * - Negative base with fractional exponent returns NaN\n * - Any number to the power of 0 equals 1\n * - If any argument is a Series, returns a Series; if all are numbers, returns a number\n *\n * @example\n * ```typescript\n * math.pow(2, 3) // Returns: 8 (2\u00B3)\n * math.pow(10, 2) // Returns: 100\n * math.pow(5, 0) // Returns: 1\n * math.pow(2, -1) // Returns: 0.5\n * ```\n */\nexport function pow(base: Series, exponent: float): Series;\nexport function pow(base: float, exponent: Series): Series;\nexport function pow(base: Series, exponent: Series): Series;\nexport function pow(base: float, exponent: float): float;\nexport function pow(base: float | Series, exponent: float | Series): float | Series {\n const baseIsSeries = base instanceof Series;\n const expIsSeries = exponent instanceof Series;\n \n // Pure scalar case\n if (!baseIsSeries && !expIsSeries) {\n return Math.pow(base as number, exponent as number);\n }\n \n // At least one is a Series - return a Series\n const bars = baseIsSeries ? (base as Series).bars : (exponent as Series).bars;\n const baseArray = baseIsSeries ? (base as Series).toArray() : null;\n const expArray = expIsSeries ? (exponent as Series).toArray() : null;\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const b = baseArray ? baseArray[i] ?? NaN : (base as number);\n const e = expArray ? expArray[i] ?? NaN : (exponent as number);\n result.push(Math.pow(b, e));\n }\n \n return Series.fromArray(bars, result);\n}\n\n/**\n * Returns e (Euler's number) raised to the power of value.\n *\n * @param value - The exponent or Series\n * @returns e^value (where e \u2248 2.71828)\n *\n * @remarks\n * - e^0 = 1\n * - e^1 = e \u2248 2.71828\n * - Inverse of ln(x)\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.exp(0) // Returns: 1\n * math.exp(1) // Returns: 2.71828... (e)\n * math.exp(2) // Returns: 7.389...\n * math.exp(-1) // Returns: 0.3678...\n * ```\n */\nexport function exp(value: Series): Series;\nexport function exp(value: float): float;\nexport function exp(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.exp(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.exp(value);\n}\n\n/**\n * Returns the natural logarithm (base e) of a number.\n *\n * @param value - The number (must be positive) or Series\n * @returns ln(value)\n *\n * @remarks\n * - Returns NaN for negative numbers\n * - Returns -Infinity for 0\n * - ln(e) = 1\n * - ln(1) = 0\n * - Inverse of exp(x)\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.log(1) // Returns: 0\n * math.log(Math.E) // Returns: 1\n * math.log(10) // Returns: 2.302...\n * math.log(100) // Returns: 4.605...\n * ```\n */\nexport function log(value: Series): Series;\nexport function log(value: float): float;\nexport function log(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.log(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.log(value);\n}\n\n/**\n * Returns the base-10 logarithm of a number.\n *\n * @param value - The number (must be positive) or Series\n * @returns log\u2081\u2080(value)\n *\n * @remarks\n * - Returns NaN for negative numbers\n * - Returns -Infinity for 0\n * - log\u2081\u2080(10) = 1\n * - log\u2081\u2080(100) = 2\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.log10(10) // Returns: 1\n * math.log10(100) // Returns: 2\n * math.log10(1000) // Returns: 3\n * math.log10(1) // Returns: 0\n * ```\n */\nexport function log10(value: Series): Series;\nexport function log10(value: float): float;\nexport function log10(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.log10(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.log10(value);\n}\n\n/**\n * Returns the sine of an angle in radians.\n *\n * @param value - The angle in radians or Series\n * @returns The sine value (range: [-1, 1])\n *\n * @remarks\n * - Input is in radians, not degrees\n * - sin(0) = 0\n * - sin(\u03C0/2) = 1\n * - Periodic with period 2\u03C0\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.sin(0) // Returns: 0\n * math.sin(Math.PI / 2) // Returns: 1\n * math.sin(Math.PI) // Returns: 0 (approximately)\n * math.sin(Math.PI / 6) // Returns: 0.5\n * ```\n */\nexport function sin(value: Series): Series;\nexport function sin(value: float): float;\nexport function sin(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.sin(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.sin(value);\n}\n\n/**\n * Returns the cosine of an angle in radians.\n *\n * @param value - The angle in radians or Series\n * @returns The cosine value (range: [-1, 1])\n *\n * @remarks\n * - Input is in radians, not degrees\n * - cos(0) = 1\n * - cos(\u03C0/2) = 0\n * - Periodic with period 2\u03C0\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.cos(0) // Returns: 1\n * math.cos(Math.PI / 2) // Returns: 0 (approximately)\n * math.cos(Math.PI) // Returns: -1\n * math.cos(Math.PI / 3) // Returns: 0.5\n * ```\n */\nexport function cos(value: Series): Series;\nexport function cos(value: float): float;\nexport function cos(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.cos(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.cos(value);\n}\n\n/**\n * Returns the tangent of an angle in radians.\n *\n * @param value - The angle in radians or Series\n * @returns The tangent value\n *\n * @remarks\n * - Input is in radians, not degrees\n * - tan(x) = sin(x) / cos(x)\n * - Undefined at \u03C0/2, 3\u03C0/2, etc. (returns very large numbers)\n * - Periodic with period \u03C0\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.tan(0) // Returns: 0\n * math.tan(Math.PI / 4) // Returns: 1\n * math.tan(Math.PI / 6) // Returns: 0.577... (1/\u221A3)\n * ```\n */\nexport function tan(value: Series): Series;\nexport function tan(value: float): float;\nexport function tan(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.tan(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.tan(value);\n}\n\n/**\n * Returns the arcsine (inverse sine) of a number.\n *\n * @param value - The value (must be in range [-1, 1]) or Series\n * @returns The angle in radians (range: [-\u03C0/2, \u03C0/2])\n *\n * @remarks\n * - Returns NaN for values outside [-1, 1]\n * - asin(sin(x)) = x for x in [-\u03C0/2, \u03C0/2]\n * - asin(0) = 0\n * - asin(1) = \u03C0/2\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.asin(0) // Returns: 0\n * math.asin(1) // Returns: 1.5707... (\u03C0/2)\n * math.asin(0.5) // Returns: 0.5235... (\u03C0/6)\n * math.asin(-1) // Returns: -1.5707... (-\u03C0/2)\n * ```\n */\nexport function asin(value: Series): Series;\nexport function asin(value: float): float;\nexport function asin(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.asin(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.asin(value);\n}\n\n/**\n * Returns the arccosine (inverse cosine) of a number.\n *\n * @param value - The value (must be in range [-1, 1]) or Series\n * @returns The angle in radians (range: [0, \u03C0])\n *\n * @remarks\n * - Returns NaN for values outside [-1, 1]\n * - acos(cos(x)) = x for x in [0, \u03C0]\n * - acos(1) = 0\n * - acos(0) = \u03C0/2\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.acos(1) // Returns: 0\n * math.acos(0) // Returns: 1.5707... (\u03C0/2)\n * math.acos(0.5) // Returns: 1.0471... (\u03C0/3)\n * math.acos(-1) // Returns: 3.1415... (\u03C0)\n * ```\n */\nexport function acos(value: Series): Series;\nexport function acos(value: float): float;\nexport function acos(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.acos(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.acos(value);\n}\n\n/**\n * Returns the arctangent (inverse tangent) of a number.\n *\n * @param value - The value or Series\n * @returns The angle in radians (range: [-\u03C0/2, \u03C0/2])\n *\n * @remarks\n * - Accepts any number as input\n * - atan(tan(x)) = x for x in [-\u03C0/2, \u03C0/2]\n * - atan(0) = 0\n * - atan(1) = \u03C0/4\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.atan(0) // Returns: 0\n * math.atan(1) // Returns: 0.7853... (\u03C0/4)\n * math.atan(-1) // Returns: -0.7853... (-\u03C0/4)\n * math.atan(Infinity) // Returns: 1.5707... (\u03C0/2)\n * ```\n */\nexport function atan(value: Series): Series;\nexport function atan(value: float): float;\nexport function atan(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.atan(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.atan(value);\n}\n\n/**\n * Converts an angle from degrees to radians.\n *\n * @param degrees - The angle in degrees or Series\n * @returns The angle in radians\n *\n * @remarks\n * - Radians = Degrees \u00D7 (\u03C0 / 180)\n * - One full rotation: 360\u00B0 = 2\u03C0 radians\n * - Common conversions: 90\u00B0 = \u03C0/2, 180\u00B0 = \u03C0, 270\u00B0 = 3\u03C0/2\n * - If degrees is a Series, returns a Series; if degrees is a number, returns a number\n *\n * @example\n * ```typescript\n * math.toradians(0) // Returns: 0\n * math.toradians(90) // Returns: 1.5707... (\u03C0/2)\n * math.toradians(180) // Returns: 3.1415... (\u03C0)\n * math.toradians(360) // Returns: 6.2831... (2\u03C0)\n * ```\n */\nexport function toradians(degrees: Series): Series;\nexport function toradians(degrees: float): float;\nexport function toradians(degrees: float | Series): float | Series {\n if (degrees instanceof Series) {\n const bars = degrees.bars;\n const valueArray = degrees.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(v * (Math.PI / 180));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return degrees * (Math.PI / 180);\n}\n\n/**\n * Converts an angle from radians to degrees.\n *\n * @param radians - The angle in radians or Series\n * @returns The angle in degrees\n *\n * @remarks\n * - Degrees = Radians \u00D7 (180 / \u03C0)\n * - One full rotation: 2\u03C0 radians = 360\u00B0\n * - Common conversions: \u03C0/2 = 90\u00B0, \u03C0 = 180\u00B0, 3\u03C0/2 = 270\u00B0\n * - If radians is a Series, returns a Series; if radians is a number, returns a number\n *\n * @example\n * ```typescript\n * math.todegrees(0) // Returns: 0\n * math.todegrees(Math.PI / 2) // Returns: 90\n * math.todegrees(Math.PI) // Returns: 180\n * math.todegrees(2 * Math.PI) // Returns: 360\n * ```\n */\nexport function todegrees(radians: Series): Series;\nexport function todegrees(radians: float): float;\nexport function todegrees(radians: float | Series): float | Series {\n if (radians instanceof Series) {\n const bars = radians.bars;\n const valueArray = radians.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(v * (180 / Math.PI));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return radians * (180 / Math.PI);\n}\n\n/**\n * Returns a pseudo-random number.\n *\n * @param min - Optional minimum value (inclusive)\n * @param max - Optional maximum value (exclusive)\n * @param seed - Optional seed for deterministic random\n * @returns A random number in the specified range, or [0, 1) if no range specified\n *\n * @remarks\n * - Without arguments: returns value in [0, 1)\n * - With min and max: returns value in [min, max)\n * - **WARNING**: The seed parameter is accepted for API compatibility but NOT currently implemented\n * - This implementation always generates non-deterministic random values\n * - PineScript's version supports deterministic seeding for repeatable sequences\n *\n * @example\n * ```typescript\n * math.random() // Returns: value between 0 and 1 (e.g., 0.234...)\n * math.random(0, 10) // Returns: value between 0 and 10 (e.g., 7.45...)\n * math.random(5, 15) // Returns: value between 5 and 15 (e.g., 11.82...)\n * ```\n */\nexport function random(min?: float, max?: float, _seed?: int): float {\n // TODO: Implement deterministic seeding to match PineScript behavior\n // Currently _seed parameter is ignored\n const rand = Math.random();\n if (min !== undefined && max !== undefined) {\n return min + rand * (max - min);\n }\n return rand;\n}\n\n/**\n * Returns the sign of a number.\n *\n * @param value - The number to check or Series\n * @returns 1 for positive, -1 for negative, 0 for zero, na for na\n *\n * @remarks\n * - Returns 1 if value > 0\n * - Returns -1 if value < 0\n * - Returns 0 if value = 0\n * - Returns na if value is na (as PineScript)\n * - Useful for determining direction or polarity\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.sign(5) // Returns: 1\n * math.sign(-3) // Returns: -1\n * math.sign(0) // Returns: 0\n * math.sign(0.001) // Returns: 1\n * math.sign(NaN) // Returns: NaN\n * ```\n */\nexport function sign(value: Series): Series;\nexport function sign(value: float): int;\nexport function sign(value: float | Series): int | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(v > 0 ? 1 : v < 0 ? -1 : v === 0 ? 0 : NaN);\n }\n \n return Series.fromArray(bars, result);\n }\n \n return value > 0 ? 1 : value < 0 ? -1 : value === 0 ? 0 : NaN;\n}\n\n/**\n * Rounds a value to the nearest mintick.\n *\n * @param number - The number to round or Series\n * @param mintick - Optional mintick value (defaults to requiring syminfo context)\n * @returns The number rounded to tick precision\n *\n * @remarks\n * - **PineScript v6 signature**: `math.round_to_mintick(number)` - uses implicit syminfo.mintick\n * - **JavaScript signature**: Requires explicit `mintick` OR use `createContext()` with syminfo\n * - Rounds to the nearest value divisible by mintick\n * - Returns NaN for NaN input\n * - Ties round up (0.5 -> 1)\n * - If number is a Series, returns a Series; if number is a float, returns a float\n *\n * @example\n * ```typescript\n * // Direct call with explicit mintick\n * const rounded = math.round_to_mintick(1.2345, 0.01); // Returns: 1.23\n * const rounded2 = math.round_to_mintick(1.2367, 0.01); // Returns: 1.24\n *\n * // Or use context API for cleaner syntax\n * const { math } = createContext({ syminfo: { mintick: 0.01 } });\n * const rounded = math.round_to_mintick(1.2345); // Returns: 1.23\n * ```\n */\nexport function round_to_mintick(number: Series, mintick?: float): Series;\nexport function round_to_mintick(number: float, mintick?: float): float;\nexport function round_to_mintick(number: float | Series, mintick?: float): float | Series {\n if (number instanceof Series) {\n const bars = number.bars;\n const valueArray = number.toArray();\n const length = bars.length;\n \n if (mintick === undefined) {\n throw new Error(\n 'math.round_to_mintick() requires mintick value. ' +\n 'Either pass it explicitly or use createContext({ syminfo: { mintick } }) for implicit data.'\n );\n }\n \n const result: number[] = [];\n if (mintick === 0) {\n // No rounding needed\n for (let i = 0; i < length; i++) {\n result.push(valueArray[i] ?? NaN);\n }\n } else {\n for (let i = 0; i < length; i++) {\n const v = valueArray[i];\n if (v === undefined || isNaN(v)) {\n result.push(NaN);\n } else {\n result.push(Math.round(v / mintick) * mintick);\n }\n }\n }\n \n return Series.fromArray(bars, result);\n }\n \n // Scalar case\n if (isNaN(number)) {\n return NaN;\n }\n\n if (mintick === undefined) {\n throw new Error(\n 'math.round_to_mintick() requires mintick value. ' +\n 'Either pass it explicitly or use createContext({ syminfo: { mintick } }) for implicit data.'\n );\n }\n\n if (mintick === 0) {\n return number;\n }\n\n // Round to nearest tick\n return Math.round(number / mintick) * mintick;\n}\n\n// Constants\nexport const pi = Math.PI;\nexport const e = Math.E;\nexport const phi = 1.618033988749895; // Golden ratio\nexport const rphi = 0.618033988749895; // Reciprocal of golden ratio\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBA,oBAAuB;AACvB,yBAA2B;AAsBpB,SAAS,IAAI,OAAuC;AACzD,MAAI,iBAAiB,sBAAQ;AAC3B,UAAM,OAAO,MAAM;AACnB,UAAM,aAAa,MAAM,QAAQ;AACjC,UAAM,SAAS,KAAK;AAEpB,UAAM,SAAmB,CAAC;AAC1B,aAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC/B,YAAM,IAAI,WAAW,CAAC,KAAK;AAC3B,aAAO,KAAK,KAAK,IAAI,CAAC,CAAC;AAAA,IACzB;AAEA,WAAO,qBAAO,UAAU,MAAM,MAAM;AAAA,EACtC;AAEA,SAAO,KAAK,IAAI,KAAK;AACvB;AAwBO,SAAS,KAAK,OAAqC;AACxD,MAAI,iBAAiB,sBAAQ;AAC3B,UAAM,OAAO,MAAM;AACnB,UAAM,aAAa,MAAM,QAAQ;AACjC,UAAM,SAAS,KAAK;AAEpB,UAAM,SAAmB,CAAC;AAC1B,aAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC/B,YAAM,IAAI,WAAW,CAAC,KAAK;AAC3B,aAAO,KAAK,KAAK,KAAK,CAAC,CAAC;AAAA,IAC1B;AAEA,WAAO,q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iBAAO,KAAK,GAAG;AAAA,QACjB,OAAO;AACL,iBAAO,KAAK,KAAK,MAAM,IAAI,OAAO,IAAI,OAAO;AAAA,QAC/C;AAAA,MACF;AAAA,IACF;AAEA,WAAO,qBAAO,UAAU,MAAM,MAAM;AAAA,EACtC;AAGA,MAAI,MAAM,MAAM,GAAG;AACjB,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AAEA,MAAI,YAAY,GAAG;AACjB,WAAO;AAAA,EACT;AAGA,SAAO,KAAK,MAAM,SAAS,OAAO,IAAI;AACxC;AAGO,MAAM,KAAK,KAAK;AAChB,MAAM,IAAI,KAAK;AACf,MAAM,MAAM;AACZ,MAAM,OAAO;",
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["/**\n * Math namespace\n * Mirrors PineScript's math.* functions for mathematical operations and calculations.\n *\n * @remarks\n * All math functions in this namespace follow PineScript v6 API specifications.\n * Functions include basic arithmetic, algebraic operations, trigonometry, and combinatorics.\n *\n * Known difference: `log10`, `exp`, `log`, `pow`, `sin`, `cos`, `tan` use JavaScript's `Math`. PineScript uses\n * other algorithms, whose results differ by 1 or 2 units in the last place on part of the inputs (`log10` about 4 %,\n * `exp` about 9 %, `sin` / `cos` / `tan` about 3 %, `log` 0.4 %, `pow` 0.05 % of random inputs). This is visible\n * only when a script amplifies these tiny differences (e.g. `ma > ma[1]` on values of 1e195); `sqrt`, `atan`,\n * `asin`, `acos` are equal. A constant argument (`math.log10(2)`) is computed before the script runs, with other\n * rules: see `constant`.\n *\n * @version 6\n */\n\nimport type { float, int, simple_int, series_float } from '../types/index.js';\nimport { Series } from '../runtime/series.js';\nimport { runningSum, runningSumSeries } from '../ta/running-sum.js';\n\n/**\n * Returns the absolute value of a number.\n *\n * @param value - The number or Series\n * @returns The absolute value (always non-negative)\n *\n * @remarks\n * - Returns the distance from zero on the number line\n * - |x| = x if x \u2265 0, -x if x < 0\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.abs(5) // Returns: 5\n * math.abs(-5) // Returns: 5\n * math.abs(0) // Returns: 0\n * ```\n */\nexport function abs(value: Series): Series;\nexport function abs(value: float): float;\nexport function abs(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.abs(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.abs(value);\n}\n\n/**\n * Returns the smallest integer greater than or equal to a given number (rounds up).\n *\n * @param value - The number to round up or Series\n * @returns The ceiling value (smallest integer \u2265 value)\n *\n * @remarks\n * - Always rounds towards positive infinity\n * - For positive numbers, rounds away from zero\n * - For negative numbers, rounds towards zero\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.ceil(4.2) // Returns: 5\n * math.ceil(4.8) // Returns: 5\n * math.ceil(-4.2) // Returns: -4\n * math.ceil(5) // Returns: 5\n * ```\n */\nexport function ceil(value: Series): Series;\nexport function ceil(value: float): int;\nexport function ceil(value: float | Series): int | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.ceil(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.ceil(value);\n}\n\n/**\n * Returns the largest integer less than or equal to a given number (rounds down).\n *\n * @param value - The number to round down or Series\n * @returns The floor value (largest integer \u2264 value)\n *\n * @remarks\n * - Always rounds towards negative infinity\n * - For positive numbers, rounds towards zero\n * - For negative numbers, rounds away from zero\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.floor(4.2) // Returns: 4\n * math.floor(4.8) // Returns: 4\n * math.floor(-4.2) // Returns: -5\n * math.floor(5) // Returns: 5\n * ```\n */\nexport function floor(value: Series): Series;\nexport function floor(value: float): int;\nexport function floor(value: float | Series): int | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.floor(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.floor(value);\n}\n\n/**\n * Returns the value rounded to the nearest integer or to a specified precision.\n *\n * @param value - The number to round or Series\n * @param precision - Optional number of decimal places (default: 0)\n * @returns The rounded value\n *\n * @remarks\n * - Rounds to nearest integer by default\n * - With precision, rounds to that many decimal places\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * PineScript rules:\n * - ties go away from zero (2.5 -> 3, -2.5 -> -3, -0.5 -> -1)\n * - without a precision, or with a precision <= 0, the result is the integer rounding (1234.5678 @ -2 -> 1235)\n * - a positive precision rounds only the fraction: `int + round(frac * scale) / scale` with\n * `scale = 1 / 10^-precision` (precision above 16 acts as 16); the tie is decided on the exact value of\n * `frac * scale` with a 1e-10 tolerance (1.005 @ 2 -> 1.01, 0.285 @ 2 -> 0.29, -1.45 @ 1 -> -1.5)\n * - an infinite value gives na\n *\n * @example\n * ```typescript\n * math.round(4.2) // Returns: 4\n * math.round(4.5) // Returns: 5\n * math.round(-2.5) // Returns: -3\n * math.round(4.567, 2) // Returns: 4.57\n * math.round(1.005, 2) // Returns: 1.01\n * ```\n */\nexport function round(value: Series, precision?: int): Series;\nexport function round(value: float, precision?: int): float;\nexport function round(value: float | Series, precision?: int): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const result: number[] = [];\n for (let i = 0; i < bars.length; i++) {\n result.push(roundValue(valueArray[i] ?? NaN, precision));\n }\n return Series.fromArray(bars, result);\n }\n return roundValue(value, precision);\n}\n\n/** `0.5 - 1e-10` as the exact fraction TIE_HALF / TIE_SCALE: the tie threshold of round / round_to_mintick. */\nconst TIE_SCALE = 10n ** 10n;\nconst TIE_HALF = 5n * 10n ** 9n - 1n;\n/** From 2^52 up every double is an integer. */\nconst INT_LIMIT = 2 ** 52;\n\n/** Exact value of a finite double >= 0 as `[numerator, denominator]`. */\nfunction exactRatio(x: number): [bigint, bigint] {\n const view = new DataView(new ArrayBuffer(8));\n view.setFloat64(0, x);\n const hi = view.getUint32(0);\n const lo = view.getUint32(4);\n const expField = (hi >>> 20) & 0x7ff;\n let mantissa = (BigInt(hi & 0xfffff) << 32n) | BigInt(lo);\n let exp = -1074;\n if (expField !== 0) {\n mantissa |= 1n << 52n;\n exp = expField - 1075;\n }\n return exp >= 0 ? [mantissa << BigInt(exp), 1n] : [mantissa, 1n << BigInt(-exp)];\n}\n\n/** True when `num / den - units` (exact) is >= 0.5 - 1e-10. */\nfunction reachesTie(num: bigint, den: bigint, units: bigint): boolean {\n return (num - units * den) * TIE_SCALE >= TIE_HALF * den;\n}\n\n/** `10^-p`: the exact literal for an integer p (correctly rounded), Math.pow otherwise. */\nfunction tenToMinus(p: number): number {\n return Number.isInteger(p) ? Number(`1e-${p}`) : Math.pow(10, -p);\n}\n\n/** PineScript math.round of one value (see `round`). */\nfunction roundValue(value: number, precision?: number): number {\n if (!Number.isFinite(value)) return NaN;\n const negative = value < 0;\n const magnitude = negative ? -value : value;\n if (precision === undefined || Number.isNaN(precision) || precision <= 0) {\n if (magnitude >= INT_LIMIT) return value;\n let units = Math.floor(magnitude);\n if (magnitude - units >= 0.5) units++;\n return negative ? 0 - units : units;\n }\n const scale = 1 / tenToMinus(Math.min(precision, 16));\n const fraction = magnitude % 1;\n const scaled = fraction * scale;\n let units = Math.floor(scaled);\n const offset = scaled - units - 0.5;\n // Only a near-tie needs the exact product; the window covers the double's own error.\n const slack = 1e-9 + scaled * 1.8e-15;\n if (-slack < offset && offset < slack) {\n const [fn, fd] = exactRatio(fraction);\n const [sn, sd] = exactRatio(scale);\n if (reachesTie(fn * sn, fd * sd, BigInt(units))) units++;\n } else if (offset > 0) {\n units++;\n }\n const result = magnitude - fraction + units / scale;\n return negative ? 0 - result : result;\n}\n\n/** 10^16: a constant keeps 16 decimals. */\nconst CONSTANT_SCALE = 10n ** 16n;\n\n/**\n * Returns the value PineScript gives to a constant float expression (not a PineScript function).\n *\n * @param value - The result of the constant expression, computed in JavaScript (e.g. `1 / 255`)\n * @returns The value of the same expression in a PineScript script\n *\n * @remarks\n * PineScript computes a constant expression (only literals and constants: `1 / 255`, `0.1 * 3`,\n * `math.sqrt(0.1)`) before the script runs, and the value is then rounded. JavaScript cannot tell a constant from a\n * series value, so wrap the constant expressions of a script with this function.\n * - |value| >= 0.001: the exact value of the double is rounded to 16 decimals, ties to even\n * (`1 / 255` -> 0.003921568627451, `1 / 7` -> 0.1428571428571428)\n * - |value| < 0.001, na and infinities: unchanged\n * - the whole expression is computed first, then rounded once (`(1 / 7) * 7` is 1)\n * - math functions of constants use JavaScript's `Math` there: `math.constant(math.sqrt(0.1))` is the PineScript\n * value; `math.log10` of a constant is `math.log(x) / math.log(10)` there:\n * `math.constant(math.log(2) / math.log(10))` -> 0.3010299956639811\n * - the same expression with a series operand (`close / 255`) is not rounded: do not wrap it\n *\n * @example\n * ```typescript\n * // Pine: var const float i_255 = 1 / 255\n * const i_255 = math.constant(1 / 255) // 0.003921568627451 (JavaScript: 0.00392156862745098)\n * math.constant(1 / 7) // 0.1428571428571428 (JavaScript: 0.14285714285714285)\n * math.constant(1 / 3) // 0.3333333333333333 (unchanged)\n * ```\n */\nexport function constant(value: float): float {\n const magnitude = Math.abs(value);\n // from 0.5 up, 16 decimals move a double by less than half its spacing: it stays the same\n if (!(magnitude >= 1e-3 && magnitude < 0.5)) return value;\n const [num, den] = exactRatio(magnitude);\n const scaled = num * CONSTANT_SCALE;\n let units = scaled / den;\n const twiceRest = (scaled - units * den) * 2n;\n if (twiceRest > den || (twiceRest === den && (units & 1n) === 1n)) units++;\n const digits = units.toString().padStart(17, '0');\n const result = Number(`${digits.slice(0, -16)}.${digits.slice(-16)}`);\n return value < 0 ? -result : result;\n}\n\n/**\n * Returns the maximum value from the arguments.\n *\n * @param values - Variable number of values to compare (numbers or Series)\n * @returns The largest value\n *\n * @remarks\n * - Accepts any number of arguments\n * - Returns -Infinity if no arguments provided\n * - Returns NaN if any argument is NaN\n * - If any argument is a Series, returns a Series; otherwise returns a number\n *\n * @example\n * ```typescript\n * math.max(1, 2, 3) // Returns: 3\n * math.max(-1, -5, -2) // Returns: -1\n * math.max(10) // Returns: 10\n * math.max(5, 10, 3, 8) // Returns: 10\n * ```\n */\nexport function max(...values: (float | Series)[]): float | Series {\n // Check if any value is a Series\n const hasSeries = values.some(v => v instanceof Series);\n \n if (!hasSeries) {\n // All scalars - use native Math.max\n return Math.max(...(values as number[]));\n }\n \n // At least one Series - return a Series\n const firstSeries = values.find(v => v instanceof Series) as Series;\n const bars = firstSeries.bars;\n const length = bars.length;\n \n // Convert all values to arrays (scalars become constant arrays)\n const valueArrays = values.map(v => \n v instanceof Series ? v.toArray() : null\n );\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const nums = values.map((v, idx) => \n valueArrays[idx] ? valueArrays[idx]![i] ?? NaN : (v as number)\n );\n result.push(Math.max(...nums));\n }\n \n return Series.fromArray(bars, result);\n}\n\n/**\n * Returns the minimum value from the arguments.\n *\n * @param values - Variable number of values to compare (numbers or Series)\n * @returns The smallest value\n *\n * @remarks\n * - Accepts any number of arguments\n * - Returns Infinity if no arguments provided\n * - Returns NaN if any argument is NaN\n * - If any argument is a Series, returns a Series; otherwise returns a number\n *\n * @example\n * ```typescript\n * math.min(1, 2, 3) // Returns: 1\n * math.min(-1, -5, -2) // Returns: -5\n * math.min(10) // Returns: 10\n * math.min(5, 10, 3, 8) // Returns: 3\n * ```\n */\nexport function min(...values: (float | Series)[]): float | Series {\n // Check if any value is a Series\n const hasSeries = values.some(v => v instanceof Series);\n \n if (!hasSeries) {\n // All scalars - use native Math.min\n return Math.min(...(values as number[]));\n }\n \n // At least one Series - return a Series\n const firstSeries = values.find(v => v instanceof Series) as Series;\n const bars = firstSeries.bars;\n const length = bars.length;\n \n // Convert all values to arrays (scalars become constant arrays)\n const valueArrays = values.map(v => \n v instanceof Series ? v.toArray() : null\n );\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const nums = values.map((v, idx) => \n valueArrays[idx] ? valueArrays[idx]![i] ?? NaN : (v as number)\n );\n result.push(Math.min(...nums));\n }\n \n return Series.fromArray(bars, result);\n}\n\n/**\n * Returns the average (arithmetic mean) of the arguments.\n *\n * @param values - Variable number of values (numbers or Series)\n * @returns The arithmetic mean\n *\n * @remarks\n * - Calculates sum of all values divided by count\n * - Returns NaN if no arguments provided (division by zero)\n * - If any argument is a Series, returns a Series; otherwise returns a number\n * - PineScript rule: with 1 or 2 values the sum is plain; with 3 values or more it is a Kahan compensated sum whose\n * pending correction is subtracted before the division (math.avg(0.1, 0.2, 0.3) = 0.19999999999999998)\n *\n * @example\n * ```typescript\n * math.avg(1, 2, 3) // Returns: 2\n * math.avg(10, 20) // Returns: 15\n * math.avg(5) // Returns: 5\n * math.avg(1, 2, 3, 4, 5) // Returns: 3\n * ```\n */\nexport function avg(...values: (float | Series)[]): float | Series {\n // Check if any value is a Series\n const hasSeries = values.some(v => v instanceof Series);\n\n if (!hasSeries) {\n return avgOf(values as number[]);\n }\n \n // At least one Series - return a Series\n const firstSeries = values.find(v => v instanceof Series) as Series;\n const bars = firstSeries.bars;\n const length = bars.length;\n \n // Convert all values to arrays (scalars become constant arrays)\n const valueArrays = values.map(v => \n v instanceof Series ? v.toArray() : null\n );\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const nums = values.map((v, idx) => \n valueArrays[idx] ? valueArrays[idx]![i] ?? NaN : (v as number)\n );\n result.push(avgOf(nums));\n }\n\n return Series.fromArray(bars, result);\n}\n\n/** PineScript math.avg of numbers: plain sum up to 2 values, Kahan sum with the correction flushed from 3. */\nfunction avgOf(nums: number[]): number {\n if (nums.length <= 2) {\n let sum = 0;\n for (const n of nums) sum = sum + n;\n return sum / nums.length;\n }\n let sum = 0;\n let c = 0;\n for (const n of nums) {\n const y = n - c;\n const t = sum + y;\n c = t - sum - y;\n sum = t;\n }\n return (sum - c) / nums.length;\n}\n\n/**\n * Returns the sum of values over a sliding window.\n *\n * @param source - Series of values or array\n * @param length - Window length for summation, or one length per bar (a series length: array or Series)\n * @returns Series or array with rolling sum values\n *\n * @remarks\n * - Calculates the sum of the last `length` non-`na` values at each point; an `na` value (also +/-Infinity) is\n * skipped and the bar keeps the previous result (as in PineScript)\n * - Returns NaN until `length` non-`na` values are available\n * - A compensated running sum, as in PineScript, so the result can differ from the exact window sum in the last\n * bits (bit for bit with PineScript)\n * - When passed a Series, returns a Series; when passed an array, returns an array\n * - With a series length, PineScript moves the running sum to the new length when the length changes, with Kahan\n * steps of the raw values: a smaller length removes the values that leave the window (oldest first); a larger\n * length adds back the values from the one before the old window down to the one `length` values back (newest\n * first), then the usual step removes the stored value of the one `length` values back. A bar with an `na` value\n * gives the sum of the last `length` earlier values\n *\n * @example\n * ```typescript\n * math.sum([1, 2, 3, 4, 5], 3) // Returns: [NaN, NaN, 6, 9, 12]\n * // Explanation: [NaN, NaN, 1+2+3, 2+3+4, 3+4+5]\n * ```\n */\nexport function sum(source: Series, length: simple_int | ArrayLike<number> | Series): Series;\nexport function sum(source: series_float, length: simple_int | ArrayLike<number> | Series): series_float;\nexport function sum(\n source: series_float | Series,\n length: simple_int | ArrayLike<number> | Series\n): series_float | Series {\n // Handle Series objects - extract to array first\n const sourceArray = source instanceof Series ? source.toArray() : source;\n // PineScript: the sum of the last `length` non-na values (also +/-Infinity skipped); an na bar keeps the previous\n // result. A compensated running sum, bit for bit as PineScript.\n const result: series_float =\n typeof length === 'number'\n ? runningSum(sourceArray, length)\n : runningSumSeries(sourceArray, length instanceof Series ? length.toArray() : length, 'math.sum');\n\n // If input was a Series, return a Series\n if (source instanceof Series) {\n return Series.fromArray(source.bars, result);\n }\n\n return result;\n}\n\n/**\n * Returns the square root of a number.\n *\n * @param value - The number (must be non-negative) or Series\n * @returns The square root (\u221Avalue)\n *\n * @remarks\n * - Returns NaN for negative numbers\n * - \u221Ax \u00D7 \u221Ax = x (for non-negative x)\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.sqrt(9) // Returns: 3\n * math.sqrt(16) // Returns: 4\n * math.sqrt(2) // Returns: 1.414...\n * math.sqrt(0) // Returns: 0\n * ```\n */\nexport function sqrt(value: Series): Series;\nexport function sqrt(value: float): float;\nexport function sqrt(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.sqrt(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.sqrt(value);\n}\n\n/**\n * Returns base raised to the power of exponent.\n *\n * @param base - The base number or Series\n * @param exponent - The exponent (power) or Series\n * @returns base^exponent\n *\n * @remarks\n * - 0^0 returns 1\n * - Negative base with fractional exponent returns NaN\n * - Any number to the power of 0 equals 1\n * - If any argument is a Series, returns a Series; if all are numbers, returns a number\n *\n * @example\n * ```typescript\n * math.pow(2, 3) // Returns: 8 (2\u00B3)\n * math.pow(10, 2) // Returns: 100\n * math.pow(5, 0) // Returns: 1\n * math.pow(2, -1) // Returns: 0.5\n * ```\n */\nexport function pow(base: Series, exponent: float): Series;\nexport function pow(base: float, exponent: Series): Series;\nexport function pow(base: Series, exponent: Series): Series;\nexport function pow(base: float, exponent: float): float;\nexport function pow(base: float | Series, exponent: float | Series): float | Series {\n const baseIsSeries = base instanceof Series;\n const expIsSeries = exponent instanceof Series;\n \n // Pure scalar case\n if (!baseIsSeries && !expIsSeries) {\n return Math.pow(base as number, exponent as number);\n }\n \n // At least one is a Series - return a Series\n const bars = baseIsSeries ? (base as Series).bars : (exponent as Series).bars;\n const baseArray = baseIsSeries ? (base as Series).toArray() : null;\n const expArray = expIsSeries ? (exponent as Series).toArray() : null;\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const b = baseArray ? baseArray[i] ?? NaN : (base as number);\n const e = expArray ? expArray[i] ?? NaN : (exponent as number);\n result.push(Math.pow(b, e));\n }\n \n return Series.fromArray(bars, result);\n}\n\n/**\n * Returns e (Euler's number) raised to the power of value.\n *\n * @param value - The exponent or Series\n * @returns e^value (where e \u2248 2.71828)\n *\n * @remarks\n * - e^0 = 1\n * - e^1 = e \u2248 2.71828\n * - Inverse of ln(x)\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.exp(0) // Returns: 1\n * math.exp(1) // Returns: 2.71828... (e)\n * math.exp(2) // Returns: 7.389...\n * math.exp(-1) // Returns: 0.3678...\n * ```\n */\nexport function exp(value: Series): Series;\nexport function exp(value: float): float;\nexport function exp(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.exp(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.exp(value);\n}\n\n/**\n * Returns the natural logarithm (base e) of a number.\n *\n * @param value - The number (must be positive) or Series\n * @returns ln(value)\n *\n * @remarks\n * - Returns NaN for negative numbers\n * - Returns -Infinity for 0\n * - ln(e) = 1\n * - ln(1) = 0\n * - Inverse of exp(x)\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.log(1) // Returns: 0\n * math.log(Math.E) // Returns: 1\n * math.log(10) // Returns: 2.302...\n * math.log(100) // Returns: 4.605...\n * ```\n */\nexport function log(value: Series): Series;\nexport function log(value: float): float;\nexport function log(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.log(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.log(value);\n}\n\n/**\n * Returns the base-10 logarithm of a number.\n *\n * @param value - The number (must be positive) or Series\n * @returns log\u2081\u2080(value)\n *\n * @remarks\n * - Returns NaN for negative numbers\n * - Returns -Infinity for 0\n * - log\u2081\u2080(10) = 1\n * - log\u2081\u2080(100) = 2\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.log10(10) // Returns: 1\n * math.log10(100) // Returns: 2\n * math.log10(1000) // Returns: 3\n * math.log10(1) // Returns: 0\n * ```\n */\nexport function log10(value: Series): Series;\nexport function log10(value: float): float;\nexport function log10(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.log10(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.log10(value);\n}\n\n/**\n * Returns the sine of an angle in radians.\n *\n * @param value - The angle in radians or Series\n * @returns The sine value (range: [-1, 1])\n *\n * @remarks\n * - Input is in radians, not degrees\n * - sin(0) = 0\n * - sin(\u03C0/2) = 1\n * - Periodic with period 2\u03C0\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.sin(0) // Returns: 0\n * math.sin(Math.PI / 2) // Returns: 1\n * math.sin(Math.PI) // Returns: 0 (approximately)\n * math.sin(Math.PI / 6) // Returns: 0.5\n * ```\n */\nexport function sin(value: Series): Series;\nexport function sin(value: float): float;\nexport function sin(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.sin(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.sin(value);\n}\n\n/**\n * Returns the cosine of an angle in radians.\n *\n * @param value - The angle in radians or Series\n * @returns The cosine value (range: [-1, 1])\n *\n * @remarks\n * - Input is in radians, not degrees\n * - cos(0) = 1\n * - cos(\u03C0/2) = 0\n * - Periodic with period 2\u03C0\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.cos(0) // Returns: 1\n * math.cos(Math.PI / 2) // Returns: 0 (approximately)\n * math.cos(Math.PI) // Returns: -1\n * math.cos(Math.PI / 3) // Returns: 0.5\n * ```\n */\nexport function cos(value: Series): Series;\nexport function cos(value: float): float;\nexport function cos(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.cos(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.cos(value);\n}\n\n/**\n * Returns the tangent of an angle in radians.\n *\n * @param value - The angle in radians or Series\n * @returns The tangent value\n *\n * @remarks\n * - Input is in radians, not degrees\n * - tan(x) = sin(x) / cos(x)\n * - Undefined at \u03C0/2, 3\u03C0/2, etc. (returns very large numbers)\n * - Periodic with period \u03C0\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.tan(0) // Returns: 0\n * math.tan(Math.PI / 4) // Returns: 1\n * math.tan(Math.PI / 6) // Returns: 0.577... (1/\u221A3)\n * ```\n */\nexport function tan(value: Series): Series;\nexport function tan(value: float): float;\nexport function tan(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.tan(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.tan(value);\n}\n\n/**\n * Returns the arcsine (inverse sine) of a number.\n *\n * @param value - The value (must be in range [-1, 1]) or Series\n * @returns The angle in radians (range: [-\u03C0/2, \u03C0/2])\n *\n * @remarks\n * - Returns NaN for values outside [-1, 1]\n * - asin(sin(x)) = x for x in [-\u03C0/2, \u03C0/2]\n * - asin(0) = 0\n * - asin(1) = \u03C0/2\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.asin(0) // Returns: 0\n * math.asin(1) // Returns: 1.5707... (\u03C0/2)\n * math.asin(0.5) // Returns: 0.5235... (\u03C0/6)\n * math.asin(-1) // Returns: -1.5707... (-\u03C0/2)\n * ```\n */\nexport function asin(value: Series): Series;\nexport function asin(value: float): float;\nexport function asin(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.asin(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.asin(value);\n}\n\n/**\n * Returns the arccosine (inverse cosine) of a number.\n *\n * @param value - The value (must be in range [-1, 1]) or Series\n * @returns The angle in radians (range: [0, \u03C0])\n *\n * @remarks\n * - Returns NaN for values outside [-1, 1]\n * - acos(cos(x)) = x for x in [0, \u03C0]\n * - acos(1) = 0\n * - acos(0) = \u03C0/2\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.acos(1) // Returns: 0\n * math.acos(0) // Returns: 1.5707... (\u03C0/2)\n * math.acos(0.5) // Returns: 1.0471... (\u03C0/3)\n * math.acos(-1) // Returns: 3.1415... (\u03C0)\n * ```\n */\nexport function acos(value: Series): Series;\nexport function acos(value: float): float;\nexport function acos(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.acos(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.acos(value);\n}\n\n/**\n * Returns the arctangent (inverse tangent) of a number.\n *\n * @param value - The value or Series\n * @returns The angle in radians (range: [-\u03C0/2, \u03C0/2])\n *\n * @remarks\n * - Accepts any number as input\n * - atan(tan(x)) = x for x in [-\u03C0/2, \u03C0/2]\n * - atan(0) = 0\n * - atan(1) = \u03C0/4\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.atan(0) // Returns: 0\n * math.atan(1) // Returns: 0.7853... (\u03C0/4)\n * math.atan(-1) // Returns: -0.7853... (-\u03C0/4)\n * math.atan(Infinity) // Returns: 1.5707... (\u03C0/2)\n * ```\n */\nexport function atan(value: Series): Series;\nexport function atan(value: float): float;\nexport function atan(value: float | Series): float | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(Math.atan(v));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return Math.atan(value);\n}\n\n/**\n * Converts an angle from degrees to radians.\n *\n * @param degrees - The angle in degrees or Series\n * @returns The angle in radians\n *\n * @remarks\n * - Radians = Degrees \u00D7 (\u03C0 / 180)\n * - One full rotation: 360\u00B0 = 2\u03C0 radians\n * - Common conversions: 90\u00B0 = \u03C0/2, 180\u00B0 = \u03C0, 270\u00B0 = 3\u03C0/2\n * - If degrees is a Series, returns a Series; if degrees is a number, returns a number\n *\n * @example\n * ```typescript\n * math.toradians(0) // Returns: 0\n * math.toradians(90) // Returns: 1.5707... (\u03C0/2)\n * math.toradians(180) // Returns: 3.1415... (\u03C0)\n * math.toradians(360) // Returns: 6.2831... (2\u03C0)\n * ```\n */\nexport function toradians(degrees: Series): Series;\nexport function toradians(degrees: float): float;\nexport function toradians(degrees: float | Series): float | Series {\n if (degrees instanceof Series) {\n const bars = degrees.bars;\n const valueArray = degrees.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(v * (Math.PI / 180));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return degrees * (Math.PI / 180);\n}\n\n/**\n * Converts an angle from radians to degrees.\n *\n * @param radians - The angle in radians or Series\n * @returns The angle in degrees\n *\n * @remarks\n * - Degrees = Radians \u00D7 (180 / \u03C0)\n * - One full rotation: 2\u03C0 radians = 360\u00B0\n * - Common conversions: \u03C0/2 = 90\u00B0, \u03C0 = 180\u00B0, 3\u03C0/2 = 270\u00B0\n * - If radians is a Series, returns a Series; if radians is a number, returns a number\n *\n * @example\n * ```typescript\n * math.todegrees(0) // Returns: 0\n * math.todegrees(Math.PI / 2) // Returns: 90\n * math.todegrees(Math.PI) // Returns: 180\n * math.todegrees(2 * Math.PI) // Returns: 360\n * ```\n */\nexport function todegrees(radians: Series): Series;\nexport function todegrees(radians: float): float;\nexport function todegrees(radians: float | Series): float | Series {\n if (radians instanceof Series) {\n const bars = radians.bars;\n const valueArray = radians.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(v * (180 / Math.PI));\n }\n \n return Series.fromArray(bars, result);\n }\n \n return radians * (180 / Math.PI);\n}\n\n/**\n * PineScript's seeded generator: Java's linear congruential generator (`java.util.Random`), `nextDouble()`.\n * Each generator draws one number per call.\n */\nexport function seededRandom(seed: int): (min?: float, max?: float) => float {\n const mask = (1n << 48n) - 1n;\n let state = (BigInt(Math.trunc(seed)) ^ 0x5deece66dn) & mask;\n const next = (bits: bigint): bigint => {\n state = (0x5deece66dn * state + 11n) & mask;\n return state >> (48n - bits);\n };\n return (min = 0, max = 1) => {\n const hi = next(26n);\n const lo = next(27n);\n const unit = Number((hi << 27n) + lo) / 2 ** 53;\n return min + unit * (max - min);\n };\n}\n\nconst seeded = new Map<number, (min?: float, max?: float) => float>();\n\n/** Starts every seeded sequence of `math.random` again (called at the start of a script run). */\nexport function resetRandom(): void {\n seeded.clear();\n}\n\n/**\n * Returns a pseudo-random number.\n *\n * @param min - Optional minimum value (inclusive), default 0\n * @param max - Optional maximum value (exclusive), default 1\n * @param seed - Optional seed: a repeatable sequence, as PineScript (Java's `java.util.Random`)\n * @returns A random number in the specified range, or [0, 1) if no range specified\n *\n * @remarks\n * - Without a seed: `Math.random()`\n * - With a seed: PineScript's sequence, one number per call (measured: the call on each bar draws the next number\n * of `new java.util.Random(seed).nextDouble()` from the first bar of the history). PineScript keeps one generator\n * per call site; here there is one generator per seed value (started again by `executeScript`): for two call sites\n * with the same seed use `callsite.random(seed)`\n *\n * @example\n * ```typescript\n * math.random() // Returns: value between 0 and 1 (e.g., 0.234...)\n * math.random(0, 10) // Returns: value between 0 and 10 (e.g., 7.45...)\n * math.random(0, 1, 42) // Returns: 0.7275636800328681 on the first call, as PineScript\n * ```\n */\nexport function random(min?: float, max?: float, seed?: int): float {\n if (seed !== undefined && seed !== null && !Number.isNaN(seed)) {\n let gen = seeded.get(seed);\n if (!gen) {\n gen = seededRandom(seed);\n seeded.set(seed, gen);\n }\n return gen(min ?? 0, max ?? 1);\n }\n const rand = Math.random();\n if (min !== undefined && max !== undefined) {\n return min + rand * (max - min);\n }\n return rand;\n}\n\n/**\n * Returns the sign of a number.\n *\n * @param value - The number to check or Series\n * @returns 1 for positive, -1 for negative, 0 for zero, na for na\n *\n * @remarks\n * - Returns 1 if value > 0\n * - Returns -1 if value < 0\n * - Returns 0 if value = 0\n * - Returns na if value is na (as PineScript)\n * - Useful for determining direction or polarity\n * - If value is a Series, returns a Series; if value is a number, returns a number\n *\n * @example\n * ```typescript\n * math.sign(5) // Returns: 1\n * math.sign(-3) // Returns: -1\n * math.sign(0) // Returns: 0\n * math.sign(0.001) // Returns: 1\n * math.sign(NaN) // Returns: NaN\n * ```\n */\nexport function sign(value: Series): Series;\nexport function sign(value: float): int;\nexport function sign(value: float | Series): int | Series {\n if (value instanceof Series) {\n const bars = value.bars;\n const valueArray = value.toArray();\n const length = bars.length;\n \n const result: number[] = [];\n for (let i = 0; i < length; i++) {\n const v = valueArray[i] ?? NaN;\n result.push(v > 0 ? 1 : v < 0 ? -1 : v === 0 ? 0 : NaN);\n }\n \n return Series.fromArray(bars, result);\n }\n \n return value > 0 ? 1 : value < 0 ? -1 : value === 0 ? 0 : NaN;\n}\n\n/**\n * Rounds a value to the nearest mintick.\n *\n * @param number - The number to round or Series\n * @param mintick - Optional mintick value (defaults to requiring syminfo context)\n * @returns The number rounded to tick precision\n *\n * @remarks\n * - **PineScript v6 signature**: `math.round_to_mintick(number)` - uses implicit syminfo.mintick\n * - **JavaScript signature**: Requires explicit `mintick` OR use `createContext()` with syminfo\n * - Rounds to the nearest value divisible by mintick\n * - Returns NaN for NaN input\n * - If number is a Series, returns a Series; if number is a float, returns a float\n *\n * PineScript rules:\n * - mintick is `minmove / pricescale` (here rebuilt from `mintick`: the smallest power of 10 that makes it an\n * integer); the position on the tick grid is `|number| * pricescale / minmove`\n * - ties go away from zero, decided on the exact value of that product with a 1e-10 tolerance\n * (-1.075 -> -1.08, 1.005 -> 1.01, 2.675 -> 2.68 at mintick 0.01)\n *\n * @example\n * ```typescript\n * // Direct call with explicit mintick\n * const rounded = math.round_to_mintick(1.2345, 0.01); // Returns: 1.23\n * const rounded2 = math.round_to_mintick(1.2367, 0.01); // Returns: 1.24\n *\n * // Or use context API for cleaner syntax\n * const { math } = createContext({ syminfo: { mintick: 0.01 } });\n * const rounded = math.round_to_mintick(1.2345); // Returns: 1.23\n * ```\n */\nexport function round_to_mintick(number: Series, mintick?: float): Series;\nexport function round_to_mintick(number: float, mintick?: float): float;\nexport function round_to_mintick(number: float | Series, mintick?: float): float | Series {\n if (number instanceof Series) {\n const bars = number.bars;\n const valueArray = number.toArray();\n if (mintick === undefined) {\n throw new Error(\n 'math.round_to_mintick() requires mintick value. ' +\n 'Either pass it explicitly or use createContext({ syminfo: { mintick } }) for implicit data.'\n );\n }\n const result: number[] = [];\n for (let i = 0; i < bars.length; i++) {\n result.push(roundToTick(valueArray[i] ?? NaN, mintick));\n }\n return Series.fromArray(bars, result);\n }\n\n // Scalar case\n if (isNaN(number)) {\n return NaN;\n }\n\n if (mintick === undefined) {\n throw new Error(\n 'math.round_to_mintick() requires mintick value. ' +\n 'Either pass it explicitly or use createContext({ syminfo: { mintick } }) for implicit data.'\n );\n }\n return roundToTick(number, mintick);\n}\n\n/** `[minmove, pricescale]` of a mintick: pricescale is the smallest power of 10 (up to 1e15) giving an integer. */\nfunction tickPair(mintick: number): [number, number] | null {\n for (let k = 0; k <= 15; k++) {\n const pricescale = Number(`1e${k}`);\n const scaled = mintick * pricescale;\n const minmove = Math.round(scaled);\n if (minmove >= 1 && Math.abs(scaled - minmove) <= 1e-9 * minmove) return [minmove, pricescale];\n }\n return null;\n}\n\n/** PineScript math.round_to_mintick of one value (see `round_to_mintick`). */\nfunction roundToTick(number: number, mintick: number): number {\n if (!Number.isFinite(number)) return NaN;\n if (mintick === 0) return number;\n const pair = tickPair(mintick);\n const negative = number < 0;\n const magnitude = negative ? -number : number;\n if (pair === null) {\n // A tick that is no decimal fraction: the grid of the double mintick, ties away from zero.\n const scaled = magnitude / mintick;\n let units = Math.trunc(scaled);\n if (scaled - units >= 0.5) units++;\n return (negative ? 0 - units : units) * mintick;\n }\n const [minmove, pricescale] = pair;\n const scaled = (magnitude * pricescale) / minmove;\n let units = Math.trunc(scaled);\n const offset = scaled - units - 0.5;\n const slack = 1e-6 + scaled * 1.8e-15;\n if (-slack < offset && offset < slack) {\n const [n, d] = exactRatio(magnitude);\n const num = n * BigInt(pricescale);\n const den = d * BigInt(minmove);\n const whole = num / den;\n units = Number(whole) + (reachesTie(num, den, whole) ? 1 : 0);\n } else if (offset > 0) {\n units++;\n }\n return ((negative ? 0 - units : units) * minmove) / pricescale;\n}\n\n// Constants\nexport const pi = Math.PI;\nexport const e = Math.E;\nexport const phi = 1.618033988749895; // Golden ratio\nexport const rphi = 0.6180339887498948; // Reciprocal of golden ratio: 1 / phi\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;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KAAK,KAAK,WAAW,KAAK,KAAK,KAAK,IAAI,IAAI;AAAA,EAC7D,WAAW,SAAS,GAAG;AACrB;AAAA,EACF;AACA,UAAS,WAAW,IAAI,QAAQ,SAAS,UAAW;AACtD;AAGO,MAAM,KAAK,KAAK;AAChB,MAAM,IAAI,KAAK;AACf,MAAM,MAAM;AACZ,MAAM,OAAO;",
|
|
6
|
+
"names": ["exp", "units", "sum", "e", "min", "max", "scaled"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/matrix/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE7F;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,UAAU,EACnB,aAAa,CAAC,EAAE,CAAC,GAChB,UAAU,CAAC,CAAC,CAAC,CAUf;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/matrix/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE7F;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,UAAU,EACnB,aAAa,CAAC,EAAE,CAAC,GA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