On 2026-01-11 22:02, Jacob S. Gordon wrote:
> On 2026-01-10 03:57, stardiviner wrote:
>> Why not support float number in this statistics cookie? It's more
>> meaningful and human readable.
> 
> That would help distinguish small percents, but it’s a bit orthogonal
> IMO since there’s still the question of how it’s rounded.  If the
> percent cookie precision is p then with N = 10^{p+2} + 1 the fraction
> 1/N could still round to 0, e.g. with a ‘%.pf’ format specifier:

Actually, the low-end works, my mistake:

|---+-------+----------+------|
| p |     N |    100/N | %.pf |
|---+-------+----------+------|
| 0 |   101 | 0.990099 |    1 |
| 1 |  1001 | 0.099900 |  0.1 |
| 2 | 10001 | 0.009999 | 0.01 |
|---+-------+----------+------|
#+TBLFM: $1=@#-2::$2=10^($1+2)+1::$3=100/$2;%.6f::$4='(format (format "%%.%df" 
$1) (/ 100.0 $2));N

it’s the other end that gets rounded ‘incorrectly’:

|---+-------+------------+--------|
| p |     N | 100(N-1)/N |   %.pf |
|---+-------+------------+--------|
| 0 |   201 |  99.502488 |    100 |
| 1 |  2001 |  99.950025 |  100.0 |
| 2 | 20001 |  99.995000 | 100.00 |
|---+-------+------------+--------|
#+TBLFM: $1=@#-2::$2=2*10^($1+2)+1::$3=100($2-1)/$2;%.6f::$4='(format (format 
"%%.%df" $1) (/ (* 100.0 (1- $2)) $2));N

Either way, my point was just that the precision and rounding
behaviour around 0/100% can be independent.

Best,

--  
Jacob S. Gordon
[email protected]
Please don’t send me HTML emails or MS Office/Apple iWork documents.
https://useplaintext.email/#etiquette
https://www.fsf.org/campaigns/opendocument

Reply via email to