Binary 5 - Floating Point Range versus Precision

This is the fifth in a series of videos about the binary number system which is fundamental to the operation of a digital electronic computer. In particular, this video elaborates on the representation of real numbers using floating point binary notation. It explains how the relative allocation of bits between the mantissa and the exponent in a fixed size register can impact on the range and precision of the values that can be represented. It also draws a distinction between precision and accuracy, and points out some of the limitations of floating point binary. The video also mentions the importance of an awareness among programmers of how floating point binary works, including a demonstration of the kind of error that can occur when using single and double data types in a simple Visual Basic.NET program.

Пікірлер: 33

  • @TheFlyguy31
    @TheFlyguy316 жыл бұрын

    Watching your video's has taught me to understand binary on an intuitive level.

  • @ComputerScienceLessons

    @ComputerScienceLessons

    6 жыл бұрын

    That's really good to hear. Kevin

  • @arupduttabappy3284
    @arupduttabappy32843 жыл бұрын

    You know the art of teaching,, loving this playlist so much

  • @ComputerScienceLessons

    @ComputerScienceLessons

    3 жыл бұрын

    Thank you so much :)KD

  • @jakobalbrechtsen925
    @jakobalbrechtsen9252 жыл бұрын

    Thanks for making these videos (and the series) available; they are of great help with good and varied use of examples with to-the-point explanations. I'll be recommending it to others.

  • @ComputerScienceLessons

    @ComputerScienceLessons

    2 жыл бұрын

    You're welcome. Recommendations much appreciated :)KD

  • @MarvinStroud3
    @MarvinStroud35 жыл бұрын

    So that explains why Open Office Calc displays tiny discepencies from time to time. Thanks.

  • @Sawyer0823
    @Sawyer0823 Жыл бұрын

    II am a little confused about accuracy and precision in IEEE754 & AI. I would like to knoe if Mantissan & exponent have direct relationship with result's accuracy and precision. Like, in IEEE754, will it be more precise with more Mantissa? and more accuracy with more exponent? I know that if i want to do HPC, FP64 is better than FP32 and FP16. And INT8 is more suitable for AI inference. I am kind of stuck here and very confused about the concept of accuracy and precision.

  • @bakedbeaaanz
    @bakedbeaaanz2 жыл бұрын

    why cant we represent 7.5 with 4 bit mantissa and 4 bit exponent? wouldn't 1111 0011 give you 7.5?

  • @ComputerScienceLessons

    @ComputerScienceLessons

    2 жыл бұрын

    This would be -1 (see below). Your mantissa starts with a 1 which means you have a negative number. You should assume the mantissa and the exponent are both in two's complement. 1111 0011 = 1.111 X 2^3 = 1111.0 =-1

  • @bakedbeaaanz

    @bakedbeaaanz

    2 жыл бұрын

    @@ComputerScienceLessons so does that mean if we didn't use two's complement, we would be able to represent 7.5?

  • @DominicCurtis
    @DominicCurtis Жыл бұрын

    I love computer science :)

  • @SpudCastYT

    @SpudCastYT

    Жыл бұрын

    weirdo

  • @ComputerScienceLessons

    @ComputerScienceLessons

    Жыл бұрын

    me too :)KD

  • @vojar3692
    @vojar36925 жыл бұрын

    So, how anything really works if small errors keep accumulating, and we have to use floating point numbers :/? it seems like an important limit in programming calculations If we imagine computer clock (that uses float) then eventually it will show us wrong time...

  • @milestailsprower4555

    @milestailsprower4555

    3 жыл бұрын

    Because .1 can't represent in binary .0(0011) Max value of double = 179.7969313 uncentillion

  • @EricFontaineJazz

    @EricFontaineJazz

    2 жыл бұрын

    If avoiding the small accumulation errors is crucial, then the designer may decide to use fixed point representation and to use a data structure that represents a number as a fraction. For instance, when dealing with money (such as a banking database), I believe it is more common to treat decimals as just a plain integer with a fixed decimal point. And in the computer clock, it would be likely that internally the timestamps are represented as an integer as a count (or as multiples) of the computer's clock cycles.

  • @thenomad9963
    @thenomad9963 Жыл бұрын

    damn this guy is good

  • @ComputerScienceLessons

    @ComputerScienceLessons

    Жыл бұрын

    Thanks. much appreciated :)KD

  • @NoName-tj8dm
    @NoName-tj8dm Жыл бұрын

    Thanks for the great video. I have calculated the largest and smallest value in 4 bit register having 2 bit for mantissa and 2 bit for exponent For largest value Exponent is 01 Mantissa is 010.0 Mantissa in decimal is 2 For smallest value Exponent is 01 Mantissa is 10.0 Mantissa in decimal is -2 Can you please confirm if above is correct or not ?

  • @ComputerScienceLessons

    @ComputerScienceLessons

    Жыл бұрын

    Using the format described in this video, with a 4 bit register, and assuming the mantissa and the exponent are both in two's complement... The largest number, in binary, will be 0101 The mantissa is 01 and the exponent is 01 The two bit mantissa is positive, because it starts with 0. Imagine a binary point to the right of the leftmost bit of the mantissa, so the mantissa is 0.1 The exponent is also positive, namely denary 1. We therefore have 0.1 x 2^1 When we float the point one place to the right we get 1.0 in 'pure' (fixed point) binary. which is denary +1 The smallest number, in binary, will be 1010 The mantissa is 10 and the exponent is 10 The two bit mantissa is negative, because it starts with 1. Imagine a binary point to the right of the leftmost bit of the mantissa, so the mantissa is 1.0 The exponent is also negative, namely denary -2. We therefore have 1.0 x 2^-2 When we float the point two places to the right we get 0.01 in 'pure' (fixed point) binary. Now, you have to bear in mind that the original mantissa was negative, so the most significant bit in 0.01 has a negative place value. In this case -0.25 So the smallest denay number is -0.25

  • @NoName-tj8dm

    @NoName-tj8dm

    Жыл бұрын

    @@ComputerScienceLessons Dear Sir, First of all, Thanks for your all effort and response. Only Because of you I have begun to understood the floating point representation of decimal in binary. Here I believe , For the smallest , Binary Should be 1001 hence the mantissa is 10 and exponent is 01 So, I have 1.0 x 2^1 and 1.0 * 2^1 = 10 = -2 and hence smallest denary is -2. Please correct me if I am wrong.

  • @ComputerScienceLessons

    @ComputerScienceLessons

    Жыл бұрын

    You are quite correct. 1001, namely, -2 is the smallest. Embarrassingly, I was wong. :_KD

  • @justcurious1940
    @justcurious1940 Жыл бұрын

    using c++ gives more accurate result it does output 100 for the loop part is it up to the processor or the programming language ? double x = 0 ; x = 0+0.1 ; std::cout

  • @justcurious1940

    @justcurious1940

    Жыл бұрын

    great serie by the way i'm watching it all

  • @ComputerScienceLessons

    @ComputerScienceLessons

    Жыл бұрын

    You welcome. I'm working on a C# course at the moment. I look forward to your comments. :)KD

  • @sirpiesmasher8482
    @sirpiesmasher84827 жыл бұрын

    Yes mate, sick vid. Look 4wad 4 more

  • @ComputerScienceLessons

    @ComputerScienceLessons

    7 жыл бұрын

    :)

  • @mixxamm
    @mixxamm5 жыл бұрын

    2:17 I'm pretty sure single precision has a 23-bit mantissa, not 24-bit. Great video nonetheless.

  • @oTakisApoTinAchaia

    @oTakisApoTinAchaia

    5 жыл бұрын

    Alright, according to the IEEE 754 standard, in a 32-bit system you have: - 1 bit for the sign of the number - 8 bits for the exponent and - 23 bits for the mantissa. So he's probably including the sign to the mantissa referring to it as a whole, in terms of the 2's complement representation. That doesn't make quite a differnce in the way we approach the topic in this video, but in some applications it is vital to separate them.

  • @pkus

    @pkus

    2 жыл бұрын

    I think 24 bit here he meant with sign bit