rpn/test/027-base-entry.md

366 lines
5.7 KiB
Markdown
Raw Permalink Normal View History

# REAL AND COMPLEX NUMERICAL ENTRIES
2017-06-30 13:43:14 +02:00
2022-02-12 19:11:22 +01:00
`default del`
## table for fixed entry, 4 fix output >= 0
```
2017-06-30 13:43:14 +02:00
4 fix
1 0.01 0.0001 0.00006 0.00004 0 0.012 0.001256 100 100.001 100.00006 100.00004 12345678910111213.12355
2022-02-12 19:11:22 +01:00
```
2017-06-30 13:43:14 +02:00
-> stack should be 1.0000, 0.0100, 0.0001, 0.0001, 0.0000, 0.0000, 0.0120, 0.0013, 100.0000, 100.0010, 100.0001, 100.0000, 12345678910111213.1236
2022-02-12 19:11:22 +01:00
`del default`
## table for fixed entry, 4 fix output <= 0
```
2017-06-30 13:43:14 +02:00
4 fix
-1 -0.01 -0.0001 -0.00006 -0.00004 -0 -0.012 -0.001256 -100 -100.001 -100.00006 -100.00004 -12345678910111213.12355
2022-02-12 19:11:22 +01:00
```
2017-06-30 13:43:14 +02:00
-> stack should be -1.0000, -0.0100, -0.0001, -0.0001, -0.0000, -0.0000, -0.0120, -0.0013, -100.0000, -100.0010, -100.0001, -100.0000, -12345678910111213.1236
2022-02-12 19:11:22 +01:00
`del default`
## table for sci entry, 4 fix output >= 0
```
2017-06-30 13:43:14 +02:00
4 fix
0e100 1e0 1.e0 1.001e0 1.e-3 1.e-4 6.e-5 4.e-5 1.00001e2 1.0000006e2 1.0000004e2 1234.5678917e2
2022-02-12 19:11:22 +01:00
```
2017-06-30 13:43:14 +02:00
-> stack should be 0.0000, 1.0000, 1.0000, 1.0010, 0.0010, 0.0001, 0.0001, 0.0000, 100.0010, 100.0001, 100.0000, 123456.7892
2022-02-12 19:11:22 +01:00
`del default`
## table for sci entry, 4 fix output <= 0
```
2017-06-30 13:43:14 +02:00
4 fix
-0e100 -1e0 -1.e0 -1.001e0 -1.e-3 -1.e-4 -6.e-5 -4.e-5 -1.00001e2 -1.0000006e2 -1.0000004e2 -1234.5678917e2
2022-02-12 19:11:22 +01:00
```
2017-06-30 13:43:14 +02:00
-> stack should be -0.0000, -1.0000, -1.0000, -1.0010, -0.0010, -0.0001, -0.0001, -0.0000, -100.0010, -100.0001, -100.0000, -123456.7892
2022-02-12 19:11:22 +01:00
`del default`
## table for singularity
```
2017-06-30 13:43:14 +02:00
4 fix
nan @nan@ -nan inf -inf @inf@ -@inf@
2022-02-12 19:11:22 +01:00
```
2017-06-30 13:43:14 +02:00
-> stack should be nan, nan, nan, inf, -inf, inf, -inf
2022-02-12 19:11:22 +01:00
`del default`
## some strange behaviour (1)
```
2017-06-30 13:43:14 +02:00
0 fix
1 2 / dup +
2022-02-12 19:11:22 +01:00
```
2017-06-30 13:43:14 +02:00
-> stack should be 1
2022-02-12 19:11:22 +01:00
`del default`
## some strange behaviour (2)
```
2017-06-30 13:43:14 +02:00
1 fix
0.6
2022-02-12 19:11:22 +01:00
```
2017-06-30 13:43:14 +02:00
-> stack should be 0.6
2022-02-12 19:11:22 +01:00
`del default`
## some strange behaviour (3)
```
2017-06-30 13:43:14 +02:00
0 fix
110.6 0.6
2022-02-12 19:11:22 +01:00
```
2017-06-30 13:43:14 +02:00
-> stack should be 111, 1
2022-02-12 19:11:22 +01:00
`del default`
## hex (1)
`0x4000000000000`
2017-06-30 13:43:14 +02:00
-> stack should be 0x4000000000000
2022-02-12 19:11:22 +01:00
`del default`
## hex (2)
`2 50 ^ hex`
2017-06-30 13:43:14 +02:00
-> stack should be 0x4000000000000
2022-02-12 19:11:22 +01:00
`del default`
## hex (3)
`12.34 hex`
2017-06-30 13:43:14 +02:00
-> stack should be 0xc
2022-02-12 19:11:22 +01:00
`del default`
## dec (1)
`2 50 ^`
2017-06-30 13:43:14 +02:00
-> stack should be 1125899906842624
2022-02-12 19:11:22 +01:00
`del default`
## dec (2)
`0x4000000000000 dec`
2017-06-30 13:43:14 +02:00
-> stack should be 1125899906842624
2022-02-12 19:11:22 +01:00
`del default`
## dec (3)
`12.34 dec`
2017-06-30 13:43:14 +02:00
-> stack should be 12.34
2022-02-12 19:11:22 +01:00
`del default`
## bin (1)
`0b100000000000000000000000000000000000000000000000000 bin`
2017-06-30 13:43:14 +02:00
-> stack should be 0b100000000000000000000000000000000000000000000000000
2022-02-12 19:11:22 +01:00
`del default`
## bin (2)
`2 50 ^ bin`
2017-06-30 13:43:14 +02:00
-> stack should be 0b100000000000000000000000000000000000000000000000000
2022-02-12 19:11:22 +01:00
`del default`
## bin (3)
`0x4000000000000 bin`
2017-06-30 13:43:14 +02:00
-> stack should be 0b100000000000000000000000000000000000000000000000000
2022-02-12 19:11:22 +01:00
`del default`
## bin (4)
`12.34 bin`
2017-06-30 13:43:14 +02:00
-> stack should be 0b1100
2022-02-12 19:11:22 +01:00
`del default`
## base entry (1)
`3b111 dup dec`
-> stack should be 3b111, 13
2022-02-12 19:11:22 +01:00
`del default`
## base entry (2)
`3b114`
2022-02-15 16:57:09 +01:00
-> stack should be '3b114'
2022-02-12 19:11:22 +01:00
`del default`
## base entry (3)
`1b0`
2022-02-15 16:57:09 +01:00
-> stack should be '1b0'
2022-02-12 19:11:22 +01:00
`del default`
## base entry (4)
`62b20 dup dec`
-> stack should be 62b20, 124
2022-02-12 19:11:22 +01:00
`del default`
## base entry (5)
`63b20`
2022-02-15 16:57:09 +01:00
-> stack should be '63b20'
2022-02-12 19:11:22 +01:00
`del default`
## base entry (6)
`2b11001100 0b11001100 ==`
2022-02-15 16:57:09 +01:00
-> stack should be 1
2022-02-12 19:11:22 +01:00
`del default`
## base entry (7)
`10b1234 1234 ==`
2022-02-15 16:57:09 +01:00
-> stack should be 1
2022-02-12 19:11:22 +01:00
`del default`
## base entry (8)
`16b1234 0x1234 ==`
2022-02-15 16:57:09 +01:00
-> stack should be 1
2022-02-12 19:11:22 +01:00
`del default`
## base display (1)
`2 62 for i 62 i base next`
2022-02-16 16:03:26 +01:00
-> stack should be 0b111110, 3b2022, 4b332, 5b222, 6b142, 7b116, 8b76, 9b68, 62, 11b57, 12b52, 13b4a, 14b46, 15b42, 0x3e, 17b3b, 18b38, 19b35, 20b32, 21b2k, 22b2i, 23b2g, 24b2e, 25b2c, 26b2a, 27b28, 28b26, 29b24, 30b22, 31b20, 32b1u, 33b1t, 34b1s, 35b1r, 36b1q, 37b1P, 38b1O, 39b1N, 40b1M, 41b1L, 42b1K, 43b1J, 44b1I, 45b1H, 46b1G, 47b1F, 48b1E, 49b1D, 50b1C, 51b1B, 52b1A, 53b19, 54b18, 55b17, 56b16, 57b15, 58b14, 59b13, 60b12, 61b11, 62b10
2022-02-12 19:11:22 +01:00
`del default`
## base display (2)
`2 62 for i i 62 base next`
-> stack should be 62b2, 62b3, 62b4, 62b5, 62b6, 62b7, 62b8, 62b9, 62bA, 62bB, 62bC, 62bD, 62bE, 62bF, 62bG, 62bH, 62bI, 62bJ, 62bK, 62bL, 62bM, 62bN, 62bO, 62bP, 62bQ, 62bR, 62bS, 62bT, 62bU, 62bV, 62bW, 62bX, 62bY, 62bZ, 62ba, 62bb, 62bc, 62bd, 62be, 62bf, 62bg, 62bh, 62bi, 62bj, 62bk, 62bl, 62bm, 62bn, 62bo, 62bp, 62bq, 62br, 62bs, 62bt, 62bu, 62bv, 62bw, 62bx, 62by, 62bz, 62b10
2022-02-12 19:11:22 +01:00
`del default`
## base display (3)
```
100 dup 3 base ==
13455600 dup 5 base ==
55756 dup 17 base ==
2345321 dup 62 base ==
2022-02-12 19:11:22 +01:00
```
-> stack should be 1, 1, 1, 1
2022-02-12 19:11:22 +01:00
`del default`
## base display (4)
```
100 18 base dup 3 base == dec
13455600 55 base dup 5 base == dec
55756 9 base dup 17 base == dec
2345321 57 base dup 62 base == dec
2022-02-12 19:11:22 +01:00
```
-> stack should be 1, 1, 1, 1
2022-02-12 19:11:22 +01:00
`del default`
## negative base numbers (1)
`1000 hex neg`
-> stack should be -0x3e8
2022-02-12 19:11:22 +01:00
`del default`
## negative base numbers (2)
`1000 7 base neg`
-> stack should be -7b2626
2022-02-12 19:11:22 +01:00
`del default`
## negative base numbers (3)
`1000 bin neg`
-> stack should be -0b1111101000
2022-02-12 19:11:22 +01:00
`del default`
## negative base numbers (4)
`-0b1111101000 3 base`
-> stack should be -3b1101001
2022-02-12 19:11:22 +01:00
`del default`
## base on complexes
```
(0b110,0x102) dup bin swap dup hex dup 5 base
```
-> stack should be (0b110,0b100000010), (0b110,0x102), (0x6,0x102), (5b11,5b2013)
`del default`
2022-02-12 19:11:22 +01:00
## inf should not be based-represented
`-1 bin 0 bin / 1 3 base 0 3 base /`
-> stack should be -inf, inf
2022-02-12 19:11:22 +01:00
`del default`
## nan should not be based-represented
`-0 bin 0 bin / 0 3 base 0 3 base /`
-> stack should be nan, nan
2022-02-12 19:11:22 +01:00
`del default`
2022-02-15 16:57:09 +01:00
## complex base 16
`(0x10,0x20)`
-> stack should be (0x10,0x20)
## complex base 16 (2)
`del (16,32) hex`
-> stack should be (0x10,0x20)
## complex base 2
`del (0b111,0b110)`
-> stack should be (0b111,0b110)
## complex base 2 (2)
`del (7,6) bin`
-> stack should be (0b111,0b110)
## complex multiple bases re / im
`del (0x10,0b111) dup dup hex swap dec`
-> stack should be (0x10,0b111), (0x10,0x7), (16,7)