On 3/1/2014, 12:16 AM, RSmith wrote:
On 2014/02/28 23:36, L. Wood wrote:
SQLite has the REAL data type:

https://www.sqlite.org/datatype3.html

Then why do we have SQLITE_FLOAT instead of SQLITE_REAL? All the other data
types (INTEGER, BLOB, TEXT, NULL) match with the SQLITE_ constants.

Quoting Shakespeare's Juliet:
"What's in a name? that which we call a rose by any other name would smell as
sweet..."

Of course in matters of love one can nod to that, but it can't be more wrong in
SQL or any code terms!
This may be a quirk, but in the defense, those type names are interchangeable
(or I should say Aliased) in most modern languages.

If you're going by semantics though, the meanings are quite different.

A real number represents a point on a line and can be either a rational or irrational number. (And a complex number is a point on a plane.) An important bit is that a real is a more abstract concept and doesn't imply a single right representation.

In contrast, a float is much more specific, defining also a representation, and as such a float can only be a rational number (x*y^z where all 3 are integers, and y is typically 2) and not an irrational. (Or I suppose if you allow {x,y,z} to be non-integers then a float is even more about a representation.)

Speaking in terms of programming language design, "real" is best suited for an abstract type name, that is one that defines an interface for using a set of types, same as "numeric". Whereas, "float" is best suited for the name of a concrete type, like with "integer" and "ratio". (Well strictly speaking all of these could be abstract types, but the latter set are more specific in meaning, and in particular "ratio" and "float" imply a representation while the others don't.

-- Darren Duncan

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to