# Calculating Cost of Items for Finance

**URL:** <https://forum.djangoproject.com/t/calculating-cost-of-items-for-finance/21403>\
**Category:** Getting Started\
**Created:** [June 7, 2023, 5:31am UTC](https://forum.djangoproject.com/t/calculating-cost-of-items-for-finance/21403 "2023-06-07T05:31:03Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [June 7, 2023, 11:14am UTC](https://forum.djangoproject.com/t/calculating-cost-of-items-for-finance/21403/2 "2023-06-07T11:14:55Z")

</div>

I’m not addressing your logic or calculations yet, but the first thing I noticed is that you’re making a major mistake here.

As I wrote in my post at [Design Problem - #4 by KenWhitesell](https://forum.djangoproject.com/t/design-problem/5490/4)

- Never, under any condition or circumstance, for absolutely no reason **whatever** , should you ever, _ever_ even **think** about using FloatField for financial data or financial-related fields. Not for costs, prices, totals, hours, rates, **nothing** - just don’t do it. Use the Decimal field for them.

While this issue goes well beyond just Python and Django, the Python docs at [15. Floating Point Arithmetic: Issues and Limitations — Python 3.11.3 documentation](https://docs.python.org/3/tutorial/floatingpoint.html#floating-point-arithmetic-issues-and-limitations) do a good job of introducing the topic.

Now, regarding your logic - what makes you think something is wrong? Do you have some data that you have tested with that is giving you unexpected values? Or are you getting some type of error message?

---

_[View the full topic](https://forum.djangoproject.com/t/calculating-cost-of-items-for-finance/21403)._
