Closed Slayer95 closed 7 years ago
While Number#round
allows you to control the precision, this doesn't seem to require that, so it could just be mapped as an alias similar to pow
, abs
, etc. Would this satisfy your needs?
The idea is for Number#fround
to do allow to control precision, in the same way as Number#round
does.
Note that neither Math.round
nor Math.fround
themselves have a precision parameter built-in.
I'm currently shimming it like so, btw: Number#fround
So, after playing around with your example a bit, I'm still having trouble understanding the meaning (or at least the utility) of having a "places" argument. round
is clear as this is natural language. Although according to the spec it rounds to the nearest integer, it is not a stretch for a parameter to allow rounding to a specific place. fround
, however is not natural language, the method specifically rounds to single-precision, and the places
argument isn't immediately clear what it's indicating.
Anyway, let's set all this feedback aside. In either case, this idea is a perfect candidate for using the new plugin system of v2.0. I just recently created a boilerplate repo here. There are a lot of notes and it should be easy to follow along.
Going to close this for now. Let me know if there are issues with the plugin mechanism, etc.
In analogy to
Number#round()
.