-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patharithmeticLogic.R
116 lines (97 loc) · 2.66 KB
/
arithmeticLogic.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
## ------------------------------------------------------------------------
3 + 7
9 / 3
9 * (3+2)
12^2 + 1.5*10
10 %/% 3
10 %% 3
## ------------------------------------------------------------------------
"/"(1, 10)
"+"(2, 3)
## ------------------------------------------------------------------------
sqrt(4)
sin(pi/2)
abs(-4)
log10(100)
exp(1)
## ------------------------------------------------------------------------
round(1.271)
round(pi, digits=3)
ceiling(1.2)
floor(3.7)
trunc(22.913)
## ------------------------------------------------------------------------
exp(1)^((0+1i)*pi)
exp(1)^(-pi/2) - (0+1i)^(0+1i)
sqrt(-1)
sqrt(-1+0i)
## ------------------------------------------------------------------------
.Machine$integer.max
.Machine$double.eps
## ------------------------------------------------------------------------
1/0
is.infinite(1/0)
0/0
is.nan(0/0)
NULL
is.null(NULL)
## ------------------------------------------------------------------------
x1 <- 2
x2 <- 10
x3 <- -7
x1 * 2
x2^x1 + x3
## ------------------------------------------------------------------------
TRUE
FALSE
!TRUE
!FALSE
## ------------------------------------------------------------------------
isTRUE(TRUE)
isTRUE(FALSE)
## ------------------------------------------------------------------------
TRUE == TRUE
TRUE == FALSE
TRUE != TRUE
TRUE != FALSE
TRUE & TRUE
TRUE & FALSE
FALSE & FALSE
FALSE & TRUE
TRUE | TRUE
TRUE | FALSE
FALSE | FALSE
FALSE | TRUE
xor(TRUE, FALSE)
xor(TRUE, TRUE)
## ------------------------------------------------------------------------
c(TRUE, FALSE, FALSE) && c(TRUE, TRUE, FALSE)
c(FALSE, FALSE, TRUE) || c(FALSE, TRUE, FALSE)
## ------------------------------------------------------------------------
4 < 8
7 < 3
4 > 4
4 >= 4
## ------------------------------------------------------------------------
any(c(FALSE, FALSE, FALSE))
any(c(FALSE, FALSE, TRUE))
all(c(TRUE, TRUE, FALSE))
any(c(TRUE, TRUE, TRUE))
## ------------------------------------------------------------------------
all(numeric(0))
## ------------------------------------------------------------------------
any(numeric(0))
## ------------------------------------------------------------------------
4L == 4
identical(4L, 4)
## ------------------------------------------------------------------------
0.1 + 0.2 == 0.3
1 %/% 0.1
sin(pi)
1 - ((1/49) * 49)
1 - ((1/48) * 48)
## ------------------------------------------------------------------------
isTRUE(all.equal(0.123450001, 0.123450000))
0.123400001 == 0.123400000
all.equal(0.12345001, 0.12345000)
isTRUE(all.equal(0.12345001, 0.12345000))