NumPy ufuncLesson 35Free preview
ufunc Rounding Decimals
This lesson is part of NumPy · All levels
Summary
NumPy provides several ufunc for rounding decimal numbers: around (round), floor, ceil, and trunc. Each function has a different behavior to a negative and half value (0.5). The choice of the right disposal method is essential to ensure that the results of the report or calculation are in accordance with the desired rules.
Key points
- Round to the nearest decimal, maybe with the decimal parameter.
- Always round down, round up.
- Dispose of the decimal without rounding.
- Round to the nearest even number (banker's rounding).
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.