You are here: Re: float storage and usage « MsSQL Server « IT news, forums, messages
Re: float storage and usage

Posted by Erland Sommarskog on 06/08/07 21:07

Jeff Kish (kishjjrjj@charter.net) writes:
> the data represents coordinates on images that can vary vastly in
> scale and precision.
> The primary key well... each row in the table represents a text
> display on an image.. the row has columns for:
> book
> page
> label
> xcoord
> ycoord
> because the same label can appear several times on one page in a book,
> the coords are included.
>
> one page might vary from -1.234565 to 1.3234343 in extents, placing
> all coordinates in that range, and another might be a different type
> of image and range from -10245 to 10245.

Could you have coordinates that are 1E12 or 1E-12 as well? I would
expect that is after all some practical limit. In this case you could use
something like decimal(20,10). Or may be varchar is an alternative? I
would definitely avoid float.

Yet an alternative is some roll-your-own decimal. That is, you would
save the coordinates as integer, and you would store the scale separately,
possibly in a table with the page as key.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация