rpn/test/05-real.txt

433 lines
4.5 KiB
Text
Raw Normal View History

## REAL
2017-05-13 12:08:41 +02:00
2017-05-27 18:38:57 +02:00
default erase
# real decimal
2017-05-13 12:08:41 +02:00
1
-> stack size should be 1
2017-05-13 12:08:41 +02:00
-> stack should be 1
erase
2017-05-13 12:08:41 +02:00
# real decimal (2)
2.345
-> stack should be 2.345
erase
2017-05-13 12:08:41 +02:00
# real decimal (3)
1 2.345 3 4.9
-> stack size should be 4
-> stack should be 1, 2.345, 3, 4.9
erase
2017-05-13 12:08:41 +02:00
# real hex
0x1234 0x10.10
-> stack should be 0x1.234p+12, 0x1.01p+4
erase
2017-05-13 12:08:41 +02:00
# real hex (2)
0x1.234p+12 0x1.01p+4
dec swap dec swap
-> stack should be 4660, 16.0625
erase
2017-05-13 12:08:41 +02:00
# real binary
0b11001100
-> stack should be 204
erase
2017-05-13 12:08:41 +02:00
# real binary (2)
0b11001100.1101
-> stack should be 204.8125
erase
# real inf, nan
inf
@inf@
+inf
+@inf@
-inf
-@inf@
nan
@nan@
-> stack should be inf, inf, inf, inf, -inf, -inf, nan, nan
erase
2017-05-13 12:08:41 +02:00
2017-05-27 18:38:57 +02:00
# prec (1)
default
2 prec pi
-> stack should be 3
erase
2017-05-27 18:38:57 +02:00
# prec (2)
10 prec pi
-> stack should be 3.140625
erase
2017-05-27 18:38:57 +02:00
# prec error (1)
1 prec
-> error should be 4
erase
2017-05-27 18:38:57 +02:00
# prec error (2)
0x8000000000000000 prec
-> error should be 4
2017-05-29 13:47:34 +02:00
erase default
2017-05-31 10:15:15 +02:00
# round (1)
"nearest" round
-> error should be 0
erase
# round (2)
"toward zero" round
-> error should be 0
erase
# round (3)
"toward +inf" round
-> error should be 0
erase
# round (4)
"toward -inf" round
-> error should be 0
erase
# round (5)
"away from zero" round
-> error should be 0
erase
# round (6)
round
-> error should be 2
erase default
2017-05-29 13:47:34 +02:00
# add (1)
1.2 2.3 +
-> stack should be 3.5
erase
2017-05-29 13:47:34 +02:00
# add (2)
1.2 2.3+
-> stack should be 3.5
erase
2017-05-29 13:47:34 +02:00
# add (3)
2.3 +
-> error should be 2
-> stack size should be 1
erase
2017-05-29 13:47:34 +02:00
# add (4)
+
-> error should be 2
erase
2017-05-29 13:47:34 +02:00
# sub (1)
1.2 2.3 -
-> stack should be -1.1
erase
2017-05-29 13:47:34 +02:00
# sub (2)
1.2 2.3-
-> stack should be -1.1
erase
2017-05-29 13:47:34 +02:00
# sub (3)
2.3 -
-> error should be 2
-> stack size should be 1
erase
2017-05-29 13:47:34 +02:00
# sub (4)
-
-> error should be 2
erase
2017-05-29 13:47:34 +02:00
# mul (1)
1.2 2.3 *
-> stack should be 2.76
erase
2017-05-29 13:47:34 +02:00
# mul (2)
1.2 2.3*
-> stack should be 2.76
erase
2017-05-29 13:47:34 +02:00
# mul (3)
2.3 *
-> error should be 2
-> stack size should be 1
erase
2017-05-29 13:47:34 +02:00
# mul (4)
*
-> error should be 2
erase
2017-05-29 13:47:34 +02:00
# div (1)
1.2 2.3 /
-> stack should be 0.5217391304347826087
erase
2017-05-29 13:47:34 +02:00
# div (2)
1.2 2.3/
-> stack should be 0.5217391304347826087
erase
2017-05-29 13:47:34 +02:00
# div (3)
2.3 /
-> error should be 2
-> stack size should be 1
erase
2017-05-29 13:47:34 +02:00
# div (4)
/
-> error should be 2
erase
2017-05-29 13:47:34 +02:00
# chs (1)
3.14 chs
-> stack should be -3.14
erase
2017-05-29 13:47:34 +02:00
# chs (2)
chs
-> error should be 2
# neg (1)
3.14 neg
-> stack should be -3.14
erase
2017-05-29 13:47:34 +02:00
# neg (2)
neg
-> error should be 2
# inv (1)
2 inv
-> stack should be 0.5
erase
2017-05-29 13:47:34 +02:00
# inv (2)
inv
-> error should be 2
# % (1)
2 30 %
-> stack should be 0.6
erase
# % (2)
2 30%
-> stack should be 0.6
erase
# % (3)
2 %
-> error should be 2
-> stack size should be 1
erase
2017-05-29 13:47:34 +02:00
# % (4)
%
-> error should be 2
erase
2017-05-29 13:47:34 +02:00
# %CH (1)
2 0.6 %CH
-> stack should be 30
erase
# %CH (2)
2 0.6%CH
-> stack should be 30
erase
# %CH (3)
2 %CH
-> error should be 2
-> stack size should be 1
erase
2017-05-29 13:47:34 +02:00
# %CH (4)
%CH
-> error should be 2
erase
2017-05-29 13:47:34 +02:00
# ^ (1)
2 10 ^
-> stack should be 1024
erase
# ^ (2)
2 10^
-> stack should be 1024
erase
# ^ (3)
2 ^
-> error should be 2
-> stack size should be 1
erase
# ^ (4)
^
-> error should be 2
erase
# sqrt (1)
9 sqrt
-> stack should be 3
erase
2017-05-29 13:47:34 +02:00
# sqrt (2)
sqrt
-> error should be 3
2017-05-29 13:47:34 +02:00
# sq (1)
12 sq
-> stack should be 144
erase
2017-05-29 13:47:34 +02:00
# sq (2)
sq
-> error should be 2
# sqr (1)
12 sqr
-> stack should be 144
erase
2017-05-29 13:47:34 +02:00
# sqr (2)
sqr
-> error should be 2
# mod (1)
9 4 mod
-> stack should be 1
erase
# mod (2)
9 mod
-> error should be 2
-> stack size should be 1
erase
# mod (3)
mod
-> error should be 2
erase
# abs (1)
-9 abs
-> stack should be 9
erase
# abs (2)
9 abs
-> stack should be 9
erase
# abs (3)
abs
-> error should be 2
erase
2017-05-27 18:38:57 +02:00
2017-05-31 14:28:31 +02:00
# fact (1)
6 fact
-> stack should be 720
erase
# fact (2)
'r' fact
-> error should be 3
-> stack size should be 1
erase
# fact (3)
fact
-> error should be 2
erase
# sign (1)
23 sign -34 sign 0 sign
-> stack should be 1, -1, 0
erase
# sign (2)
sign
-> error should be 2
erase
2017-05-31 16:50:24 +02:00
# mant (1)
123.456 mant -123.456 mant 0 mant
-> stack should be 0.123456, 0.123456, 0
erase
# mant (2)
inf mant
-> error should be 4
-inf mant
-> error should be 4
nan mant
-> error should be 4
erase
# xpon (1)
123.456 xpon -123.456 xpon 0 mant
-> stack should be 3, 3, 0
erase
# xpon (2)
inf xpon
-> error should be 4
-inf xpon
-> error should be 4
nan xpon
-> error should be 4
erase
# min (1)
1 2 min 4 3 min
-> stack should be 1, 3
erase
# min (2)
'a' 'g' min
-> error should be 3
erase
# min (3)
1 min
-> error should be 2
erase
# min (4)
min
-> error should be 2
erase
# max (1)
1 2 max 4 3 max
-> stack should be 2, 4
erase
# max (2)
'a' 'g' max
-> error should be 3
erase
# max (3)
1 max
-> error should be 2
erase
# max (4)
max
-> error should be 2
erase
2017-05-13 12:08:41 +02:00
default