Library

Video Player is loading.
 
Current Time 0:00
Duration 5:58
Loaded: 0%
 
x1.00


Back

Games & Quizzes

Training Mode - Typing
Fill the gaps to the Lyric - Best method
Training Mode - Picking
Pick the correct word to fill in the gap
Fill In The Blank
Find the missing words in a sentence Requires 5 vocabulary annotations
Vocabulary Match
Match the words to the definitions Requires 10 vocabulary annotations

You may need to watch a part of the video to unlock quizzes

Don't forget to Sign In to save your points

Challenge Accomplished

PERFECT HITS +NaN
HITS +NaN
LONGEST STREAK +NaN
TOTAL +
- //

We couldn't find definitions for the word you were looking for.
Or maybe the current language is not supported

  • 00:03

    This short video explains how computers change the overflow flag when adding or subtracting

  • 00:10

    two signed integers represented in two's complement.

  • 00:17

    Let's first quickly review what is two's complement.

  • 00:20

    Most modern computers use, two's complement, to represent signed integers.

  • 00:27

    This number wheel lists five-bit two's complement integers.

  • 00:32

    Positive numbers and zero are simply represented as themselves.

  • 00:37

    Negative numbers are represented in this way: Invert every bit of its positive equivalent,

  • 00:42

    and then add 1.

  • 00:45

    For example, suppose we want to find out how to represent -3 in two's complement.

  • 00:51

    First of all, we translate positive 3 to binary.

  • 00:56

    In the first step, we flip every bit.

  • 00:59

    In the second step, we add one.

  • 01:03

    The final result is 11101, which is the two's complement representation of -3.

  • 01:15

    When adding two signed numbers represented in two's complement, overflow can only happen

  • 01:21

    when adding two numbers of the same sign, but getting a result with a different sign.

  • 01:26

    There are two possible scenarios.

  • 01:29

    In the first scenario, add two positive numbers, but produce a negative result.

  • 01:36

    In the second scenario, add two negative numbers, but get a positive result.

  • 01:42

    This shows an example of the first scenario, in which overflow is generated when the sum

  • 01:48

    of two positive number is negative.

  • 01:52

    Suppose we are adding 12 and 5.

  • 01:54

    The result is 10001, which represents -15 in two's complement.

  • 02:03

    This happens because the correct result 17 is larger than the maximum representable number 15.

  • 02:11

    In the following, we will show how to detect overflow by using the number wheel.

  • 02:17

    Numbers can be added or subtracted by moving round the number wheel, clockwise for adding

  • 02:23

    a positive number or subtracting a negative number, and counterclockwise for subtracting

  • 02:29

    a positive number or adding a negative number.

  • 02:34

    In this 5-bit example, overflow happens when the movement crosses the boundary between

  • 02:40

    15 and -16.

  • 02:46

    As explained in the previous slide, adding two numbers of the same sign must produce

  • 02:51

    a result of the same sign.

  • 02:53

    Otherwise, overflow has happened, indicating the result has fell out of the representable range.

  • 03:01

    Similarly, subtracting two signed integers generates overflow if the result is too large

  • 03:06

    or too small to fit into the representable range.

  • 03:10

    For example, subtracting 7 from -13 should produce -20, which is out of the representable range.

  • 03:20

    Accordingly, this subtraction generates overflow.

  • 03:24

    We can detect overflow by using the number wheel.

  • 03:28

    If subtracting a positive number, we move along the wheel counter-clockwise.

  • 03:34

    On the other hand, if subtracting a negative number, we move along the wheel clockwise.

  • 03:40

    Whenever the movement crosses the boundary between 15 and -16, overflow is generated,

  • 03:47

    and the overflow flag is set.

  • 03:52

    This figure shows both the general-purpose registers and the special-purpose registers

  • 03:58

    on ARM Cortex-M microprocessors.

  • 04:01

    The overflow flag is stored in one of the special purpose registers.

  • 04:07

    This register is called Program Status Register, or called PSR.

  • 04:15

    This shows the content of the program status register.

  • 04:19

    The V bit represents the overflow flag.

  • 04:22

    If V is 1, overflow has happened.

  • 04:25

    If V is zero, no overflow has been generated.

  • 04:32

    This table shows the meaning of the overflow flag when ALU adds or subtracts two signed numbers.

  • 04:40

    If the overflow flag is zero, the result of signed addition or signed subtraction is correct.

  • 04:47

    However, if the overflow flag is one, the result of signed addition or signed subtraction

  • 04:54

    is incorrect.

  • 04:55

    Application software has to check, whether or not overflow is generated, in order to

  • 05:01

    prevent erroneous results.

  • 05:05

    It is interesting to compare the overflow flag and the carry flag.

  • 05:09

    The reason causing the difference is that we need a carry flag for adding two unsigned

  • 05:16

    numbers, and a borrow flag for subtracting two unsigned numbers.

  • 05:20

    ARM Cortex-M microprocessors choose to use the same flag bit to represent both the carry

  • 05:27

    flag and the borrow flag.

  • 05:29

    Specifically, carry equals not borrow.

  • 05:33

    See this tutorial for detailed explanation.

  • 05:45

    Please visit the book website for more materials.

All

The example sentences of REPRESENTABLE in videos (1 in total of 2)

this determiner happens verb, 3rd person singular present because preposition or subordinating conjunction the determiner correct adjective result noun, singular or mass 17 cardinal number is verb, 3rd person singular present larger adjective, comparative than preposition or subordinating conjunction the determiner maximum adjective representable adjective number noun, singular or mass 15 cardinal number .

Definition and meaning of REPRESENTABLE

What does "representable mean?"

adjective
Expressible in symbolic form.