Hi, i want to know which is the preferred datatype for numeric fields.
Decimal or float? and why?
Are there any performance, acurate reasons to pick one of them?
thanks
Are there any performance, acurate reasons to pick one of them?
thanks
Compared to these results:
Quote:> Hi, i want to know which is the preferred datatype for numeric fields.
> Decimal or float? and why?
> Are there any performance, acurate reasons to pick one of them?
> thanks
> Compared to these results:
>>Hi, i want to know which is the preferred datatype for numeric fields.
>>Decimal or float? and why?
>>Are there any performance, acurate reasons to pick one of them?
>>thanks
= 7.7000
but
= 8 ?
decimal + decimal = int ?
is decimal declaration having no decimal assigned to it by default ?
-ashish
You should avoid float. At least working on visual basic IQuote:>-----Original Message-----
>Hi, i want to know which is the preferred datatype for
numeric fields.
>Decimal or float? and why?
like update some column = 7
and when I read the equialent txtfield in a VB form it is
7.0000056.... etc.
bye fabianc.
Quote:>Are there any performance, acurate reasons to pick one of
them?
>thanks
>.
-- Pro SQL Server 2000 Database Design Note: Please reply to the newsgroups only unless you are
> > Float does some weird rounding things... try these out:
> > Compared to these results:
> >>Hi, i want to know which is the preferred datatype for numeric fields. > >>Are there any performance, acurate reasons to pick one of them? > >>thanks > howcome
> = 7.7000 > but
> = 8 ? > decimal + decimal = int ? > is decimal declaration having no decimal assigned to it by default ? > -ashish
---------------------------------------------------------------------------
-----------
Compass Technology Management
http://www.apress.com/book/bookDisplay.html?bID=266
interested in consulting services. All other replies will be ignored :)
> >>Decimal or float? and why?
-- Pro SQL Server 2000 Database Design Note: Please reply to the newsgroups only unless you are
> Are there any performance, acurate reasons to pick one of them? > thanks
---------------------------------------------------------------------------
-----------
Compass Technology Management
http://www.apress.com/book/bookDisplay.html?bID=266
interested in consulting services. All other replies will be ignored :)
> Decimal or float? and why?
Money doesn't lose precision ... *if* it is only used for addition,
subtraction, and
multiplication by integers.
Unfortunately, the careful rules by which decimal calculations are
designed
to do their best to hold both good precision and scale are out the
window when
it comes to money.
Suppose you pay $2.57 per 10,000 widgets. How much are you paying for
each?
select $2.57/10000
Oh-oh. Money has it's place, but it can also lead to very bad results.
You might
argue that 0.000257 isn't supposed to be well-represented as money,
which only
has 4 decimal places of precision, but there are plenty of other money-type
problems - for reasons I can't understand, money/money is money, not pure
number, and the precision can't be handled correctly. You might want to
divide monetary values to figure out, say, what fraction $1.23 is of a
$2137 bill:
select $1.23/$2137
It's off by a lot - in my opinion, because the answer is wrongly typed
as money.
So beware.
-- Steve Kass
-- Drew University
-- Ref: D3F842EE-4910-40CA-A345-CAF0A63A9CE8
1. Converting float to decimal
We are considering changing some numberic data types in Sybase from float to
decimal (which is new with System 10). Is this recommended and has anyone
had any problems using the decimal data type in Sybase?
2. Can't do a script right. Help!
6. Accessing a Lotus Notes 4.6 database using HTML/Javascript?
7. Converting to float or decimal
9. Converting FLOAT to DECIMAL
10. float vs decimal
12. What's different between Float and Decimal datatype in Sql server