On Wed, Jul 1, 2009 at 3:20 PM, Chris Harris<rygu...@gmail.com> wrote:
> There seems to be a near-universal condemnation in best practices
> guides of using floating point types to store prices, and yet this is
> exactly what Solr's example schema.xml does.

Decimals may not have exact representations in binary floating point
numbers.  For example, 0.1 can't be accurately represented, so math
becomes dangerous and rounding errors can accumulate in different
ways.

1.1 - 1.0  != .1

A 32 bit float has about 7 decimal digits of accuracy, which can
represent prices up to 99,999.99
That seems fine for the example, no?

-Yonik
http://www.lucidimagination.com

Reply via email to