rare icon indicating copy to clipboard operation
rare copied to clipboard

float not supported?

Open alperyilmaz opened this issue 5 months ago • 2 comments

I wanted to draw a histogram for float values but I got BAD-TYPE error. Are decimal values not supported at all or do we need to process them with a trick?

Integer values work:

$ echo -e "1\n10\n15\n20" | rare h -e "{bucket {0}  10}"
10                  2
20                  1
0                   1

Matched: 4 / 4 (Groups: 3)
11 B (0 B/s) | <stdin>

But when I use decimal values, I get error

 echo -e "1.5\n10.2\n15.5\n20.0" | rare h -e "{bucket {0}  10}"
<BAD-TYPE>          4

Matched: 4 / 4 (Groups: 1)
19 B (0 B/s) | <stdin>

alperyilmaz avatar Mar 17 '24 22:03 alperyilmaz

I'd have to double-check, but it seems like bucket only supports int (generally working with int's can be faster).

A quick hack for you would be to round/floor/ceil the number like: {bucket {floor {0}} 10}

zix99 avatar Mar 17 '24 22:03 zix99

looks like it's the bucket causing the problem.. I thought it's more like histogram problem.. in that case I can use some hacks.. Kudos for such great software, it's simply amazing..

alperyilmaz avatar Mar 17 '24 23:03 alperyilmaz