![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have found several sources stating that the numeric data type in SQL Server (without vardecimal options set) stores numbers of precision 10-19 in 9 bytes. Since 19 * ln(10) / ln(2) ~= 63.11 => 65 bits with sign => 9 bytes, I understand 9 bytes at this end of range. However, 10 * ln(10) / ln(2) ~= 33.22 => 35 bits with sign => 5 bytes. Why does SQL Server use the 'extra' 4 bytes? Is there an alignment requirement? If this is the reason, why not break storage requirements at the base-10 precisions that require 4 bytes and 8 bytes, to be synchronized with 16-, 32-, 64-bit registers? |
#3
| |||
| |||
|
|
Is there an alignment requirement? If this is the reason, why not break storage requirements at the base-10 precisions that require 4 bytes and 8 bytes, to be synchronized with 16-, 32-, 64-bit registers? |
#4
| |||
| |||
|
|
*Is there an alignment requirement? *If this is the reason, why notbreak storage requirements at the base-10 precisions that require 4 bytes and 8 bytes, to be synchronized with 16-, 32-, 64-bit registers? Look at the Intel instruction set and that should provide answers. It is best to use native hardware data types. *Or if you have hardware with micro code, to invent your own assembly language for your high level languages -- some old Burroughs machines could that and it was impressive! *A Phillips cassette would make them into a COBOL machine, an ALGOL machine, Fortran machine or LISP machine. But more to the point, at the SQL level, we don't care about implementation details. *When you start worrying about things at that level, you start writing SQL that is not portable, tuned for one release of one product only and miss global optimizations because of bit fiddling at the low levels. |
![]() |
| Thread Tools | |
| Display Modes | |
| |