Re: Getting float8 data into cube? - Mailing list pgsql-hackers

From Bruno Wolff III
Subject Re: Getting float8 data into cube?
Date
Msg-id 20030120060909.GA1390@wolff.to
Whole thread Raw
In response to Re: Getting float8 data into cube?  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-hackers
I have a specific proposal for allowing for building cube values from
float8 values with building strings (which will typically lose information).
I want to add the following 4 overloaded functions:

cube(float8) cube(1) returns '(1),(1)'::cube

cube(float8,float8) cube(1,2) returns '(1),(2)'::cube

cube(cube,float8) cube('(1),(2)',3) returns '(1,3),(2,3)'::cube

cube(cube,float8,float8) cube('(1),(2)',3,4) returns '(1,3),(2,4)'::cube

This is useful when the input needs to be transformed before being stored.
For example when the input is in polar coordinates.

For polar input of R and O, you then could do something like:
cube(cube(R*sin(O)),R*cos(O))
instead of
cube('('||R*sin(O)||','||R*cos(O)||')')
The latter will normally be less accurrate than the former.

If the above is acceptable, I will come up with a patch versus the 7.4
version of the cube contrib package.


pgsql-hackers by date:

Previous
From: Dan Langille
Date:
Subject: What goes into the security doc?
Next
From: Emmanuel Charpentier
Date:
Subject: Re: default to WITHOUT OIDS? Possible related problem