I've found the decimal numbers to be most generally useful in narrow ranges. For reference, here are a couple notes on how other databases implement them:
MSSQL stores up to 38 digits in 17 bytes, with a specific precision. http://msdn.microsoft.com/en-us/library/aa258832(v=sql.80).aspx PostgreSQL is more flexible and supports up to 1000 digits. http://www.postgresql.org/docs/current/static/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL In order to get a jump on the implementation, I would suggest that it might be possible to use C routines from the PostgreSQL project or some appropriately licensed library. Perhaps an author from a numeric library would be willing to donate their work to the SQLite project. Patrick Earl On Sat, Mar 26, 2011 at 7:43 PM, Simon Slavin <slav...@bigfraud.org> wrote: > > On 27 Mar 2011, at 2:39am, Patrick Earl wrote: > >> Base-10 numbers are frequently used in financial calculations because >> of their exact nature. SQLite forces us to store decimal numbers as >> text to ensure precision is not lost. Unfortunately, this prevents >> even simple operations such as retrieving all rows where an employee's >> salary is greater than '100' (coded as a string since decimal types >> are stored as strings). >> >> I would like to encourage the developers to consider adding support >> for base-10 numbers. This is clearly a very pertinent issue, as even >> this month there was another thread regarding decimal support. > > Intersting idea. You will need to develop your own C routines to do > calculations with decimals. Do you feel they should be implemented at a > fixed length or would you want to be able to use decimal strings of arbitrary > lengths ? > > Simon. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users