rpn/test/120-trig.md

106 lines
1.2 KiB
Markdown
Raw Normal View History

# TRIGONOMETRY
2022-02-20 23:41:16 +01:00
`del default 6 fix 128 prec`
## pi
2022-02-20 18:53:00 +01:00
`pi`
-> stack should be 3.141593
2022-02-20 18:53:00 +01:00
`del`
## d->r
`180 d->r pi ==`
-> stack should be 1.000000
`del`
## r->d
`pi r->d 180 ==`
-> stack should be 1.000000
`del`
2022-02-20 18:53:00 +01:00
## sin asin
`0 sin pi 2 / sin pi 6 / sin`
`0 asin 0 == 1 asin pi 2 / == 0.5 asin pi 6 / ==`
2022-02-20 18:53:00 +01:00
-> stack should be 0.000000, 1.000000, 0.500000, 1.000000, 1.000000, 1.000000
`del`
2022-02-20 18:53:00 +01:00
## cos acos
`0 cos pi 3 / cos`
`1 acos 0 == 0.5 acos pi 3 / ==`
2022-02-20 18:53:00 +01:00
-> stack should be 1.000000, 0.500000, 1.000000, 1.000000
`del`
2022-02-20 18:53:00 +01:00
## tan atan
`pi 4 / tan 1 == 1 atan pi 4 / ==`
2022-02-20 18:53:00 +01:00
-> stack should be 1.000000, 1.000000
`del`
## sin asin
`(1,2) sin (3.165779,1.959601) asin`
-> stack should be (3.165779,1.959601), (1.000000,2.000000)
`del`
## cos acos
`(1,2) cos (2.032723,-3.051898) acos`
-> stack should be (2.032723,-3.051898), (1.000000,2.000000)
`del`
## tan atan
`(1,2) tan (0.033813,1.014794) atan`
-> stack should be (0.033813,1.014794), (1.000004,1.999996)
`del`
## sin asin cos acos tan atan error
`'ok' sin`
-> error should be 3
`asin`
-> error should be 3
`cos`
-> error should be 3
`acos`
-> error should be 3
`tan`
-> error should be 3
`atan`
-> error should be 3
`del`