Hi all,

I hope this is the correct way to propose a new feature.
https://github.com/numpy/numpy/issues/22522

Currently, the around-function supports rounding to a given number of
decimal digits. It is often quite convenient to be able to round to a given
number of binary digits to mimic fixed-point representations. Currently
this can be readily achieved using e.g.

fractional_bits = 5
scale = 2**fractional_bits
x_round = np.around(x*scale)/scale

However, it would be more convenient (and probably faster) to provide
dedicated support for it.

I see a few different ways to obtain this:
1. Provide a separate function (binaryround?)
2. Provide a base argument to around which defaults to 10.
3. Provide a quant(ization) function where the argument is the step-size.
(For completeness, one may think of having multiple quantization modes, not
just rounding)

Any opinions?

BR Oscar Gustafsson
_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: [email protected]

Reply via email to