docs icon indicating copy to clipboard operation
docs copied to clipboard

log2 description and examples

Open c0d3rk1d opened this issue 3 years ago • 2 comments

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

c0d3rk1d avatar Sep 19 '22 05:09 c0d3rk1d

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)

vercel[bot] avatar Sep 19 '22 05:09 vercel[bot]

<1 if check from VM code at https://github.com/stacks-network/stacks-blockchain/blob/master/clarity/src/vm/functions/arithmetic.rs#L230

c0d3rk1d avatar Sep 19 '22 13:09 c0d3rk1d

<1 if 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.

criadoperez avatar Sep 29 '22 14:09 criadoperez