Seems fine to me, although perhaps it should be split into two parts. One with the cube_coord_llur fixes, and then g_cube_distance changes adding support for negative coordinates.
Thank you for your feedback. I'll split this patch into two.
------ Alexander Korotkov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company