log2 description and examples
Description
- Log2 fails on 'Zero'
- There is no rounding, but striping out the decimal point from result
- Indentation of the output in the example, for readability
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Updated |
|---|---|---|---|
| stacks-docs | ✅ Ready (Inspect) | Visit Preview | Sep 19, 2022 at 5:51AM (UTC) |
<1 if check from VM code at
https://github.com/stacks-network/stacks-blockchain/blob/master/clarity/src/vm/functions/arithmetic.rs#L230
<1if check from VM code at https://github.com/stacks-network/stacks-blockchain/blob/master/clarity/src/vm/functions/arithmetic.rs#L230
In my opinion the text log2 must be passed a positive integer in the code line you pointed out can be a bit ambiguous and should be changed.
Event though some don't consider 0 to be a positive integer, mathematically speaking it is. So it's unclear.
In my opinion, this should be replaced with something like log2 must be passed a positive integer equal or larger than 1 or log2 must be passed a positive integer larger than 0.
I recommend you open a PR on that repository, pointing out this issue you detected. It will be interesting to see how the rest see it.