Skip to content

Switch to BCMath #555

Closed
Closed
@CodeMonkey90

Description

@CodeMonkey90

Currently, Magento uses floats to represent prices internally. This is a very bad design decision, as binary floating point numbers cannot accurately represent decimal values, which means you have to manually correct the resulting loss of precision after complex calculations. This process is error-prone. Fortunately, the BCMath extension, which is enabled by default, provides arbitrary-precision decimal math.

I'd suggest that Magento moves from floating point calculations to BCMath calculations in the long term. Since PHP converts numeric strings to floats automatically when necessary, the code can be slowly migrated on a module-per-module basis.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions