Ram Prabodh Induri
Ram Prabodh Induri

Reputation: 95

restricting a number to specific decimal places

I want to restrict a number to certain decimal places. For e.g: 0.973451 to 4 decimal places would be 0.9374.Note: The numbers I want to restrict are in numpy array - type Float64

I'm performing operations on numbers that have many digits after decimal places. When I perform mathematical operations like multiplication or exponential, it shows "overflow error".

Upvotes: 1

Views: 59

Answers (1)

blackbrandt
blackbrandt

Reputation: 2095

Use the round method in numpy.

numpy.round_(a, decimals=0, out=None)

Upvotes: 2

Related Questions