Operators Identifiers The Data Elements Arithmetic Operators exponentiation
- Slides: 19
Operators & Identifiers The Data Elements
Arithmetic Operators • • exponentiation multiplication division (real) division (integer quotient) division (integer remainder) addition Subtraction assignment ^ * / Mod + =
Evaluate these expressions = 100 / 10 / 5 = 100 / 10 5 = 100 10 / 5 = 100 + 10 Mod 5 = 100 + 10 5
Evaluate these expressions = 100 / 10 / 5 = 100 / 10 5 = 100 10 / 5 = 100 + 10 Mod 5 = 100 + 10 5 2
Evaluate these expressions = 100 / 10 / 5 2 = 100 / 10 5 = 100 10 / 5 = 100 + 10 Mod 5 = 100 + 10 5 2
Evaluate these expressions = 100 / 10 / 5 = 100 / 10 5 = 100 10 / 5 = 100 + 10 Mod 5 = 100 + 10 5 2 2 50
Evaluate these expressions = 100 / 10 / 5 = 100 / 10 5 = 100 10 / 5 = 100 + 10 Mod 5 = 100 + 10 5 2 2 50 100
Evaluate these expressions = 100 / 10 / 5 = 100 / 10 5 = 100 10 / 5 = 100 + 10 Mod 5 = 100 + 10 5 2 2 50 102
Variables • A variable is a string used to identify a memory location. • The amount of memory is determined by the type of data that it will store. • Typically, variable names need to be declared so the operating system can allocate sufficient space. • Then values of the specified type can be assigned, i. e. stored in that location.
Variable Names in VB • Must begin with a letter – Can include letters and numerals – Cannot include spaces • Use names that are descriptive • Capitalising convention – Interest. Rate, Initial. Capital
Variables • Local – Declared within a subprogram – Dim var. Name As data. Type • Global – Declared at the top of the code listing – Private var. Name As data. Type
Data Types Type Name Storage size Range of values Boolean 2 byte True or False (1 or 0) Byte 1 byte integers in the range 0 to 255 Char 2 bytes 0 to 65, 535 representing the Unicode character set Date 8 bytes time/date between 0: 00 on 1/1/0001 to 23: 59 on 12/31/9999 Double 8 bytes a real number; precision is about 14 digits to the right of the decimal point Integer 4 bytes integers in the range -2, 147, 483, 648 to 2, 147, 483, 647 Long 8 bytes very big! Short 2 bytes integers in the range -32, 768 to 32, 767 Single 4 bytes a real number, i. e. a number with a decimal (fractional) part; precision is limited to about 6 digits to the right of the decimal point. String depends on platform up to approximately 2 billion Unicode characters
The ASCII Character Set
Data Storage (Short type) 27 2 6 2 5 2 4 2 3 2 2 128 64 32 16 8 4 1 1 1 128 +64 +32 +16 +8 +4 + =255 21 20 2 1 1 1 2 + 1
Data Storage (2 nd byte) 215 214 213 212 211 210 32768 16384 8192 4096 2048 1024 1 1 1 32768+16384 +8192 +4096 +2048 +1024 29 512 1 +512 =65280 +255 65535 The largest Unsigned value that can be stored in 16 bits. How many patterns are there? 28 256 1 +256
Integer Storage • To store integers, half the combinations are used to represent negative values. • The range for Integer type variables is: -32, 768 to +32767 • The MSB is used to represent the sign. • Which value of the sign bit (0 or 1) will represent a negative number?
Integer Storage (4 bytes) • High order bit (MSB) is worth 231 • The number of different combinations = 232 = 4, 294, 967, 296 • Half are used for negative values, so the range is – 2, 147, 483, 648 to + 2, 147, 483, 647
Long Integers • In 8 bytes there are 64 bits! • High order bit (MSB) is worth 263. • The number of different combinations =264 =18, 446, 744, 073, 709, 650, 616
Data Type Conversion
- Logical operators in prolog
- Logical expressions
- Arithmetic operators in vbscript
- Exponentiation rapide modulaire
- Exponents in modular arithmetic
- Exponentiation adalah
- Horner's rule and binary exponentiation
- Modular exponentiation
- Modular exponentiation
- Identifiers example
- Identifiers example
- Life science identifiers
- Neutronics ultima id pro
- What are the two patient identifiers
- Buyer persona identifiers
- Whats the joint commission
- Social identity pie chart
- Quickvue rapid strep test instructions
- What are the two patient identifiers
- Clia'88