Antony Curtis wrote:
On Thursday, January 15, 2009, at 01:56PM, "Jim Starkey" <[email protected]> wrote:
Jay Pipes wrote:
Roland Bouman wrote:
Hi!

On Thu, Jan 15, 2009 at 9:30 PM, Brian Aker <[email protected]> wrote:
I thought that this might make for a nice comparison:
http://www.sqlite.org/datatype3.html

Not much :)
Indeed. I'd say...too little.

Really - there has to be DECIMAL and DATETIME (or else DATE and TIMESTAMP)
Agreed, although DECIMAL in Drizzle/MySQL is really a text field... (shhh, don't tell anybody!)

Oh, I don't think so. Better look again. It's not text, it's not binary, and it certainly isn't pretty. It does compare naturally, though.

MySQL hasn't used plain text to store decimals for quite some time... it has 
had a base 10^9 representation for it's decimal type. I think it was introduced 
in the 4.1 era or maybe 5.0 but I cannot remember right now.

Each 32bit word stores a binary number from 0 to 999999999.

Yes, well, sort of. It's actually two variable length vectors, one for the "digits" to the left of the decimal point, the other the number of "digits" to the right of the decimal point. It's clear that the fellow who designed it missed school on the day they covered bases.

A more intelligent, denser, faster, and more intuitive format would use a single vector of binary words. On a challenge from Monty (W.), I did a relative performance measure between the Falcon decimal type and the "server" type. The worst case (> 18 decimal digits of precision) showed Falcon 40% faster. For anything less than 18 decimal digits of precision, Falcon was approximately infinitely faster (Falcon uses a 64 bit int with a decimal scale factor).

For you guys that missed school when they covered fractions, a number with a decimal point can be expressed as an integer and a power of ten. It isn't necessary to track separate integers for the portion to the left and to the right of the decimal point.

My very first paying job as a programmer was a summer job at A.C. Nielson, the TV rating guys, working in 360 assembler. Reading through a program (they called them routines to avoid the obvious confusion), I saw a piece of code that converted two numbers in registers to packed decimal, added them, and converted them back to binary in another register. I asked the guy who wrote why he didn't just add the two numbers in the registers. He explained that the numbers were actually decimal, so they had to be added as decimal. Binary numbers, he said, could safely be added in binary, but these numbers were decimal. Duh. Silly me.

So, after we've covered encapsulation, polymorphism, and exception handling, we're going to have a refresher course in fourth grade arithmetic. Is everyone sitting comfortably?

(The advanced course will cover why if something is denser, faster, and takes less code, it should be considered as an alternative. But please don't tell W.)

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to