Correct tolerance value for sanity checks with ERROR_RELATIVE

Use min/max bounds instead of local value to calculate acceptance threshold.
Threshold based on local values somethimes does not work because cancellation
of big values may produce error bigger than local value.
Merge pull request #390 from taka-no-me:fix_relative_error_check