A shelf price describes one package, not the amount inside it. Unit price creates a common baseline by dividing the package price by its complete quantity. The measurement unit must stay attached to the number throughout the calculation.

Use price divided by total quantity

For a €4.50 bag containing 500 grams, first express 500 grams as 0.5 kilogram, then divide €4.50 by 0.5. The result is €9.00 per kilogram. A €8.00 one-kilogram bag is therefore cheaper per kilogram even though its package price is higher.

Normalize only compatible dimensions

Grams, kilograms, ounces, and pounds all describe weight and can share a kilogram baseline. Millilitres and litres describe volume and use a litre baseline. Weight and volume cannot be compared without reliable density, so a general calculator must keep those categories separate.

Compare before rounding

Two displayed prices may both look like €0.03 per item while their internal DECIMAL128 values differ. Normalize and rank those internal values, then round unit prices to six decimals and percentage savings to two for display. Also verify that taxes, deposits, and promotion conditions are represented consistently.