rpn/test/100-complex.md

1209 lines
10 KiB
Markdown
Raw Normal View History

2022-02-12 19:11:22 +01:00
### COMPLEX
`default del`
## entry (1)
`(1,2) ( 1,2) (1 ,2) (1, 2) (1,2 )`
-> stack should be (1,2), (1,2), (1,2), (1,2), (1,2)
`del`
## entry (2)
`(1.3,2.444555`
-> stack should be (1.3,2.444555)
`del`
## entry (3)
`(1,`
-> stack should be (1,0)
`del`
## entry (4)
`(nan,+inf)`
-> stack should be (nan,inf)
`del`
## entry (5)
`(0x1234,0x10.10)`
-> stack should be (0x1.234p+12,0x1.01p+4)
`del`
## entry (6)
`(0b11,0b101)`
-> stack should be (3,5)
`del`
## add (1)
`(1.2,2.3) (1,2) +`
-> stack should be (2.2,4.3)
`del`
## add (2)
`(1.2,2.3) (1,2)+`
-> stack should be (2.2,4.3)
`del`
## add (3)
`(1.2,2.3) 3+`
-> stack should be (4.2,2.3)
`del`
## add (4)
`3 (1.2,2.3)+`
-> stack should be (4.2,2.3)
`del`
## sub (1)
`(1.2,2.3) (2,2) -`
-> stack should be (-0.8,0.3)
`del`
## sub (2)
`(1.2,2.3) (1,2)-`
-> stack should be (0.2,0.3)
`del`
## sub (3)
`(1.2,2.3) 1-`
-> stack should be (0.2,2.3)
`del`
## sub (4)
`1 (1.2,2.3) -`
-> stack should be (-0.2,2.3)
`del`
## mul (1)
`(1,2) (3,4) *`
-> stack should be (-5,10)
`del`
## mul (2)
`(3,4) (1,2) *`
-> stack should be (-5,10)
`del`
## mul (3)
`(3,4) 2 *`
-> stack should be (6,8)
`del`
## mul (3)
`2 (3,4) *`
-> stack should be (6,8)
`del`
## div (1)
`(1,2) (3,4) /`
-> stack should be (0.44,0.08)
`del`
## div (2)
`(1,2) 2 /`
-> stack should be (0.5,1)
`del`
## div (3)
`2 (3,4) /`
-> stack should be (0.24,-0.32)
`del`
## re (1)
`(1.2,3.4) re`
-> stack should be 1.2
`del`
## re (2)
`3 re`
-> error should be 3
`del`
## re (3)
`re`
-> error should be 2
`del`
## im (1)
`(1.2,3.4) im`
-> stack should be 3.4
`del`
## im (2)
`3 re`
-> error should be 3
`del`
## im (3)
`re`
-> error should be 2
`del`
## chs
`(3.14,6.28) chs`
-> stack should be (-3.14,-6.28)
`del`
## neg
`(-3.14,-6.28) neg`
-> stack should be (3.14,6.28)
`del`
## inv (1)
`(2,4) inv`
-> stack should be (0.1,-0.2)
`del`
## inv (2)
`(0.1,-0.2) inv`
-> stack should be (2,4)
`del`
## abs
`(3,4) abs`
-> stack should be 5
`del`
## sign (1)
`(1,0) sign`
-> stack should be (1,0)
`del`
## sign (2)
`(0,1) sign`
-> stack should be (0,1)
`del`
## sign (3)
`(3,-4) sign`
-> stack should be (0.6,-0.8)
`del`
## sq (1)
`(12,10) sq`
-> stack should be (44,240)
`del`
## sqr (1)
`(12,10) sq`
-> stack should be (44,240)
`del`
## arg (1)
`(1,1) arg pi 4 / ==`
-> stack should be 1
`del`
## arg (2)
`1000 prec`
`(-1,1) arg pi 3 * 4 / ==`
-> stack should be 1
`default del`
## arg (3)
`1000 prec`
`(1,-1) arg pi chs 4 / ==`
-> stack should be 1
`default del`
## arg (4)
`1000 prec`
`(-1,-1) arg pi -3 * 4 / ==`
-> stack should be 1
`default del`
## arg (5)
`1000 prec`
`(1,0) arg 0 ==`
-> stack should be 1
`default del`
## arg (6)
`1000 prec`
`(0,1) arg pi 2 / ==`
-> stack should be 1
`default del`
## arg (7)
`1000 prec`
`(-1,0) arg pi ==`
-> stack should be 1
`default del`
## arg (8)
`1000 prec`
`(0,-1) arg pi neg 2 / ==`
-> stack should be 1
`default del`
## conj
`(1,2) conj dup conj`
-> stack should be (1,-2), (1,2)
`del`
## r->c (1)
`1 2 r->c`
-> stack should be (1,2)
`del`
## r->c (2)
`1 r->c`
-> error should be 2
`del`
## r->c (3)
`r->c`
-> error should be 2
`del`
## r->c (3)
`'1' '2' r->c`
-> error should be 3
`del`
## c->r (1)
`(1,2) c->r`
-> stack should be 1, 2
`del`
## c->r (2)
`c->r`
-> error should be 2
`del`
## c->r (3)
`'4' c->r`
-> error should be 3
`del`
## r->p (1)
`6 fix`
`(1,2) r->p`
-> stack should be (2.236068,1.107149)
`del`
## r->p (2)
`19 fix`
`1 r->p`
-> error should be 3.000000
`del`
## r->p (3)
`r->p`
-> error should be 2
`del`
## r->p (4)
`'1' '2' r->p`
-> error should be 3
`del`
## ^ (1)
`6 fix`
`(1,2) 2 ^`
-> stack should be (-3.000000,4.000000)
`del`
## ^ (2)
`(1,2) 4 ^`
-> stack should be (-7.000000,-24.000000)
`del`
## ^ (3)
`-3 .2 ^`
-> stack should be (1.007818,0.732222)
`del`
## sqrt (1)
`(3,4) sqrt`
-> stack should be (2.000000,1.000000)
`del`
## sqrt (2)
`-3 sqrt`
-> stack should be (-0.000000,1.732051)
`del`
## sin (1)
`(1,2) sin`
-> stack should be (3.165779,1.959601)
`del`
## sin (2)
`(1,-2) sin`
-> stack should be (3.165779,-1.959601)
`del`
## sin (3)
`(-1,-2) sin`
-> stack should be (-3.165779,-1.959601)
`del`
## sin (4)
`(-1,2) sin`
-> stack should be (-3.165779,1.959601)
`del`
## asin (1)
`(1,2) asin`
-> stack should be (0.427079,1.528571)
`del`
## asin (2)
`(1,-2) asin`
-> stack should be (0.427079,-1.528571)
`del`
## asin (3)
`(-1,-2) asin`
-> stack should be (-0.427079,-1.528571)
`del`
## asin (4)
`(-1,2) asin`
-> stack should be (-0.427079,1.528571)
`del`
## cos (1)
`(1,2) cos`
-> stack should be (2.032723,-3.051898)
`del`
## cos (2)
`(1,-2) cos`
-> stack should be (2.032723,3.051898)
`del`
## cos (3)
`(-1,-2) cos`
-> stack should be (2.032723,-3.051898)
`del`
## cos (4)
`(-1,2) sin`
-> stack should be (-3.165779,1.959601)
`del`
## acos (1)
`(1,2) acos`
-> stack should be (1.143718,-1.528571)
`del`
## acos (2)
`(1,-2) acos`
-> stack should be (1.143718,1.528571)
`del`
## acos (3)
`(-1,-2) acos`
-> stack should be (1.997875,1.528571)
`del`
## acos (4)
`(-1,2) acos`
-> stack should be (1.997875,-1.528571)
`del`
## tan (1)
`(1,2) tan`
-> stack should be (0.033813,1.014794)
`del`
## tan (2)
`(1,-2) tan`
-> stack should be (0.033813,-1.014794)
`del`
## tan (3)
`(-1,-2) tan`
-> stack should be (-0.033813,-1.014794)
`del`
## tan (4)
`(-1,2) tan`
-> stack should be (-0.033813,1.014794)
`del`
## atan (1)
`(1,2) atan`
-> stack should be (1.338973,0.402359)
`del`
## atan (2)
`(1,-2) atan`
-> stack should be (1.338973,-0.402359)
`del`
## atan (3)
`(-1,-2) atan`
-> stack should be (-1.338973,-0.402359)
`del`
## atan (4)
`(-1,2) atan`
-> stack should be (-1.338973,0.402359)
`del`
## ln (1)
`(1,2) ln`
-> stack should be (0.804719,1.107149)
`del`
## ln (2)
`(1,-2) ln`
-> stack should be (0.804719,-1.107149)
`del`
## ln (3)
`(-1,-2) ln`
-> stack should be (0.804719,-2.034444)
`del`
## ln (4)
`(-1,2) ln`
-> stack should be (0.804719,2.034444)
`del`
## lnp1 (1)
`(1,2) lnp1`
`(1,2) 1 + ln ==`
-> stack should be 1.000000
`del`
## lnp1 (2)
`(1,-2) lnp1`
`(1,-2) 1 + ln ==`
-> stack should be 1.000000
`del`
## lnp1 (3)
`(-1,-2) lnp1`
`(-1,-2) 1 + ln ==`
-> stack should be 1.000000
`del`
## lnp1 (4)
`(-1,2) lnp1`
`(-1,2) 1 + ln ==`
-> stack should be 1.000000
`del`
## log (1)
`(1,2) log`
-> stack should be (0.804719,1.107149)
`del`
## log (2)
`(1,-2) log`
-> stack should be (0.804719,-1.107149)
`del`
## log (3)
`(-1,-2) log`
-> stack should be (0.804719,-2.034444)
`del`
## log (4)
`(-1,2) log`
-> stack should be (0.804719,2.034444)
`del`
## log10 (1)
`(1,2) log10`
-> stack should be (0.349485,0.480829)
`del`
## log10 (2)
`(1,-2) log10`
-> stack should be (0.349485,-0.480829)
`del`
## log10 (3)
`(-1,-2) log10`
-> stack should be (0.349485,-0.883548)
`del`
## log10 (4)
`(-1,2) log10`
-> stack should be (0.349485,0.883548)
`del`
## log2 (1)
`(1,2) log2`
-> stack should be (1.160964,1.597278)
`del`
## log2 (2)
`(1,-2) log2`
-> stack should be (1.160964,-1.597278)
`del`
## log2 (3)
`(-1,-2) log2`
-> stack should be (1.160964,-2.935082)
`del`
## log2 (4)
`(-1,2) log2`
-> stack should be (1.160964,2.935082)
`del`
## exp (1)
`(1,2) exp`
-> stack should be (-1.131204,2.471727)
`del`
## exp (2)
`(1,-2) exp`
-> stack should be (-1.131204,-2.471727)
`del`
## exp (3)
`(-1,-2) exp`
-> stack should be (-0.153092,-0.334512)
`del`
## exp (4)
`(-1,2) exp`
-> stack should be (-0.153092,0.334512)
`del`
## expm (1)
`(1,2) expm`
`(1,2) exp 1 - ==`
-> stack should be 1.000000
`del`
## expm (2)
`(1,-2) expm`
`(1,-2) exp 1 - ==`
-> stack should be 1.000000
`del`
## expm (3)
`(-1,-2) expm`
`(-1,-2) exp 1 - ==`
-> stack should be 1.000000
`del`
## expm (4)
`(-1,2) expm`
`(-1,2) exp 1 - ==`
-> stack should be 1.000000
`del`
## alog2 (1)
`(1,2) alog2`
-> stack should be (0.366914,1.966055)
`del`
## alog2 (2)
`(1,-2) alog2`
-> stack should be (0.366914,-1.966055)
`del`
## alog2 (3)
`(-1,-2) alog2`
-> stack should be (0.091728,-0.491514)
`del`
## alog2 (4)
`(-1,2) alog2`
-> stack should be (0.091728,0.491514)
`del`
## alog10 (1)
`(1,2) alog10`
-> stack should be (-1.070135,-9.942576)
`del`
## alog10 (2)
`(1,-2) alog10`
-> stack should be (-1.070135,9.942576)
`del`
## alog10 (3)
`(-1,-2) alog10`
-> stack should be (-0.010701,0.099426)
`del`
## alog10 (4)
`(-1,2) alog10`
-> stack should be (-0.010701,-0.099426)
`del`
## sinh (1)
`(1,2) sinh`
-> stack should be (-0.489056,1.403119)
`del`
## sinh (2)
`(1,-2) sinh`
-> stack should be (-0.489056,-1.403119)
`del`
## sinh (3)
`(-1,-2) sinh`
-> stack should be (0.489056,-1.403119)
`del`
## sinh (4)
`(-1,2) sinh`
-> stack should be (0.489056,1.403119)
`del`
## asinh (1)
`(1,2) asinh`
-> stack should be (1.469352,1.063440)
`del`
## asinh (2)
`(1,-2) asinh`
-> stack should be (1.469352,-1.063440)
`del`
## asinh (3)
`(-1,-2) asinh`
-> stack should be (-1.469352,-1.063440)
`del`
## asinh (4)
`(-1,2) asinh`
-> stack should be (-1.469352,1.063440)
`del`
## cosh (1)
`(1,2) cosh`
-> stack should be (-0.489056,1.403119)
`del`
## cosh (2)
`(1,-2) cosh`
-> stack should be (-0.489056,-1.403119)
`del`
## cosh (3)
`(-1,-2) cosh`
-> stack should be (0.489056,-1.403119)
`del`
## cosh (4)
`(-1,2) cosh`
-> stack should be (0.489056,1.403119)
`del`
## acosh (1)
`(1,2) acosh`
-> stack should be (1.528571,1.143718)
`del`
## acosh (2)
`(1,-2) acosh`
-> stack should be (1.528571,-1.143718)
`del`
## acosh (3)
`(-1,-2) acosh`
-> stack should be (-1.528571,1.997875)
`del`
## acosh (4)
`(-1,2) acosh`
-> stack should be (-1.528571,-1.997875)
`del`
## tanh (1)
`(1,2) tanh`
-> stack should be (0.564133,-0.217934)
`del`
## tanh (2)
`(1,-2) tanh`
-> stack should be (0.564133,0.217934)
`del`
## tanh (3)
`(-1,-2) tanh`
-> stack should be (-0.564133,0.217934)
`del`
## tanh (4)
`(-1,2) tanh`
-> stack should be (-0.564133,-0.217934)
`del`
## atanh (1)
`(1,2) atanh`
-> stack should be (0.173287,1.178097)
`del`
## atanh (2)
`(1,-2) atanh`
-> stack should be (0.173287,-1.178097)
`del`
## atanh (3)
`(-1,-2) atanh`
-> stack should be (-0.173287,-1.178097)
`del`
## atanh (4)
`(-1,2) atanh`
-> stack should be (-0.173287,1.178097)
`del`