Why do computers suck at math?

preview_player
Показать описание
What is a floating point number? And why does it produce rounding errors for programmers?

#shorts #compsci #math

Resources:

Рекомендации по теме
Комментарии
Автор

⚡ If you wanna learn to code faster make sure to hit subscribe!!!

Fireship
Автор

if (num1 == 0.1 && num2 ==0.2) {
return 0.3
}
There we go solved it

coompiler
Автор

Finally, I can now show this to mom and tell her I’m better than computers

tanmay______
Автор

"your computer sucks at math"
calculator: my objectives are beyond your understandings

AIM-X_Sidewinder
Автор

To be exact, it's a limitation of the IEE754 floating point standard. There are implementation of arbitrary precision floating point libraries (aka bignums) but they're slower and less optimised for modern CPUs

AmanSingh-wkqu
Автор

“JavaScript is a toy language, so I tried Python instead.”

Hahahahaha

morethanjustasloth
Автор

today I (finally) learned the meaning of "floating" in floating point. great vid

roua.
Автор

damn i wish there was a longer version explaining more on this topic

joaovgarcia
Автор

It's funny that he assumed JS was broken and thought python wouldn't

marc-io
Автор

_”Good job on solving all of the tough questions, this one is the money shot, what’s 0.1 + 0.2?”_
The computer: 😓

Pixelcraftian
Автор

I remember debugging my code for a week until i realised it was the freakin rounding system

FingerprintGamer
Автор

I know in python it’s fixed with:
from decimal import Decimal

X=Decimal(‘0.1’)
Y=Decimal(‘0.2’)

print(X+Y)

flamesnail
Автор

For anyone wondering, the solution, if you want exact decimal arithmetic, is to use a decimal library, such as Python's decimal module.

NeXus
Автор

"Computers use base 2 while humans use base 10"
Me: "the future is not now, young kid"

wanderingbufoon
Автор

“javascript is just a toy language tho” *church bells toll*

animeblackguy_
Автор

Just came through Modeling Methods at university, where we discuss all the ways to circumvent this and other computer problems when performing math ops. Pretty interesting

hudmo
Автор

"And that's why your computer sucks at math" - the stupid machine can't even calculate an 18-digit number correctly

bgaabt
Автор

create two accounts in your bank.
#1 with all your money
#2 with 0.1 cents
move 0.2 cents from #1 to #2 then move back to #1
rinse and repeat

marcframe
Автор

That's why in Python you use the Decimal type, which stores rounding errors when doing calculations, eliminating them. Pretty important when you do finance calculations or any other calculation that requires +15 digit precision.

Sal
Автор

teacher "you only scored 40% in the test"
me "lemme show you something"

Cathay