Bug 710818 - Overflow safe wrappers for acos/asin

acos() and asin() are only defined in a certain range. Implement some
range/overflow safe wrappers rather than potentially passing infinite
to other modules (e.g. cairo did assert() on it.)

(cherry picked from commit 846a7ff5b5cb5d21f3c97d21f7a1890a0fcfb65b)

Conflicts:
	lib/boundingbox.c
	lib/geometry.c