Added math.rint() -- round according to current IEEE754 mode

This commit is contained in:
Guido van Rossum 2000-05-11 18:19:42 +00:00
parent dab6cb8f6d
commit 71260b846e
5 changed files with 16 additions and 0 deletions

View file

@ -129,6 +129,12 @@ testit('pow(1,0)', math.pow(1,0), 1)
testit('pow(2,1)', math.pow(2,1), 2)
testit('pow(2,-1)', math.pow(2,-1), 0.5)
print 'rint'
testit('rint(0.7)', math.rint(0.7), 1)
testit('rint(-0.3)', math.rint(-0.3), 0)
testit('rint(2.5)', math.rint(2.5), 2)
testit('rint(3.5)', math.rint(3.5), 4)
print 'sin'
testit('sin(0)', math.sin(0), 0)
testit('sin(pi/2)', math.sin(math.pi/2), 1)