Merge pull request #1547 from MITx/fix/will/cs191_symmath_check_ans=0_bug

Fixed a bug in symmath_check():
This commit is contained in:
Victor Shnayder
2013-02-25 08:48:23 -08:00

View File

@@ -215,7 +215,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
fans = None
# do a numerical comparison if both expected and answer are numbers
if (hasattr(fexpect, 'is_number') and fexpect.is_number and fans
if (hasattr(fexpect, 'is_number') and fexpect.is_number
and hasattr(fans, 'is_number') and fans.is_number):
if abs(abs(fans - fexpect) / fexpect) < threshold:
return {'ok': True, 'msg': msg}