Due to application requirements, I need to implement a rounding function that is independant of the baked-in rounding functionality. I'd prefer to do it in plpgsql for maximum portability. To do this, I'll need to sequentially walk through the digits of an arbritarily long floating-point number. I can't think of a good way to do this.
I would greatly appreciate pointers to similar example code or discussion of the method for doing this..