Decimal Module in Python For Accurate Floats

preview_player
Показать описание
In this video, we will discuss the decimal module in Python, which is used to work with floating point arithmetics in a reliable way.

◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚

🌐 Social Media & Contact 🌐

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

Mate, you should pass string values in Decimal constructor, like Decimal("0.1") + Decimal("0.2"). It works perfect without double conversion from/to float

bezborodovanton
Автор

would these inaccuracies exist if we just used base of 2^x ?

rizzwan-
Автор

Could somebody please explains the difference between deciding the precision of the Decimal vs rounding ? In case we want a precision of second decimal place (Ex x.xx where x is a number between 0 and 9)

ahmed-samer
Автор

Decimal arithmetic isn’t about “accurate” floats, since it is just as inaccurate as regular binary floats, only in different places. It’s just that the rounding errors are less surprising, because they come out of the same base-10 arithmetic we all learned to do by hand. That’s all.

Python’s decimal module allows you to specify very large precision, but that’s quite separate from the issue of whether base-10 or base-2 arithmetic is better. For example, neither of them can represent 1/3 accurately -- if you want that, you need the fractions module.

lawrencedoliveiro
Автор

i have proble in vidstrem lib, on Audiosender class, ,
when i want I want a way to make the function stop, because when I stop it in a way:
sender2 = AudioSender(awayIP, awayPORT).stop_stream()
Several problems occur, can you help please..

samersaeed
Автор

What an angel! You save my broken head!

cafe
Автор

The other video that you were mentioning where you explained why 0.1 + 0.2 = === You should put the link of that video in your description. Atleast in comments??? @NeuralNine

knvcsg
Автор

I'm banging my wall against the head trying to subtract from Decimal zero

juanfelipeardilagarzon
Автор

num7 package is easier to use and with better precision.

giovannicipriani
Автор

I want to replace my ssd with a new one, but the ssd is embedded in my motherboard, can I remove it? please help me, my laptop is chromebook

dimaspancapamungkas