HOW TO: Convert IEEE-754 Single-Precision Binary to Decimal

  Рет қаралды 366,239

Steven Petryk

Steven Petryk

Күн бұрын

For an interactive explanation of how this conversion process works, I made a webapp that basically summarizes this video:
float-visualizer.surge.sh
Here's the source code on GitHub for those interested: github.com/stevenpetryk/float...

Пікірлер: 129
@biancasantin
@biancasantin 5 жыл бұрын
omg how can you be so calm talking about this??? i'm freaking out cause i've got a test tomorrow, but now it seems so simple
@userwithcoolnamelol
@userwithcoolnamelol 3 ай бұрын
how are you recently? are you work in this field?😀
@formidablemoe1091
@formidablemoe1091 6 жыл бұрын
A million thanks to you Steven.. You made this so much easier to many of us!
@firetner3267
@firetner3267 4 жыл бұрын
Finally some good video. I searched the yt for floating point explanation and kinda got hang of it but noone cared to explain it so closely but you helped me man, thanks.
@manganesedioxide14
@manganesedioxide14 5 жыл бұрын
I have an assignment due at 12 tonight, let me just say this saved my life.
@carlosortiz-qb9ce
@carlosortiz-qb9ce Жыл бұрын
dude, you don't know how much you have helped me, thank you and regards from Argentina!
@TheBabluirfan
@TheBabluirfan 7 жыл бұрын
Thank you for this explanation. This has shown me a different approach.
@amanofculture5575
@amanofculture5575 2 ай бұрын
Hello what have you become, are you now working in the field?
@LegendRuffy
@LegendRuffy 4 жыл бұрын
Thank you so so much! I finally can finish my assignment and also use this video to study for my test :)
@vyhuynh7230
@vyhuynh7230 5 жыл бұрын
this is so nice, clear and easy to follow!! This helps me a lot with my up coming exam!! Thank you!!!
@amanofculture5575
@amanofculture5575 2 ай бұрын
Hello what have you become, are you now working in the field?
@Habitat5975
@Habitat5975 8 жыл бұрын
Thank you! Very easy to understand. I used your method to write the code for an assignment asking me to do this.
@amanofculture5575
@amanofculture5575 2 ай бұрын
Hello what have you become, are you now working in the field?
@sudeepsaha452
@sudeepsaha452 6 жыл бұрын
Nice and clear.. have been struggling to understand it for 2 days. Checked several videos. Thanks
@amanofculture5575
@amanofculture5575 2 ай бұрын
Hello what have you become, are you now working in the field?
@fancy_pixel
@fancy_pixel 7 жыл бұрын
man i have been going all over the internet and all places to understand this thank you soooooooooo much you saved me
@amanofculture5575
@amanofculture5575 2 ай бұрын
Hello what have you become, are you now working in the field?
@fancy_pixel
@fancy_pixel 2 ай бұрын
@@amanofculture5575 Currently i am moving countries so not working but I have indeed worked for more than 2 years in different roles in the dield
@curelordplusplus
@curelordplusplus 8 жыл бұрын
This save my life! Thank so much!
@amanofculture5575
@amanofculture5575 2 ай бұрын
Hello what have you become, are you now working in the field?
@mohitbaby1974
@mohitbaby1974 26 күн бұрын
Before this video I watched 2 video but I didn't understand from them but this video show in simple way by which I understand everything 💯💯
@she2787
@she2787 Жыл бұрын
watching this 3 hours before my test and ill get the 8 marks all thanks to you!!
@Orange_Pulp
@Orange_Pulp 8 жыл бұрын
finally, a comprehensive explanation of this. Thanks!
@amanofculture5575
@amanofculture5575 2 ай бұрын
Hello what have you become, are you now working in the field?
@ammarm7
@ammarm7 7 жыл бұрын
This was a life saver. Thanks man!
@ravindrabhegade4000
@ravindrabhegade4000 5 жыл бұрын
Fantastic! Very easily explained.
@htaka_1218
@htaka_1218 7 жыл бұрын
saved me a lot of time, easy tutorial thanks a lot!
@diananizam8617
@diananizam8617 2 жыл бұрын
tysm! it's so easy to understand it when you explained!
@idc237
@idc237 7 жыл бұрын
The fps is amazing in this video...ahhh, also great explanation!
@amanofculture5575
@amanofculture5575 2 ай бұрын
Hello what have you become, are you now working in the field?
@hamzahabdelaziz6532
@hamzahabdelaziz6532 4 жыл бұрын
I think one reason for using the bias instead of two's complement is to maintain the order of the numbers with respect to their value. So, the binary inequality x > y is valid.
@vidyajaishankar8501
@vidyajaishankar8501 5 жыл бұрын
This was so helpful. Thanks!
@edgariscoding
@edgariscoding 6 жыл бұрын
Best explanation on I've seen and you've got perfect English. 😛
@Kniffel101
@Kniffel101 7 жыл бұрын
Thank you very much, you are very good at explaining this! :)
@raymondkalumbajoseph3943
@raymondkalumbajoseph3943 6 жыл бұрын
wooow you have made me understand it way batter than my lecturer, thanks
@amanofculture5575
@amanofculture5575 2 ай бұрын
Hello what have you become, are you now working in the field?
@jinhyunso9308
@jinhyunso9308 4 жыл бұрын
Thanks for your explanation. It is very clear
@SonuKumar-ju2ok
@SonuKumar-ju2ok 2 жыл бұрын
Thanks a lot I found a person that u who discuss the actual exponent which is in negative
@koober_
@koober_ 6 жыл бұрын
Clear explanation; couldn't really grasp it during CDA no matter how much I tried, because of the whole thing being just PowerPoints. Also, bonus points for using Pilot pens, I have the same kind! And even more for providing source code!
@amanofculture5575
@amanofculture5575 2 ай бұрын
Hello what have you become, are you now working in the field?
@allichetina2825
@allichetina2825 8 жыл бұрын
Enfin j'ai compris une manière très simple et très efficace! merci
@kostyashoomsky4201
@kostyashoomsky4201 8 жыл бұрын
Excellent! Very good explanation! And i don't understand the complaints about the formula used in the end.It's logical! If you understand what's going on in there then this formula seems obvious to you! Anyway...Thanks!
@hellnoid90
@hellnoid90 8 жыл бұрын
great video, very clear
@abhinav6476
@abhinav6476 4 жыл бұрын
u legend saved me watching a 2 hr lecture
@sabuein
@sabuein 3 жыл бұрын
Thank you, Steven.
@sayanneogie
@sayanneogie 6 жыл бұрын
thank you so much for this explaination
@boody7665
@boody7665 6 жыл бұрын
Thank you Steven
@dynraf
@dynraf 6 жыл бұрын
Thanks mate I passed my midterm because of you
@amanofculture5575
@amanofculture5575 2 ай бұрын
Hello what have you become, are you now working in the field?
@nivien7220
@nivien7220 3 жыл бұрын
You are doing a god's work, thank you so much for this.
@abdallahbukhari4382
@abdallahbukhari4382 3 жыл бұрын
You're a life saver!
@gastone.bailador6792
@gastone.bailador6792 5 жыл бұрын
Gracias desde Argentina, necesitaba saber como se hacía la cuenta :)
@KevinDuan7
@KevinDuan7 5 жыл бұрын
This video is a godsend thank you very much
@Worldnme
@Worldnme 6 жыл бұрын
thanks helped a lot
@KansasFashion
@KansasFashion 6 жыл бұрын
Love you bae! You amazing!
@diegosiempreazul
@diegosiempreazul 6 жыл бұрын
gracias tio gringo
@Takaia42
@Takaia42 6 жыл бұрын
For those who wanted to watch the video mentioned at 2:12 referencing bias, here it is: kzbin.info/www/bejne/qqmQfpKops2oi6M
@austinfritzke9305
@austinfritzke9305 4 жыл бұрын
Thank you for using a pen this time
@aaftabahmed6876
@aaftabahmed6876 6 жыл бұрын
When to take 128 and 127 exponent in biased adding exponent
@Wingafalei
@Wingafalei 6 жыл бұрын
Can you explain the significance of -1^s? S may only be 0 or 1, and -1^0 and -1^1 both equate to -1. Due to this, I am getting the correct answer for every number I try, but it is always a negative.
@Akatsuu
@Akatsuu 5 жыл бұрын
It should have been (-1)^s so that s=0 gives you +1 and s=1 1 gives you -1
@weegenissrival7390
@weegenissrival7390 3 жыл бұрын
thank you dude
@fridah6287
@fridah6287 5 жыл бұрын
How do you find out the sign of the number? I get that 0= pos and 1 = neg but what made him come to that conclusion is it based on the first digit?
@alfabetony
@alfabetony 4 жыл бұрын
good video
@diegoluna530
@diegoluna530 5 жыл бұрын
Thank you steve. Scuba Steve jiji
@arthurhu2290
@arthurhu2290 Ай бұрын
I was looking for how to get decimal digits something -e x powers of 10 like 1.2e1 for 12
@csrevolt
@csrevolt 6 жыл бұрын
Thank you, this was very helpful! But for the sake of curiosity/masochism, then why does 0x00000000 = 0.0? [0] [00000000] [00000000000000000000000] Sign: -1^0 = 1 Exp: (0 - 127) = -127 M: (1 + 0.0) = 1.0 (1) * (1) * (2^-127) = 5.8775e-39, or 0.0000000000000000000000000000000000000058775 Which is extremely close to zero, but still not quite. If it is simply rounded to 0.0 at some point because the number is ridiculously small, i'd understand, but then when I enter 0x00000001 into any online converter, it comes out as 1.4013e-45 which is somehow even smaller. Is it just a rule that 0x00000000 is interpreted as 0.0?
@ronaknarkhede674
@ronaknarkhede674 2 жыл бұрын
3 years and still no one answered 🥲
@pedrompecanha
@pedrompecanha 2 жыл бұрын
it's just a rule, it's a special case, at least that was what I was thought. also, for instance, minus infinity is represented by sign = 1, exp = 255 and M = 0
@Aiven197
@Aiven197 Жыл бұрын
It's a special case. When all bits in the exponent are 0, the formula changes and now Exp = 1-bias (127 for 32 bits) and M = 0+mantissa. As you can see, with this 0x0 = 0.0. Another special case is when all bits in the exponent are 1, where you have 3 options: -If the sign bit is 0 and all bits in the mantissa are 0, then the value is infinity -If the sign bit is 1 and all the bits in the mantissa are 0, then the value is minus infinity -If the sign bit is 0 or 1 and any bits in the mantissa are not 0, then the "value" is NaN (Not a number)
@BCGJohnny
@BCGJohnny 8 жыл бұрын
e is still same ?
@s.u.5285
@s.u.5285 5 жыл бұрын
why would you want answer in that form as oppossed to -8.2152949e-34 OR 0.00000000000000000000000000000000002152949 ? Any other reason besides convenience?
@nickspringer5755
@nickspringer5755 3 жыл бұрын
Man I thought e was Euler’s number and I was like wtf
@option2303
@option2303 3 жыл бұрын
lol
@birenpatel4191
@birenpatel4191 6 жыл бұрын
How did he get 17-127 for the exponent? I understand where 127 comes from but where does 17 come from?
@mateuszszwed3487
@mateuszszwed3487 5 жыл бұрын
17 = 16 + 1 = 2^4 + 2^0 = 100001 in binary
@arpitmenghre9210
@arpitmenghre9210 5 жыл бұрын
By converting exp(binary) into decimal
@demetresaghliani9048
@demetresaghliani9048 6 жыл бұрын
Don't you need to do a two's complement to the number first? As far as I understand, the decimal representation of a negative binary number, using two's complement, is -(two's complement(the number)).
@alfianrsa
@alfianrsa 7 жыл бұрын
hey bro.. Why the mantissan value which is m = 2 power of(-4) + 2 power of (-8) = suddenly become 0.06640625 can you tell me the details to get that value. Thanks in advance
@bratbalal9042
@bratbalal9042 7 жыл бұрын
Alfian rs its in base 2 and need to convert to base 10, first digit after 0. is 2 to the power -1, fourth digit2 to the power -4, eighth digit 2 to the power -8
@kutilkol
@kutilkol 7 жыл бұрын
try calcualting 2^-4 + 2^-8= 8^-1 + 256^-1 = 0,06640625
@BrainSlugs83
@BrainSlugs83 6 жыл бұрын
That's literally how numbers work, bro. -- Like... 2^(-4) + 2^(-8) == 0.06640625. -- Is your question about how negative exponents work? -- 'cause ... I mean... just use a calculator? -- If you really need to do it in your head, instead of using negative exponents (i.e. each bit having a value of 2^(-1), 2^(-2), etc..) -- just assign each bit fractional power of two values; that is: 1/2, 1/4, 1/8, 1/16 and so on (it's a bit more readable IMHO). -- So, in this case, you're just adding 1/16 + 1/256 == 0.06640625.
@erudition6516
@erudition6516 6 жыл бұрын
thnks..
@sohambhattacharya8048
@sohambhattacharya8048 4 жыл бұрын
Well actually the reason for not representing the exponent using 2's complement is not unknown. IEEE did it so that it was easier to sort. In a biased expression. You can just look at the exponent and say whether a number is greater than or less than another number. If it was in a 2's complement format then a quick sorting would take more time since you had to convert the 2's complement and then compare
@stevenpetryk6869
@stevenpetryk6869 4 жыл бұрын
Right, it was unknown to *me*-I wasn't trying to imply that they did it for literally no reason, that would be silly. I appreciate the explanation though, hopefully others will find it useful :)
@stu6097
@stu6097 3 жыл бұрын
how does this process differ from converting "ms binary" format single precision binary to decimal?
@stevenpetryk6869
@stevenpetryk6869 3 жыл бұрын
¯\_(ツ)_/¯ never heard of MS binary
@stu6097
@stu6097 3 жыл бұрын
@@stevenpetryk6869 It was used before IEEE format on IBM 360 computers. The layout is different for where to find the sign bit, and bais is 128 but their might be some other trick to getting a floating point number out. I was looking for the manual handwritten way of understanding the math. en.wikipedia.org/wiki/Microsoft_Binary_Format
@stevenpetryk6869
@stevenpetryk6869 3 жыл бұрын
@@stu6097 seems like it might just be the same but with the fields swapped around.
@codewithluca
@codewithluca 8 жыл бұрын
what if I have to write the number as X*10^Y instead of M*2^E as you have written in the end? Can you please answer asap because I have an exam tomorrow!
@LIFE4VW
@LIFE4VW 5 жыл бұрын
Wait, the highest possible number to the exponent is 127 and the lowest is -126! That´s what I was tought for. Can somebody explain please?
@Antchovi
@Antchovi 5 жыл бұрын
Highest is 128, lowest is -127. If you think about it rationally, since the exponent is 8 bits, you know that if it's unsigned 1111 1111 gives you 255, and 0000 0000 gives you 0. Since the bias is -127, you just subtract that from whatever you have in the exponent. so the highest possible number is 255-127= 128, and the lowest possible is 0-127= -127. Does that help?
@LIFE4VW
@LIFE4VW 5 жыл бұрын
@@Antchovi It does! Thank you a lot, my teacher have told the wrong number to our class. I "confronted" him with it and he did explain once more with the right numbers. After the first time the class was: i`m quit.
@ekhliousful
@ekhliousful 7 жыл бұрын
what is the EXP.? & mantissa?
@alfianrsa
@alfianrsa 7 жыл бұрын
EXP = Exponent
@BrainSlugs83
@BrainSlugs83 6 жыл бұрын
Mantissa is the significand (biased by 1): en.wikipedia.org/wiki/Significand Exp is the exponent (biased by 127): en.wikipedia.org/wiki/Exponentiation
@indrajaindhu1321
@indrajaindhu1321 5 ай бұрын
What is 1+m
@quantabot1165
@quantabot1165 3 жыл бұрын
are you eigenchris who teaches tensors....sound v like him
@MN245MN
@MN245MN 5 жыл бұрын
Sure that's not 10^-110?
@s.u.5285
@s.u.5285 5 жыл бұрын
6:03 "formula on the power points" ? Where is this formula?
@stevenpetryk6869
@stevenpetryk6869 4 жыл бұрын
These videos were made for students at University of Central Florida and got popular on accident-I was addressing those students when I said that :)
@AmCanTech
@AmCanTech 2 жыл бұрын
github link is dead
@stevenpetryk6869
@stevenpetryk6869 2 жыл бұрын
True that. Must’ve deleted the project at some point. It was some old, not-great React code anyway.
@AmCanTech
@AmCanTech 2 жыл бұрын
@@stevenpetryk6869 looks cool anyways
@ignaciobarrios4130
@ignaciobarrios4130 3 жыл бұрын
What about 64 bits?
@stevenpetryk6869
@stevenpetryk6869 3 жыл бұрын
Same shit, but the exponent has 11 bits and a bias of 1023, and the mantissa has 52 bits: en.wikipedia.org/wiki/Double-precision_floating-point_format
@ib9rt
@ib9rt Жыл бұрын
But you did not complete the job of converting the result to decimal? By leaving the exponent as a power of 2 the job is only half finished.
@stevenpetryk6869
@stevenpetryk6869 Жыл бұрын
It was done to the degree demanded by the homework assigned by my professor at the time. This video wasn’t intended for a wider audience.
@HamedAdefuwa
@HamedAdefuwa 4 жыл бұрын
127 so all bits zero means zero.
@quantabot1165
@quantabot1165 3 жыл бұрын
this is a v familiar voice
@harshshah1953
@harshshah1953 6 жыл бұрын
from where 17 came
@Akatsuu
@Akatsuu 5 жыл бұрын
0001 0001 is equal to 17 in decimal
@mohammadaxelariapaskha2056
@mohammadaxelariapaskha2056 3 жыл бұрын
6:30
@stevenpetryk6869
@stevenpetryk6869 3 жыл бұрын
Agreed.
@oumalilmi4882
@oumalilmi4882 Жыл бұрын
Suite de ce exercicr
@oumalilmi4882
@oumalilmi4882 Жыл бұрын
Mercieee infinement monsieur
@MrParisjunior
@MrParisjunior 8 жыл бұрын
"for unknown reasons" they were problably high that they.. ahah
@BrainSlugs83
@BrainSlugs83 6 жыл бұрын
Nah. -- I mean... maybe? ... but irrelevant... -- Bottom line is they cranked this shit out in the 50s and 60s, and two's complement hadn't won the war yet on signed number representation. At least they were consistent... like, the mantissa is also biased (by 1, as he explains, though with different language...) -- Bottom line is: when all you have a hammer, every problem looks like a nail. :)
@dkeisk
@dkeisk 4 жыл бұрын
please not to add the brackets when solving so instead of writting -1^s you should write (-1)^s because -1^s = -1 in case s is 0 or but the (-1)^s= 0 when the s is 0 and -1 when s is one!!!!
@stevenpetryk6869
@stevenpetryk6869 4 жыл бұрын
yeah you're right, sorry!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
@BCGJohnny
@BCGJohnny 8 жыл бұрын
can i ask why minus 127 ?
@supposetobenick
@supposetobenick 8 жыл бұрын
+BCGJohnny because if you have studied binary representations you would know that in biased representation for n-bits(this case 8) 00000000(binary) maps to -(n^2) -1 and other goes upward. Since you want the real value u have to convert. For example, if your exponent u get a value for 0000000( normal binary) u get 0(decimal) but basically in biased representation it is -127(decimal)
@BrainSlugs83
@BrainSlugs83 6 жыл бұрын
It's called "Excess-127", it's an alternative binary encoding for signed numbers; basically when he says to subtract 127, he's just explaining how to interpret these kinds of values as decimal numbers. More info: en.wikipedia.org/wiki/Signed_number_representations#Offset_binary en.wikipedia.org/wiki/Offset_binary#Excess-127
HOW TO: Adding IEEE-754 Floating Point Numbers
5:26
Steven Petryk
Рет қаралды 202 М.
HOW TO: Convert Decimal to IEEE-754 Single-Precision Binary
11:05
Steven Petryk
Рет қаралды 448 М.
Floating Point Numbers
17:30
0612 TV w/ NERDfirst
Рет қаралды 119 М.
Comparing C to machine language
10:02
Ben Eater
Рет қаралды 5 МЛН
IEEE 754 Floating Point Representation to its Decimal Equivalent
7:26
Abishalini Sivaraman
Рет қаралды 458 М.
IEEE 754 Standard for Floating Point Binary Arithmetic
21:34
Computer Science
Рет қаралды 239 М.
Floating Point Numbers - Computerphile
9:16
Computerphile
Рет қаралды 2,3 МЛН
Designing a 7-segment hex decoder
15:33
Ben Eater
Рет қаралды 3,7 МЛН
Was Richard Feynman a Liar?
7:50
Dr Brian Keating
Рет қаралды 1 М.
Hashing Algorithms and Security - Computerphile
8:12
Computerphile
Рет қаралды 1,5 МЛН
Representations of Floating Point Numbers
13:50
Neso Academy
Рет қаралды 187 М.
АЙФОН 20 С ФУНКЦИЕЙ ВИДЕНИЯ ОГНЯ
0:59
КиноХост
Рет қаралды 1,1 МЛН
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 440 М.
BEKMOBILDA Tecno Camon 30 smartfoni🔥🤩 #bekmobil
1:01
Bekmobil shorts
Рет қаралды 2,3 МЛН
Что делать если в телефон попала вода?
0:17
Лена Тропоцел
Рет қаралды 2,5 МЛН
Красиво, но телефон жаль
0:32
Бесполезные Новости
Рет қаралды 1,5 МЛН