SQLite Forum

Select of text that matches scientific notation format automatically converted to number
Login
Don't use BLOB for anything to do with this.  BLOBs are neither numbers nor text and you'll be introducing additional processing and complexity.

If you want to store the characters "1.234567890E9" use TEXT affinity.  Of course, since these values will be text, you can't do maths on them, so you won't be able to things like calculate a sum.  It's worth noting that the strings "1.234567890E9" and "1.23456789E9" are different, but they represent the same number.  So don't expect to be able to search for values.

SQLite doesn't have output.  There are no printing functions in SQLite.  The value you get from SQLite depends on which API you're using to access it.  You may get text, a float, a double, an integer, etc. depending on what library you're using.  If you want to see what you'll get, check the documentation of whatever function you're calling.

If you want SQLite to represent a number as text for you, you can use the printf() function as described here:

<https://www.sqlite.org/printf.html>

If you deliberately specify a text format for output you cannot be sure you're going to get back something identical to the value stored.  You're asking for something that looks pretty, not for something accurate to the last bit.  This is not a problem just with SQLite, it's a problem with representing binary numbers as a scientific decimal strings and occurs with almost every computing language.

The number you see ends in '.0' either because you asked for it, or to signify that whatever system you're using is processing that value as if it's floating point, not an integer.

The basic underlying question for the question which started this thread is whether you care about a numeric value, or a particular string which must be reproduced precisely.