docs icon indicating copy to clipboard operation
docs copied to clipboard

update functions.md

Open 0xpessimist opened this issue 9 months ago • 4 comments

Description

Added the case if exponent is 0, the result is definitely 1

0xpessimist avatar Feb 28 '25 15:02 0xpessimist

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Feb 28 '25 15:02 CLAassistant

hmm - this file is the result of autogenerated docs. i can't say if your change is correct or not, but it's definitely not auto-generated:

cargo build --bin stacks-inspect
./target/debug/stacks-inspect docgen | jq . > ./clarity-reference.json

then, in ./clarity-reference.json:

    {
      "name": "pow",
      "snippet": "pow ${1:expr-1} ${2:expr-2}",
      "input_type": "int, int | uint, uint | string-ascii, string-ascii | string-utf8, string-utf8 | buff, buff",
      "output_type": "int | uint",
      "signature": "(pow i1 i2)",
      "description": "Returns the result of raising `i1` to the power of `i2`. In the event of an _overflow_, throws a runtime error.\nNote: Corner cases are handled with the following rules:\n  * if both `i1` and `i2` are `0`, return `1`\n  * if `i1` is `1`, return `1`\n  * if `i1` is `0`, return `0`\n  * if `i2` is `1`, return `i1`\n  * if `i2` is negative or greater than `u32::MAX`, throw a runtime error",
      "example": "(pow 2 3) ;; Returns 8\n(pow 2 2) ;; Returns 4\n(pow 7 1) ;; Returns 7\n",
      "min_version": "Clarity1",
      "max_version": null
    },

if it's missing and should be part of the definitiion - it will likely need to be addressed in https://github.com/stacks-network/stacks-core/

i'm going to block this PR for now, can you open a an issue in stacks-core and we'll see what that response is there?

wileyj avatar Feb 28 '25 16:02 wileyj

Opened it, thx: https://github.com/stacks-network/stacks-core/issues/5879

0xpessimist avatar Feb 28 '25 16:02 0xpessimist

let's leave this open for now, and adjust pending the outcome of that issue/pr

wileyj avatar Mar 06 '25 14:03 wileyj