1 (#).to(#); // iterator
2 for( let num in (2).to(5) ) print( num );
3
4 number.pad(len, [radix]); // Zero pad the number
5
6 // dec/bin/oct/hex conversions (legacy API)
7 // short variants work one-way on number instances only
8 number.hex;
9 number.bin;
10 number.oct;
11
12 // Full t2t api includes both Number and String types
13 number.dec2hex;
14 number.dec2bin;
15 number.dec2oct;
16 string.hex2dec;
17 string.hex2bin;
18 string.hex2oct;
19 string.bin2dec;
20 string.bin2hex;
21 string.bin2oct;
22 string.oct2dec;
23 string.oct2hex;
24 string.oct2bin;
25
26 // New API idea involves intermediate HexNum BinNum and OctNum classes
27 // with a .toString that returns their string, and a valueOf which returns
28 // the decimal number.
29 number.hex; // HexNum
30 number.bin; // BinNum
31 number.oct; // OctNum
32 hexNum.dec; // Number
33 hexNum.bin; // BinNum
34 hexNum.oct; // OctNum
35 binNum.dec; // Number
36 binNum.hex; // HexNum
37 binNum.oct; // OctNum
38 octNum.dec; // Number
39 octNum.hex; // HexNum
40 octNum.bin; // BinNum
41
42 // Math wrappers (getters)
43 number.abs;
44 number.exp; // more thought needed
45 number.log; // more thought needed
46 number.sqrt;
47
48 // trig
49 number.sin;
50 number.cos;
51 number.tan;
52 number.asin;
53 number.acos;
54 number.atan;
55 // Note Math.atan2 is not wrapped since it would not make sense
56
57 // Math wrappers (methods)
58 number.pow(exp);
59
60 // Rounding (methods allow you to specify decimal place)
61 number.rounded; // simple shortcut
62 number.round([decimal]);
63 number.floor([decimal]);
64 number.ceil([decimal]);
65
66 // Math enhancements
67 Math.rand(min, max); // Wrapper to Math.random which allows a min/max to be specified
68