Skip to content

Feature request: Don't use floating point mathematics for money values. #28

@hackathi

Description

@hackathi

If there is one rule when it comes to handling anything financial, it's don't use floating point data types for money values. Instead, multiply by 10 until you no longer have floating point mathematics at all.

not-grocy's stock table currently has DECIMAL(15,2) as the price type. SQLite doesn't care what you throw at it; so it happily accepts all kinds of floats and saves them as the REAL data type.

image

bad, bad, bad, bad, bad.

Solution (for v5): re-do the database, I'm absolutely sure that this goes far further than just one column. Most probably all aggregations and mathematics in php are broken as well. Granted, not-grocy doesn't really need cent-accurate calculations for tracking etc. But good lord, I want this gone so bad.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions