IMPLEMENTING LDIM The format used by SQL Server

IMPLEMENTING LDIM The format used by SQL Server for the byte stream that it saves on disk is determined by the implementation of IBinarySerialize. The value field of LDim is a double. A detailed explanation of the representation of floating point numbers is beyond the scope of this chapter, but suffice it to say that the sort order of the representation in memory of a floating point number is not the same as the sort order of the numbers they represent. Listing 5-12 shows a SQL batch file that demonstrates this. Listing 5-12: Order of Floating Point Numbers create table Numbers ( F float ) go Insert into S values (1) Insert into S values (0) Insert into S values (-1) go select * from Numbers order by F go F -1 0 1 select * from Numbers order by Convert(binary, F) go F 0 1 -1 When the rows in the Numbers table are sorted by the F column, the rows are ordered as we would expect them to be. However, if the rows are ordered according to their binary representation, 0 comes before 1 and 1 comes before 1 not what you would expect. Listing 5-13 shows the implementation of Write. Listing 5-13: Implementation of Write public void Write(System.IO.BinaryWriter w) { if (IsNull) { for (int index = 0; index < = 9; index++) { Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost PHP Web Hosting services

Bookmark the permalink.

Comments are closed.