rpn/test/023-parse-number.md

170 lines
1.6 KiB
Markdown
Raw Normal View History

2022-02-12 19:11:22 +01:00
# PARSE NUMBER
`default del`
## type
`1.0 type`
-> stack should be "number"
`del`
## 1-shot entries
```
0
0.
.0
0.0
-0
+0
+.0
+0.
0.1
+0.1
-0.1
-.1
+.1
```
-> stack should be 0, 0, 0, 0, -0, 0, 0, 0, 0.1, 0.1, -0.1, -0.1, 0.1
`del`
## n-shot entries
```
0 0. .0 0.0 -0 +0 +.0 +0. 0.1 +0.1 -0.1 -.1 +.1
```
-> stack should be 0, 0, 0, 0, -0, 0, 0, 0, 0.1, 0.1, -0.1, -0.1, 0.1
`del`
2022-02-12 19:11:22 +01:00
## numb 1
`3.14 +3.14 -3.14`
-> stack should be 3.14, 3.14, -3.14
`del`
## spaces
` -3.14 -3 .14`
-> stack should be -3.14, -3, 0.14
`del`
## exp entry
`+3.14e2`
-> stack should be 314
`del`
## inf nan
`+inf inf -inf nan`
-> stack should be inf, inf, -inf, nan
`del`
## hex
`0x10 0X10`
2022-02-15 16:57:09 +01:00
-> stack should be 0x10, 0x10
2022-02-12 19:11:22 +01:00
`del`
## hex err
`0x 0X`
-> stack should be '0x', '0X'
`del`
## bin
`0b1101 0b0`
2022-02-15 16:57:09 +01:00
-> stack should be 0b1101, 0b0
2022-02-12 19:11:22 +01:00
`del`
## bin err
`0b`
-> stack should be '0b'
`del`
2022-02-15 16:57:09 +01:00
## base
`del 3b12`
-> stack should be 3b12
## base (2)
`del 0x1e2`
-> stack should be 0x1e2
## base (3)
`del 0x-1e2 5b-1234 0b-1`
-> stack should be -0x1e2, -5b1234, -0b1
2022-02-17 18:08:25 +01:00
## base (4)
`del -0x1e2 -5b1234 -0b1`
-> stack should be -0x1e2, -5b1234, -0b1
2022-02-15 16:57:09 +01:00
## base err
`del 0b12`
-> stack should be '0b12'
## base err (2)
`del 1b0`
-> stack should be '1b0'
`del -1b33`
-> stack should be '-1b33'
`del -63b1`
-> stack should be '-63b1'
## wrong base errors
`del 0b0.1100`
2022-02-17 18:08:25 +01:00
`ab Xb 1b ax 0X 3X`
2022-02-15 16:57:09 +01:00
2022-02-17 18:08:25 +01:00
-> stack should be 0b1, 'ab', 'Xb', '1b', 'ax', '0X', '3X'
2022-02-15 16:57:09 +01:00
## particular writings
`del 10b12345 2b1100`
-> stack should be 12345, 0b1100
## hex powers
`del 0x10p3 -0x2p4`
-> stack should be 0x80, -0x20
2022-02-15 16:57:09 +01:00
`del default`