antonmedv/numbr

Request: Round, Round Up and Round Down

ethanpil opened this issue ยท 6 comments

Would appreciate the classic ability to round numbers....

Like this?

=ROUND(2.15, 1) Rounds 2.15 to one decimal place 2.2

Yes for the Round() function but in my little world would also appreciate RoundUp() and RoundDown() like these referenced here https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-round

Will do)

It may be worth considering using a syntax similar to what Soulver provides, I think it's pretty user friendly, see:

1/3 to 2 dp                                    | 0.33
ฯ€ to 5 digits                                  | 3.14159

5.5 rounded                                    | 6
5.5 rounded down                               | 5
5.5 rounded up                                 | 6

37 to nearest 10                               | 40
$490 rounded to nearest hundred                | $500
2,100 to nearest thousand                      | 2,000

(copied from https://documentation.soulver.app/functions/number-rounding )

Though they also provide function-like keywords (round(), ceil(), floor()).

Disclaimer: I'm new to this notepad+calculator world and I've never used Soulver, so I'm not sure what's the best approach.

This seems like a great fork in the road where @antonmedv must decide the direction of numbr.... Will this steer towards a natural language calculation system or more of a function/expression based system.

I think we can support both: expressions and functions.

Right now thinking about a way to refactor lexer to support complex lex rules needed for parsing datetime strings.