vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Very interesting ideed... Try DECIMAL(20,17)... I'm just guessing... I even don't know if it works... I use DECIMAL(16,4) as the data type to some columns and it works for my applications. Chucho! Ravi Krishna wrote: > "Jonathan Leffler" <jleffler@earthlink.net> wrote > >>>I am converting a SQL Server stored procedure to Informix. >>>In SQL Server there is a function PI() which returns 3.1415926535897931 >>>and this can be used in a SQL Server FLOAT variable. >>>When I try to create a datatype in Informix to store the same value, >>>it seems the best I could do is to create FLOAT(16) and it can only >>>take 3.141592653590. Is there a data type in Informix which can take >>>the precise value of PI. Am I missing something? >> >>Well, first of all, the value of PI is infinitely big, so unless you >>have an inifinite amount of disk space, you can't store it precisely :-) >> >>If you want a better approximation to PI, I recommend using >>DECIMAL(n), where n could go as large as 32. >> >>Note that a FLOAT value in Informix is stored in a C double; a DECIMAL >>is stored in the on-disk format of an ESQL/C 'struct decimal'. > > > Thanks. > > I changed the code to decimal(32), but there is no difference in the > calculation. > > The function I am writing takes two inputs, the airport code of two cities > and returns the distance between them. > > Besides PI, the function uses: ACOS, COS and SIN function. I have noticed that the > precision in these mathematical functions is different in informix > and SQLserver, just like PI. As a result the distance between cities tends > to be off. For example, SQLserver shows distance between DFW(Dallas) > and ORD (Chicago) as 805 miles. Informix shows it as 802. > SQLserver shows Dallas to Adelaide, Australia as 9294. Informix shows it as 9310. > > The code is exactly same. So I suspect it is due to precision level difference. > > Ravi > > > -- Atte, Jesus Antonio Santos Giraldo ----------------------------------- jeansagi@myrealbox.com jeansagi@netscape.net sending to informix-list |