Changed gcc invocation to be more portable.
Added tolerance parameter to code.