On Nov 5, 2009, at 5:15 PM, Beau Wilkinson wrote: > > Assuming (and perhaps this is the rub...) that Sqlite is built > around C++ "float" and "double," then I fail to see how any FP > system that is even plausibly useful could give the results cited by > Mr Drozd. If I put (for example) the value 100.0 into a "double," > and then transport or store/retrieve the binary representation > somehow, and then take those bits and once more treat them as a > "double," then I ought to get 100 (or at least something very, very > close). These are the sorts of things that Sqlite should, to my mind > at least, be doing with real number data, and it ought not to matter > what the underlying representation is. >
This is exactly what SQLite does. It uses the C (not C++) double type for floating point operations. It assumes that double is represented by 64 contiguous bits in a format that can be understood by different architectures and it blindly copies those bits to disk. Later, it reads the same bits back from disk and copies them into another double. If you write a double into an SQLite database on a machine that has IEEE FP, then transfer that database to another machine with a different floating point format, then read the double out of the database, the bits won't be right and you'll get a weird answer. This comes up a lot on ARM because of the use of mixed-endian representation - neither big-endian or little-endian. I thought we had worked around that problem, but perhaps you have found a way to defeat our work-around. We've also seen problems with GCC's floating point optimizer going overboard and simply generating bad code when the --fast-math opton is specified. We recommend that you not use --fast-math. I'm sorry that you are having difficulty and that SQLite is not working to your satisfaction. But the fact remains that it works great on every platform that I have access to. If you are able to find a bug in SQLite we will be happy to look into it for you. But we have no capability of helping you with your ARM problems. D. Richard Hipp d...@hwaci.com _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users