473,550 Members | 2,911 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Should floating point calculations be doing in sql or C#?

Hi,

I would like to know, if I need to do some floting point operations
(mainly multiplication and division) on each roll of a table, should I
read the data out from the DB and do the calculation with a programming
language, say C#, or should I just use sql to do it on the sql server.

An obvious advantage of doing it in the sql server is that you dont
need to transfer the data between the sql server and he application
server.

But I am not sure if there are any other factors that will override
this advantage: like the performance of doing lots of floting point
operations in sql server.

How is the performance of doing floting point operations in sql server
comparing to C# or other languages?

Also are there any other factors that should be considered for this
case and
are there any other advantages to do this is sql server or in c#?

Thanks
Benny

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
1 3246
Benny wrote:
Hi,
I would like to know, if I need to do some floting point operations
(mainly multiplication and division) on each roll of a table, should I
read the data out from the DB and do the calculation with a programming
language, say C#, or should I just use sql to do it on the sql server.

An obvious advantage of doing it in the sql server is that you dont
need to transfer the data between the sql server and he application
server.
That's it. The biggest performance mistake with RDBMSes is to treat
them like dumb filing systems. If you can define your operation so
the DBMS can process the table using standard SQL, with set-based
processing, you will be using what DBMSes are designed to do fast.
You build your sawmill where the trees are. The floating point operations
*will* be done in C/C++. That's what the DBMS is written in, and they don't
re-invent the wheel to multiply IEEE floats... If your calculation SQL
is in a stored procedure, it's query plan will be pre-compiled and
ready to re-use.
Joe Weinstein at BEA
But I am not sure if there are any other factors that will override
this advantage: like the performance of doing lots of floting point
operations in sql server.

How is the performance of doing floting point operations in sql server
comparing to C# or other languages?

Also are there any other factors that should be considered for this
case and
are there any other advantages to do this is sql server or in c#?

Thanks
Benny

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3847
by: anagai | last post by:
hi Isnt it true that floating type can generate rounding errors if the values are rounded to like the 10th decimal. Since currency is rounded only to the 2nd decimal why must i worry about using float for currency calculations? decimal is slow and memory hog. is it true that mysql calculates internally using double float?
687
23004
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't believe that. in pieces of the application where speed really matters you can still use "normal" functions or even static methods which is...
9
2223
by: Klaus Bonadt | last post by:
I have found strange behaviour in casting floating point values in C++ 6.0 to int: If I enter in the watch window while debugging in version 6.0 the following term: (1.4 - 1.0) * 10.0 the result will be 4.0 - as expected. But if I cast the same to int: (int)((1.4 - 1.0) * 10.0)
7
1963
by: Hiten | last post by:
Hi please check ffollowing conditon variable float1 and float2 holds user entered value..... Answer=float1 * float2; //output must be 8.5 output must to be 8.5 but it has 8.500002, i am confused at this point i used calculators and other calculation mathods to see the actual value and thet give correct 8.5 with no other decimals......
9
1769
by: David Veeneman | last post by:
I'm working on a project that uses floating-point values (doubles), and I'm being driven crazy by something pretty basic. I understand that it's in the nature of floating-point calculations to produce values like 0.10000000000000003, when what I really want is 0.1. But is there any way to eliminate that digit at the end? I've tried rounding,...
3
311
by: alex | last post by:
hi friends ... i am facing a problem while detecting floating point operations in my project, please help me. i want to find out the places in my C/C++ project where i am doing floating point operations. As it is a big project it is not possible to check every line manually, so is there any other method to detect floating point...
39
3526
by: rembremading | last post by:
Hi all! The following piece of code has (for me) completely unexpected behaviour. (I compile it with gcc-Version 4.0.3) Something goes wrong with the integer to float conversion. Maybe somebody out there understands what happens. Essentially, when I subtract the (double) function value GRID_POINT(2) from a variable which has been assigned...
6
17054
by: Matthew | last post by:
Hi, I want to change the precision level of floating point variables and calculations which is done in php.ini. However the server I rent for my domain does not give me access to php.ini, they say 'for security reasons'. Can the precision level be changed by PHP code as needed?
6
1493
by: fred8865 | last post by:
Hi all, I understand that due to different arithmetic used in floating points they are just approximations. Hence, 180/100=1 in my python interpreter. How can I tackle this problem of inaccurate floating point numbers? thank you regards xtd
0
7560
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7487
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7758
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7998
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6098
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5401
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5126
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1093
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.