Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / March 2005

Tip: Looking for answers? Try searching our database.

pi()

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ina Schmitz - 18 Mar 2005 15:16 GMT
Hi all,

is there any possibility to use pi() (3.14...) like it is in SQL Server in a
query to a DB2 database? How is the syntax therefore?

Thanks for good ideas!
Cheers,
Ina
Serge Rielau - 18 Mar 2005 15:55 GMT
> Hi all,
>
[quoted text clipped - 4 lines]
> Cheers,
> Ina

CREATE FUNCTION PI()
RETURNS DOUBLE
NO EXTERNAL ACTION CONTAINS SQL DETERMINISTIC
RETURN 3.14......;

Cheers
Serge

Signature

Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

Jan M. Nelken - 18 Mar 2005 17:34 GMT
>> Hi all,
>>
[quoted text clipped - 12 lines]
> Cheers
> Serge

RETURN 22.0 /7.0 should yield better accuracy (within precision of REAL numbers)

Jan M. Nelken
mecej4 - 19 Mar 2005 01:23 GMT
>>> Hi all,
>>>
[quoted text clipped - 17 lines]
>
> Jan M. Nelken

No. The rational approximation 22/7 is good only to 3 decimal digits,
whereas floats can hold many more.

values asin(1)*2
   or
values atan(1)*4

will provide full precision and are easy to remember.

N. Shamsundar
University of Houston
Serge Rielau - 19 Mar 2005 01:38 GMT
>>>> Hi all,
>>>>
[quoted text clipped - 29 lines]
> N. Shamsundar
> University of Houston
Well, can't say I didn't learn anything here.

Signature

Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.