expr-eval icon indicating copy to clipboard operation
expr-eval copied to clipboard

len function added, round has second parameter

Open escopecz opened this issue 10 years ago • 1 comments

  1. len function added. Inspiration is from MS Excel LEN function.
  2. round takes a second parameter the same as MS Excel's ROUND function does. Implementation was inspired by Decimal Rounding function by Mozilla with one exception. The exp is -1 * exp because it behaved the opposite than the MS round function and TBH it wasn't logical.

I had fun time with function round(value, exp) {}. When I call it as round(1, 1), value = [1, 1] and exp = 'undefined. Couldn't found out why so I just played with it.

It will be easy to add floor(X, n) and ceil(X, n) as well (described in the Decimal Rounding link), but I'm in a hurry.

Tests are part of this PR, documentation updated.

escopecz avatar Oct 22 '15 08:10 escopecz

looks good to me

johannesschobel avatar Dec 18 '19 13:12 johannesschobel