← All procedures

rational.pow

This function gives `a` to an integer power. The result is exact. The power 0 of each value, 0 too, is 1.

CLI
Package
@procedures/rational · README
Path
["rational","pow"]
CLI
mark rational pow --a <object> --exponent <number>
As data
{"$proc":["rational","pow"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/rational/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["rational","pow"], { a: {}, exponent: 1 });
console.log(JSON.stringify(result));

From the command line

$ mark rational pow --a <object> --exponent <number>

As data, in a program

{ "$proc": ["rational", "pow"], "input": { "a": {}, "exponent": 1 } }

Input

FieldTypeRequiredDefaultDescription
aobjectyes
exponentnumberyes

Output

FieldTypeRequiredDefaultDescription
nstringyes
dstringyes
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "a": {
        "type": "object",
        "properties": {
          "n": {
            "type": "string",
            "pattern": "^-?(0|[1-9][0-9]*)$",
            "x-procedures-codec": "bigint"
          },
          "d": {
            "type": "string",
            "pattern": "^-?(0|[1-9][0-9]*)$",
            "x-procedures-codec": "bigint"
          }
        },
        "required": [
          "n",
          "d"
        ],
        "additionalProperties": {}
      },
      "exponent": {
        "type": "number"
      }
    },
    "required": [
      "a",
      "exponent"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "n": {
        "type": "string",
        "pattern": "^-?(0|[1-9][0-9]*)$",
        "x-procedures-codec": "bigint"
      },
      "d": {
        "type": "string",
        "pattern": "^-?(0|[1-9][0-9]*)$",
        "x-procedures-codec": "bigint"
      }
    },
    "required": [
      "n",
      "d"
    ],
    "additionalProperties": {}
  }
}