You are here: Re: truncating « MsSQL Server « IT news, forums, messages
Re: truncating

Posted by Erland Sommarskog on 10/01/14 11:40

mmt1 (mehrnaz.monajati@gmail.com) writes:
> I have a multiplier that multiplies 2 floating point numbers with 7
> bits exponent and 10 bits mantissa.so its output has 7 bits exponent
> and 20 bits mantissa.
> now its output must return to its input in order to compute another
> multiplication.on the other hand its output must be truncated to 10
> bits. how can I do this? please help me.

This questions appears somewhat strange in the context of SQL Server.
How is your data stored?

In SQL Server there are two data types for floating-point values,
real and float. real values have a 24-bit mantissa and 7-bit exponent
and float have a 53-bit mantissa.

Using these in the manner you ask for. If you have

DECLARE @a real, @b real, @c real
...
SELECT @a * @b * @c

SQL Server first (probably) computes @a * @b which yields a new real
number which then is multiplied with @c.

--
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

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