473,385 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

pi()

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
Nov 12 '05 #1
4 4182
Ina Schmitz wrote:
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

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

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2
Serge Rielau wrote:
Ina Schmitz wrote:
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

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

Cheers
Serge


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

Jan M. Nelken
Nov 12 '05 #3
Jan M. Nelken wrote:
Serge Rielau wrote:
Ina Schmitz wrote:
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

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

Cheers
Serge


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

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
Nov 12 '05 #4
mecej4 wrote:
Jan M. Nelken wrote:
Serge Rielau wrote:
Ina Schmitz wrote:

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

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

Cheers
Serge


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

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

Well, can't say I didn't learn anything here.

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #5

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

Similar topics

5
by: Ron Adam | last post by:
Hi, I'm having fun learning Python and want to say thanks to everyone here for a great programming language. Below is my first Python program (not my first program) and I'd apreciate any...
18
by: Karl Pech | last post by:
Hi, I got a task there I have to compute pi using the Method above. So I wrote the following program: --- import random import math
9
by: Steven T. Hatton | last post by:
I can get the accurate value of Pi to an arbitrary precision, but it would be nice to have it directly and readily available as a standard feature of the language. Have I overlooked something, or...
20
by: Kraig | last post by:
Hi! I'm new to programming and am trying to figure out the best way using loops, to compute pi to say, 14 terms using values that double each time through the loop. As in, from 1-2-4-8-16, et al....
5
by: confusedprogrammer | last post by:
I am doing a program for a class of mine. I have figured out how to display the final result of PI but i have not figured out how to print the part where is ask me print out Pi after a certain number...
123
by: Lane Straatman | last post by:
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <complex.h> /* double complex z1, z2, z3; bool flag; z1 = .4 + .7I; z2 = cpow(z1, 2.0); z3 = z1 * z1;
17
by: Szabolcs Nagy | last post by:
i've just found out (searching through n1124.pdf) that in c99 math.h does not contain M_PI what is the desired way to use the PI constant in a c code then? #define PI...
17
by: pyramid | last post by:
Hello I am working on one of my lab for this week, which calculates the approximate value of pi. Listed below is the actual problem, which I am posting here, so that you can see the different...
1
by: Andrew Lee | last post by:
Mensanator wrote: Heh! I wonder who needs that many digits? Certainly not number theorists (they need a LOT more). Certainly not physicists -- they need about 30 digits to be within 1%...
42
by: aarklon | last post by:
Hi all, see:- http://mathforum.org/library/drmath/view/54456.html
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.