smath 1.13.2 → 1.13.3

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/bin.js CHANGED
@@ -148,6 +148,7 @@ switch (func) {
148
148
  break;
149
149
  }
150
150
  case ('tohex'): {
151
+ console.warn('toHex() is deprecated!');
151
152
  console.log(SMath.toHex(nums[0], (_e = nums[1]) !== null && _e !== void 0 ? _e : 0));
152
153
  break;
153
154
  }
package/dist/index.js CHANGED
@@ -55,10 +55,8 @@ exports.toHex = toHex;
55
55
  * @param epsilon Maximum absolute error
56
56
  * @returns True if `a` is approximately `b`
57
57
  * @example
58
- * ```js
59
58
  * const b1 = SMath.approx(1 / 3, 0.33, 1e-6), // false
60
59
  * b2 = SMath.approx(1 / 3, 0.33, 1e-2); // true
61
- * ```
62
60
  */
63
61
  function approx(a, b, epsilon) {
64
62
  if (epsilon === void 0) { epsilon = 1e-6; }
@@ -71,10 +69,8 @@ function approx(a, b, epsilon) {
71
69
  * @param max The maximum value of the range
72
70
  * @returns A clamped number
73
71
  * @example
74
- * ```js
75
72
  * const n1 = SMath.clamp(5, 0, 10), // 5
76
73
  * n2 = SMath.clamp(-2, 0, 10); // 0
77
- * ```
78
74
  */
79
75
  function clamp(n, min, max) {
80
76
  if (n < min) {
@@ -92,9 +88,7 @@ function clamp(n, min, max) {
92
88
  * @param max The maximum value in the range
93
89
  * @returns A normalized value
94
90
  * @example
95
- * ```js
96
91
  * const y = SMath.normalize(18, 9, 99); // 0.1
97
- * ```
98
92
  */
99
93
  function normalize(n, min, max) {
100
94
  if (min === max) {
@@ -109,9 +103,7 @@ function normalize(n, min, max) {
109
103
  * @param max The maximum value in the range
110
104
  * @returns A value within the number range
111
105
  * @example
112
- * ```js
113
106
  * const y = SMath.expand(0.25, 4, 6); // 4.5
114
- * ```
115
107
  */
116
108
  function expand(n, min, max) {
117
109
  return (max - min) * n + min;
@@ -125,10 +117,8 @@ function expand(n, min, max) {
125
117
  * @param max2 The maximum value for the final range
126
118
  * @returns A translated number in the final range
127
119
  * @example
128
- * ```js
129
120
  * const C = 20,
130
121
  * F = SMath.translate(C, 0, 100, 32, 212); // 68
131
- * ```
132
122
  */
133
123
  function translate(n, min1, max1, min2, max2) {
134
124
  return expand(normalize(n, min1, max1), min2, max2);
@@ -140,10 +130,8 @@ function translate(n, min1, max1, min2, max2) {
140
130
  * @param count The number of values in the space
141
131
  * @returns The linear space as an array of numbers
142
132
  * @example
143
- * ```js
144
133
  * const space = SMath.linspace(1, 5, 6);
145
134
  * // [ 1, 1.8, 2.6, 3.4, 4.2, 5 ]
146
- * ```
147
135
  */
148
136
  function linspace(min, max, count) {
149
137
  var space = [];
@@ -159,10 +147,8 @@ function linspace(min, max, count) {
159
147
  * @param count The number of values in the space
160
148
  * @returns The logarithmic space as an array of numbers
161
149
  * @example
162
- * ```js
163
150
  * const space = SMath.logspace(0, 2, 5);
164
151
  * // [ 1, 3.2, 10, 31.6, 100 ]
165
- * ```
166
152
  */
167
153
  function logspace(min, max, count) {
168
154
  return linspace(min, max, count).map(function (n) { return Math.pow(10, n); });
@@ -172,9 +158,7 @@ function logspace(min, max, count) {
172
158
  * @param n Any positive integer
173
159
  * @returns `n!`
174
160
  * @example
175
- * ```js
176
161
  * const y = SMath.factorial(5); // 120
177
- * ```
178
162
  */
179
163
  function factorial(n) {
180
164
  if (n < 0 || (n | 0) !== n) {
@@ -195,9 +179,7 @@ function factorial(n) {
195
179
  * @param n Any positive integer
196
180
  * @returns The array of prime factors
197
181
  * @example
198
- * ```js
199
182
  * const y = SMath.factors(12); // [ 2, 2, 3 ]
200
- * ```
201
183
  */
202
184
  function factors(n) {
203
185
  if (n < 0 || (n | 0) !== n) {
@@ -226,9 +208,7 @@ function factors(n) {
226
208
  * @param base Any base to round to
227
209
  * @returns `n` rounded to the nearest multiple of `base`
228
210
  * @example
229
- * ```js
230
211
  * const y = SMath.round2(Math.PI, 0.2); // 3.2
231
- * ```
232
212
  */
233
213
  function round2(n, base) {
234
214
  var rounded = base ? base * Math.round(n / base) : n;
@@ -246,9 +226,7 @@ function round2(n, base) {
246
226
  * @param actual The accepted or theoretical value
247
227
  * @returns The relative (normalized) error
248
228
  * @example
249
- * ```js
250
229
  * const e = SMath.error(22.5, 25); // -0.1
251
- * ```
252
230
  */
253
231
  function error(experimental, actual) {
254
232
  return (experimental - actual) / actual;
@@ -259,9 +237,7 @@ function error(experimental, actual) {
259
237
  * @param data An array of numeric inputs
260
238
  * @returns The sum total
261
239
  * @example
262
- * ```js
263
240
  * const y = SMath.sum([1, 2, 3]); // 6
264
- * ```
265
241
  */
266
242
  function sum(data) {
267
243
  return data.reduce(function (a, b) { return a + b; }, 0);
@@ -272,9 +248,7 @@ function sum(data) {
272
248
  * @param data An array of numeric inputs
273
249
  * @returns The product
274
250
  * @example
275
- * ```js
276
251
  * const y = SMath.prod([2, 2, 3, 5]); // 60
277
- * ```
278
252
  */
279
253
  function prod(data) {
280
254
  return data.reduce(function (a, b) { return a * b; }, 1);
@@ -284,9 +258,7 @@ function prod(data) {
284
258
  * @param data An array of numeric inputs
285
259
  * @returns The average, or mean
286
260
  * @example
287
- * ```js
288
261
  * const y = SMath.avg([1, 2, 4, 4]); // 2.75
289
- * ```
290
262
  */
291
263
  function avg(data) {
292
264
  return sum(data) / data.length;
@@ -296,9 +268,7 @@ function avg(data) {
296
268
  * @param data An array of numeric inputs
297
269
  * @returns The median of the dataset
298
270
  * @example
299
- * ```js
300
271
  * const y = SMath.median([2, 5, 3, 1]); // 2.5
301
- * ```
302
272
  */
303
273
  function median(data) {
304
274
  data.sort(function (a, b) { return a - b; });
@@ -312,9 +282,7 @@ function median(data) {
312
282
  * @param data An array of numeric inputs
313
283
  * @returns The population variance
314
284
  * @example
315
- * ```js
316
285
  * const y = SMath.varp([1, 2, 4, 4]); // 1.6875
317
- * ```
318
286
  */
319
287
  function varp(data) {
320
288
  var mean = avg(data), squares = data.map(function (x) { return Math.pow((x - mean), 2); });
@@ -325,9 +293,7 @@ function varp(data) {
325
293
  * @param data An array of numeric inputs
326
294
  * @returns The sample variance
327
295
  * @example
328
- * ```js
329
296
  * const y = SMath.vars([1, 2, 4, 4]); // 2.25
330
- * ```
331
297
  */
332
298
  function vars(data) {
333
299
  var mean = avg(data), squares = data.map(function (x) { return Math.pow((x - mean), 2); });
@@ -338,9 +304,7 @@ function vars(data) {
338
304
  * @param data An array of numeric inputs
339
305
  * @returns The population standard deviation
340
306
  * @example
341
- * ```js
342
307
  * const y = SMath.stdevp([1, 2, 3, 4]); // 1.118...
343
- * ```
344
308
  */
345
309
  function stdevp(data) {
346
310
  return Math.sqrt(varp(data));
@@ -350,9 +314,7 @@ function stdevp(data) {
350
314
  * @param data An array of numeric inputs
351
315
  * @returns The sample standard deviation
352
316
  * @example
353
- * ```js
354
317
  * const y = SMath.stdevs([1, 2, 3, 4]); // 1.29...
355
- * ```
356
318
  */
357
319
  function stdevs(data) {
358
320
  return Math.sqrt(vars(data));
@@ -363,9 +325,7 @@ function stdevs(data) {
363
325
  * @param max The maximum bound
364
326
  * @returns A random float within the range
365
327
  * @example
366
- * ```js
367
328
  * const y = SMath.runif(-2, 2); // 0.376...
368
- * ```
369
329
  */
370
330
  function runif(min, max) {
371
331
  return expand(Math.random(), min, max);
@@ -376,9 +336,7 @@ function runif(min, max) {
376
336
  * @param max The maximum bound (inclusive)
377
337
  * @returns A random integer within the range
378
338
  * @example
379
- * ```js
380
339
  * const y = SMath.rint(-4, 3); // -4
381
- * ```
382
340
  */
383
341
  function rint(min, max) {
384
342
  min |= 0;
@@ -397,9 +355,7 @@ function rint(min, max) {
397
355
  * @param stdev The standard deviation of the population
398
356
  * @returns A random float
399
357
  * @example
400
- * ```js
401
358
  * const y = SMath.rnorm(2, 3); // 1.627...
402
- * ```
403
359
  */
404
360
  function rnorm(mean, stdev) {
405
361
  if (mean === void 0) { mean = 0; }
@@ -413,9 +369,7 @@ function rnorm(mean, stdev) {
413
369
  * @param stdev The standard deviation of the population
414
370
  * @returns A population of random floats
415
371
  * @example
416
- * ```js
417
372
  * const dataset = SMath.rdist(3); // [ 1.051..., -0.779..., -2.254... ]
418
- * ```
419
373
  */
420
374
  function rdist(count, mean, stdev) {
421
375
  if (mean === void 0) { mean = 0; }
@@ -431,9 +385,7 @@ function rdist(count, mean, stdev) {
431
385
  * @param stack An array of arbitrary elements
432
386
  * @returns The `stack` array in a random order
433
387
  * @example
434
- * ```js
435
388
  * const shuffled = SMath.shuffle(['a', 'b', 'c']); // [ 'c', 'a', 'b' ]
436
- * ```
437
389
  */
438
390
  function shuffle(stack) {
439
391
  var rawData = [];
@@ -452,9 +404,7 @@ function shuffle(stack) {
452
404
  * @param discontinuity_cutoff The discontinuity cutoff
453
405
  * @returns `lim(f(x->x))`
454
406
  * @example
455
- * ```js
456
407
  * const y = SMath.lim(Math.log, 0); // -Infinity
457
- * ```
458
408
  */
459
409
  function lim(f, x, h, discontinuity_cutoff) {
460
410
  if (h === void 0) { h = 1e-3; }
@@ -524,9 +474,7 @@ function lim(f, x, h, discontinuity_cutoff) {
524
474
  * @param h Small step value
525
475
  * @returns `f'(x)`
526
476
  * @example
527
- * ```js
528
477
  * const y = SMath.differentiate(x => 3 * x ** 2, 2); // 12
529
- * ```
530
478
  */
531
479
  function differentiate(f, x, h) {
532
480
  if (h === void 0) { h = 1e-3; }
@@ -540,9 +488,7 @@ function differentiate(f, x, h) {
540
488
  * @param Ndx The number of rectangles to compute
541
489
  * @returns `F(b)-F(a)`
542
490
  * @example
543
- * ```js
544
491
  * const y = SMath.integrate(x => 3 * x ** 2, 1, 2); // 7
545
- * ```
546
492
  */
547
493
  function integrate(f, a, b, Ndx) {
548
494
  if (Ndx === void 0) { Ndx = 1e3; }
@@ -555,9 +501,7 @@ function integrate(f, a, b, Ndx) {
555
501
  * @param epsilon Maximum absolute error
556
502
  * @returns An object containing the fraction's numerator and denominator
557
503
  * @example
558
- * ```js
559
504
  * const frac = SMath.rat(0.625); // { num: 5, den: 8 }
560
- * ```
561
505
  */
562
506
  function rat(n, epsilon) {
563
507
  if (epsilon === void 0) { epsilon = 1e-6; }
@@ -581,9 +525,7 @@ function rat(n, epsilon) {
581
525
  * @param epsilon Maximum absolute error
582
526
  * @returns An object containing the whole part and fraction numerator and denominator
583
527
  * @example
584
- * ```js
585
528
  * const frac = SMath.mixed(-8 / 6); // { whole: -1, num: 1, den: 3 }
586
- * ```
587
529
  */
588
530
  function mixed(n, epsilon) {
589
531
  if (epsilon === void 0) { epsilon = 1e-6; }
@@ -595,9 +537,8 @@ function mixed(n, epsilon) {
595
537
  * @param length The minimum number of digits to show
596
538
  * @returns The number `n` converted to hexadecimal
597
539
  * @example
598
- * ```js
599
540
  * const hex = SMath.toHex(10, 2); // '0A'
600
- * ```
541
+ * @deprecated Use native `number.toString(16)`
601
542
  */
602
543
  function toHex(n, length) {
603
544
  if (length === void 0) { length = 0; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smath",
3
- "version": "1.13.2",
3
+ "version": "1.13.3",
4
4
  "description": "Small math function library",
5
5
  "homepage": "https://npm.nicfv.com/",
6
6
  "bin": "dist/bin.js",
package/types/index.d.ts CHANGED
@@ -12,10 +12,8 @@
12
12
  * @param epsilon Maximum absolute error
13
13
  * @returns True if `a` is approximately `b`
14
14
  * @example
15
- * ```js
16
15
  * const b1 = SMath.approx(1 / 3, 0.33, 1e-6), // false
17
16
  * b2 = SMath.approx(1 / 3, 0.33, 1e-2); // true
18
- * ```
19
17
  */
20
18
  export declare function approx(a: number, b: number, epsilon?: number): boolean;
21
19
  /**
@@ -25,10 +23,8 @@ export declare function approx(a: number, b: number, epsilon?: number): boolean;
25
23
  * @param max The maximum value of the range
26
24
  * @returns A clamped number
27
25
  * @example
28
- * ```js
29
26
  * const n1 = SMath.clamp(5, 0, 10), // 5
30
27
  * n2 = SMath.clamp(-2, 0, 10); // 0
31
- * ```
32
28
  */
33
29
  export declare function clamp(n: number, min: number, max: number): number;
34
30
  /**
@@ -38,9 +34,7 @@ export declare function clamp(n: number, min: number, max: number): number;
38
34
  * @param max The maximum value in the range
39
35
  * @returns A normalized value
40
36
  * @example
41
- * ```js
42
37
  * const y = SMath.normalize(18, 9, 99); // 0.1
43
- * ```
44
38
  */
45
39
  export declare function normalize(n: number, min: number, max: number): number;
46
40
  /**
@@ -50,9 +44,7 @@ export declare function normalize(n: number, min: number, max: number): number;
50
44
  * @param max The maximum value in the range
51
45
  * @returns A value within the number range
52
46
  * @example
53
- * ```js
54
47
  * const y = SMath.expand(0.25, 4, 6); // 4.5
55
- * ```
56
48
  */
57
49
  export declare function expand(n: number, min: number, max: number): number;
58
50
  /**
@@ -64,10 +56,8 @@ export declare function expand(n: number, min: number, max: number): number;
64
56
  * @param max2 The maximum value for the final range
65
57
  * @returns A translated number in the final range
66
58
  * @example
67
- * ```js
68
59
  * const C = 20,
69
60
  * F = SMath.translate(C, 0, 100, 32, 212); // 68
70
- * ```
71
61
  */
72
62
  export declare function translate(n: number, min1: number, max1: number, min2: number, max2: number): number;
73
63
  /**
@@ -77,10 +67,8 @@ export declare function translate(n: number, min1: number, max1: number, min2: n
77
67
  * @param count The number of values in the space
78
68
  * @returns The linear space as an array of numbers
79
69
  * @example
80
- * ```js
81
70
  * const space = SMath.linspace(1, 5, 6);
82
71
  * // [ 1, 1.8, 2.6, 3.4, 4.2, 5 ]
83
- * ```
84
72
  */
85
73
  export declare function linspace(min: number, max: number, count: number): number[];
86
74
  /**
@@ -90,10 +78,8 @@ export declare function linspace(min: number, max: number, count: number): numbe
90
78
  * @param count The number of values in the space
91
79
  * @returns The logarithmic space as an array of numbers
92
80
  * @example
93
- * ```js
94
81
  * const space = SMath.logspace(0, 2, 5);
95
82
  * // [ 1, 3.2, 10, 31.6, 100 ]
96
- * ```
97
83
  */
98
84
  export declare function logspace(min: number, max: number, count: number): number[];
99
85
  /**
@@ -101,9 +87,7 @@ export declare function logspace(min: number, max: number, count: number): numbe
101
87
  * @param n Any positive integer
102
88
  * @returns `n!`
103
89
  * @example
104
- * ```js
105
90
  * const y = SMath.factorial(5); // 120
106
- * ```
107
91
  */
108
92
  export declare function factorial(n: number): number;
109
93
  /**
@@ -111,9 +95,7 @@ export declare function factorial(n: number): number;
111
95
  * @param n Any positive integer
112
96
  * @returns The array of prime factors
113
97
  * @example
114
- * ```js
115
98
  * const y = SMath.factors(12); // [ 2, 2, 3 ]
116
- * ```
117
99
  */
118
100
  export declare function factors(n: number): number[];
119
101
  /**
@@ -123,9 +105,7 @@ export declare function factors(n: number): number[];
123
105
  * @param base Any base to round to
124
106
  * @returns `n` rounded to the nearest multiple of `base`
125
107
  * @example
126
- * ```js
127
108
  * const y = SMath.round2(Math.PI, 0.2); // 3.2
128
- * ```
129
109
  */
130
110
  export declare function round2(n: number, base: number): number;
131
111
  /**
@@ -139,9 +119,7 @@ export declare function round2(n: number, base: number): number;
139
119
  * @param actual The accepted or theoretical value
140
120
  * @returns The relative (normalized) error
141
121
  * @example
142
- * ```js
143
122
  * const e = SMath.error(22.5, 25); // -0.1
144
- * ```
145
123
  */
146
124
  export declare function error(experimental: number, actual: number): number;
147
125
  /**
@@ -150,9 +128,7 @@ export declare function error(experimental: number, actual: number): number;
150
128
  * @param data An array of numeric inputs
151
129
  * @returns The sum total
152
130
  * @example
153
- * ```js
154
131
  * const y = SMath.sum([1, 2, 3]); // 6
155
- * ```
156
132
  */
157
133
  export declare function sum(data: number[]): number;
158
134
  /**
@@ -161,9 +137,7 @@ export declare function sum(data: number[]): number;
161
137
  * @param data An array of numeric inputs
162
138
  * @returns The product
163
139
  * @example
164
- * ```js
165
140
  * const y = SMath.prod([2, 2, 3, 5]); // 60
166
- * ```
167
141
  */
168
142
  export declare function prod(data: number[]): number;
169
143
  /**
@@ -171,9 +145,7 @@ export declare function prod(data: number[]): number;
171
145
  * @param data An array of numeric inputs
172
146
  * @returns The average, or mean
173
147
  * @example
174
- * ```js
175
148
  * const y = SMath.avg([1, 2, 4, 4]); // 2.75
176
- * ```
177
149
  */
178
150
  export declare function avg(data: number[]): number;
179
151
  /**
@@ -181,9 +153,7 @@ export declare function avg(data: number[]): number;
181
153
  * @param data An array of numeric inputs
182
154
  * @returns The median of the dataset
183
155
  * @example
184
- * ```js
185
156
  * const y = SMath.median([2, 5, 3, 1]); // 2.5
186
- * ```
187
157
  */
188
158
  export declare function median(data: number[]): number;
189
159
  /**
@@ -191,9 +161,7 @@ export declare function median(data: number[]): number;
191
161
  * @param data An array of numeric inputs
192
162
  * @returns The population variance
193
163
  * @example
194
- * ```js
195
164
  * const y = SMath.varp([1, 2, 4, 4]); // 1.6875
196
- * ```
197
165
  */
198
166
  export declare function varp(data: number[]): number;
199
167
  /**
@@ -201,9 +169,7 @@ export declare function varp(data: number[]): number;
201
169
  * @param data An array of numeric inputs
202
170
  * @returns The sample variance
203
171
  * @example
204
- * ```js
205
172
  * const y = SMath.vars([1, 2, 4, 4]); // 2.25
206
- * ```
207
173
  */
208
174
  export declare function vars(data: number[]): number;
209
175
  /**
@@ -211,9 +177,7 @@ export declare function vars(data: number[]): number;
211
177
  * @param data An array of numeric inputs
212
178
  * @returns The population standard deviation
213
179
  * @example
214
- * ```js
215
180
  * const y = SMath.stdevp([1, 2, 3, 4]); // 1.118...
216
- * ```
217
181
  */
218
182
  export declare function stdevp(data: number[]): number;
219
183
  /**
@@ -221,9 +185,7 @@ export declare function stdevp(data: number[]): number;
221
185
  * @param data An array of numeric inputs
222
186
  * @returns The sample standard deviation
223
187
  * @example
224
- * ```js
225
188
  * const y = SMath.stdevs([1, 2, 3, 4]); // 1.29...
226
- * ```
227
189
  */
228
190
  export declare function stdevs(data: number[]): number;
229
191
  /**
@@ -232,9 +194,7 @@ export declare function stdevs(data: number[]): number;
232
194
  * @param max The maximum bound
233
195
  * @returns A random float within the range
234
196
  * @example
235
- * ```js
236
197
  * const y = SMath.runif(-2, 2); // 0.376...
237
- * ```
238
198
  */
239
199
  export declare function runif(min: number, max: number): number;
240
200
  /**
@@ -243,9 +203,7 @@ export declare function runif(min: number, max: number): number;
243
203
  * @param max The maximum bound (inclusive)
244
204
  * @returns A random integer within the range
245
205
  * @example
246
- * ```js
247
206
  * const y = SMath.rint(-4, 3); // -4
248
- * ```
249
207
  */
250
208
  export declare function rint(min: number, max: number): number;
251
209
  /**
@@ -254,9 +212,7 @@ export declare function rint(min: number, max: number): number;
254
212
  * @param stdev The standard deviation of the population
255
213
  * @returns A random float
256
214
  * @example
257
- * ```js
258
215
  * const y = SMath.rnorm(2, 3); // 1.627...
259
- * ```
260
216
  */
261
217
  export declare function rnorm(mean?: number, stdev?: number): number;
262
218
  /**
@@ -266,9 +222,7 @@ export declare function rnorm(mean?: number, stdev?: number): number;
266
222
  * @param stdev The standard deviation of the population
267
223
  * @returns A population of random floats
268
224
  * @example
269
- * ```js
270
225
  * const dataset = SMath.rdist(3); // [ 1.051..., -0.779..., -2.254... ]
271
- * ```
272
226
  */
273
227
  export declare function rdist(count: number, mean?: number, stdev?: number): number[];
274
228
  /**
@@ -276,9 +230,7 @@ export declare function rdist(count: number, mean?: number, stdev?: number): num
276
230
  * @param stack An array of arbitrary elements
277
231
  * @returns The `stack` array in a random order
278
232
  * @example
279
- * ```js
280
233
  * const shuffled = SMath.shuffle(['a', 'b', 'c']); // [ 'c', 'a', 'b' ]
281
- * ```
282
234
  */
283
235
  export declare function shuffle<T>(stack: T[]): T[];
284
236
  /**
@@ -290,9 +242,7 @@ export declare function shuffle<T>(stack: T[]): T[];
290
242
  * @param discontinuity_cutoff The discontinuity cutoff
291
243
  * @returns `lim(f(x->x))`
292
244
  * @example
293
- * ```js
294
245
  * const y = SMath.lim(Math.log, 0); // -Infinity
295
- * ```
296
246
  */
297
247
  export declare function lim(f: (x: number) => number, x: number, h?: number, discontinuity_cutoff?: number): number;
298
248
  /**
@@ -302,9 +252,7 @@ export declare function lim(f: (x: number) => number, x: number, h?: number, dis
302
252
  * @param h Small step value
303
253
  * @returns `f'(x)`
304
254
  * @example
305
- * ```js
306
255
  * const y = SMath.differentiate(x => 3 * x ** 2, 2); // 12
307
- * ```
308
256
  */
309
257
  export declare function differentiate(f: (x: number) => number, x: number, h?: number): number;
310
258
  /**
@@ -315,9 +263,7 @@ export declare function differentiate(f: (x: number) => number, x: number, h?: n
315
263
  * @param Ndx The number of rectangles to compute
316
264
  * @returns `F(b)-F(a)`
317
265
  * @example
318
- * ```js
319
266
  * const y = SMath.integrate(x => 3 * x ** 2, 1, 2); // 7
320
- * ```
321
267
  */
322
268
  export declare function integrate(f: (x: number) => number, a: number, b: number, Ndx?: number): number;
323
269
  /**
@@ -327,9 +273,7 @@ export declare function integrate(f: (x: number) => number, a: number, b: number
327
273
  * @param epsilon Maximum absolute error
328
274
  * @returns An object containing the fraction's numerator and denominator
329
275
  * @example
330
- * ```js
331
276
  * const frac = SMath.rat(0.625); // { num: 5, den: 8 }
332
- * ```
333
277
  */
334
278
  export declare function rat(n: number, epsilon?: number): {
335
279
  num: number;
@@ -343,9 +287,7 @@ export declare function rat(n: number, epsilon?: number): {
343
287
  * @param epsilon Maximum absolute error
344
288
  * @returns An object containing the whole part and fraction numerator and denominator
345
289
  * @example
346
- * ```js
347
290
  * const frac = SMath.mixed(-8 / 6); // { whole: -1, num: 1, den: 3 }
348
- * ```
349
291
  */
350
292
  export declare function mixed(n: number, epsilon?: number): {
351
293
  whole: number;
@@ -358,8 +300,7 @@ export declare function mixed(n: number, epsilon?: number): {
358
300
  * @param length The minimum number of digits to show
359
301
  * @returns The number `n` converted to hexadecimal
360
302
  * @example
361
- * ```js
362
303
  * const hex = SMath.toHex(10, 2); // '0A'
363
- * ```
304
+ * @deprecated Use native `number.toString(16)`
364
305
  */
365
306
  export declare function toHex(n: number, length?: number): string;