The attached patches change earthdistance to use the new cube functions
in one of the earth functions so that latitude and longitude to
cartesian coordinates conversion will be more accurrate. (Previously
a text string was built to provide as input which limited the accuracy
to the number of digits printed.)
The new functions were included in a recent patch to contrib/cube that has not
as yet been accepted as of yet.
I also added check constraints to the domain 'earth' since they are now
working in 7.4.