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.