Tải bản đầy đủ (.pdf) (10 trang)

Giáo Trình How To Use AutoIt A Professional Manner part 92 pps

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (72.89 KB, 10 trang )

13 (hệ 10) => 1101 (hệ 2)
07 (hệ 10) => 0111 (hệ 2)
bit and => 1111 (hệ 2) = 17 (hệ 10)
Related
BitAND, BitNOT, BitShift, BitXOR, Hex
Example

$x = BitOR(3, 6) ;x == is 7 because 0011 OR 0110 = 0111

$x = BitOR(3, 15, 32) ;x == 47 because 0011 OR 1111 OR 00100000 = 00101111




Function Reference
BitRotate
Performs a bit shifting operation, with rotation.
BitRotate ( value , shift [, size] )
Parameters
value The number to be operate on.
shift
Number of bits to rotate to the left (negative numbers shift right). If
not given, the default is 1.
size
[optional] A string that determines the rotation size, the default is (16
bits). See below.


Size parameter :
"B" rotate bits within the low-order byte (8 bits).
"W" rotate bits within the low-order word (16 bits).


"D" rotate bits within the entire double-word (32 bits).

Return Value
Returns the value rotated by the required number of bits.
Bit operations are performed as 32-bit integers.
Remarks
Remember hex notation can be used for numbers.
Related
BitShift, BitAND, BitNOT, BitOR, BitXOR, Hex
Example

$x = BitRotate(7, 2)
; x == 3 because 111b left-rotated twice is 1 1100b == 28

$y = BitRotate(14, -2)
; y == 32771 because 1110b right-rotated twice on 16 bits is 1000 0000 0000
0011b == 32771

$z = BitRotate(14, -2, "D")
; z == -2147483645 because 1110b right-rotated twice on 16 bits is 1000 0000
0000 0000 0000 0000 0000 0011b == 2147483645




Function Reference
BitShift
Performs a bit shifting operation.
BitShift ( value, shift )
Parameters

value The number to be shifted.
shift Number of bits to shift to the right (negative numbers shift left).

Return Value
Returns the value shifted by the required number of bits.
Bit operations are performed as 32-bit integers.
Remarks
Remember hex notation can be used for numbers.
Right shifts are equivalent to halving; left shifts to doubling.
Related
BitAND, BitNOT, BitOR, BitXOR, Hex, BitRotate
Example

$x = BitShift(14, 2)
; x == 3 because 1110b right-shifted twice is 11b == 3

$y = BitShift(14, -2)
; y == 56 because 1110b left-shifted twice is 111000b == 56

$z = BitShift( 1, -31)
; z == -2147483648 because in 2's-complement notation, the
; 32nd digit from the right has a negative sign.




Function Reference
BitXOR
Performs a bitwise exclusive OR (XOR) operation.
BitXOR ( value1, value2 [, value n] )

Parameters
value1 The first number.
value2 The second number.
value n [optional] The nth number - up to 255 values can be specified.

Return Value
Returns the value of the parameters bitwise-XOR'ed together.
Bit operations are performed as 32-bit integers.
Remarks
Remember hex notation can be used for numbers.
BitXOR returns 1 in a bit position if there are an odd number 1's in the
corresponding bit position in all the input arguments, and 0 otherwise.
Related
BitAND, BitNOT, BitOR, BitShift, Hex
Example

$x = BitXOR(10, 6) ;x == 12 because 1010b XOR 0110b == 1100

$x = BitXOR(2, 3, 6) ;x == 7 because 0010 XOR 0011 XOR 0110 = 0111




Function Reference
Cos
tính cos.
Cos ( expression )
Parameters
expression giá trị tính = radian


Return Value
số.
Remarks
1° = pi / 180 radians.
Related
Sin, Tan, ASin, ACos, ATan
Example

$pi = 3.14159265358979
$x = cos($pi / 4)

$degToRad = $pi / 180
$y = Cos(90 * $degToRad) ;cosine of 90°




Function Reference
Ceiling
làm tròn lên.
Ceiling ( expression )
Parameters
expression giá trị.

Return Value
số nguyên.
Remarks
None
Related
Int, Number, Floor, Round

Example

Dim $msg

$msg = ""
$msg = $msg & "Ceiling(4.8) = " & Ceiling(4.8) & @CR
$msg = $msg & "Ceiling(4.5) = " & Ceiling(4.5) & @CR
$msg = $msg & "Ceiling(4.3) = " & Ceiling(4.3) & @CR
$msg = $msg & "Ceiling(4) = " & Ceiling(4) & @CR
$msg = $msg & "Ceiling(-4.3) = " & Ceiling(-4.3) & @CR
$msg = $msg & "Ceiling(-4.5) = " & Ceiling(-4.5) & @CR
$msg = $msg & "Ceiling(-4.8) = " & Ceiling(-4.8) & @CR
$msg = $msg & "Ceiling(-4) = " & Ceiling(-4) & @CR

MsgBox(64, "Testing", $msg)




Function Reference
Exp
tính e^.
Exp ( expression )
Parameters
expression giá trị

Return Value
trả lại e ^ expression.
Remarks
e = 2.71828182845905

Related
Log
Example

$x = Exp(5) ;returns 148.413159102577




Function Reference
Floor
làm tròn xuống.
Floor ( expression )
Parameters
expression Giá trị

Return Value
số nguyên
Remarks
None
Related
Int, Number, Round, Ceiling
Example

Dim $msg

$msg = ""

$msg = $msg & "Floor(4.8) = " & Floor(4.8) & @CR
$msg = $msg & "Floor(4.5) = " & Floor(4.5) & @CR

$msg = $msg & "Floor(4.3) = " & Floor(4.3) & @CR
$msg = $msg & "Floor(4) = " & Floor(4) & @CR
$msg = $msg & "Floor(-4.3) = " & Floor(-4.3) & @CR
$msg = $msg & "Floor(-4.5) = " & Floor(-4.5) & @CR
$msg = $msg & "Floor(-4.8) = " & Floor(-4.8) & @CR
$msg = $msg & "Floor(-4) = " & Floor(-4) & @CR

MsgBox(64, "Testing", $msg)




Function Reference
Log
tính ln
Log ( expression )
Parameters
expression giá trị

Return Value
Success:

trả lại log(e, expression)
Failure:

trả -1. nếu tham số vô nghĩa.

Remarks
@error is always 0


×