Advertisement
TakesxiSximada

Python2とPython3のmath.round()の挙動の違い

May 21st, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. Python2
  2.  
  3. ```
  4. >>> round(2.675, 2)
  5. 2.67
  6. >>> round(Decimal('2.675'), 2)
  7. 2.67
  8. ```
  9.  
  10. Python3
  11.  
  12. ```
  13. >>> round(2.675, 2)
  14. 2.67
  15. >>> round(Decimal('2.675'), 2)
  16. Decimal('2.68')
  17. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement