On Apr 27, 2014, at 6:53 AM, Walter Lee Davis <[email protected]> wrote:

> I believe this is correct behavior. A float is not precise for any definition 
> of that term.

A float is precise for many values, in particular any integer < 2^52 - 1 for 
64-bit float values.

So the 3 most pertinent questions to OP are:

- Why the heck would you use a float as an id???

- What range of ids do you expect to use: min, max, and whether or not with 
fractional parts? (And if you will be using fractions, do you understand the 
rounding issues well enough to guarantee that for a given id, you will always 
provide the same float value?)

- Float is 64-bit on PostgreSQL. Is it 64 bit or 32 bit on MySQL? (Because if 
it's only 32 bit, then 29,312,000 is well out of the range which can be 
represented exactly.)

-- 
Scott Ribe
[email protected]
http://www.elevated-dev.com/
(303) 722-0567 voice




-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/D1ECBA40-5715-45C4-B3D5-BE5F3DD0EB2B%40elevated-dev.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to