Mastodon

πŸ”’ Never use floating-point numbers for money

by Dmytro Litvinov

Share

Long story short: Use Decimal, not Float numbers for money-related stuff.

I had a lack to learn it from from social media when it was called Twitter πŸ˜… and not from my own experience.

Story from Xwitter :)

Python documentation is also worth reading πŸ‘‡

15. Floating Point Arithmetic: Issues and Limitations
Floating-point numbers are represented in computer hardware as base 2 (binary) fractions. For example, the decimal fraction 0.125 has value 1/10 + 2/100 + 5/1000, and in the same way the binary fra…

Since that was in my draft for ~2-3 years, I bookmarked that post from Django Forum πŸ‘€

Design Problem
Feedback - some general thoughts, given with the understanding that I am not familiar with the processing that needs to occur. These entities don’t exist in a vacuum - they exist only to support some type of data management needs. Those needs can and should greatly affect the design of the models. So, working only from general principles while acknowledging my lack of knowledge: There is no need for a Date table requiring other tables to join to it to identify a date. If there are special dat…