← All procedures

rational.equals

This function tells if `a = b`. Each rational is in lowest terms, so the test compares the fields.

CLI
Package
@procedures/rational · README
Path
["rational","equals"]
CLI
mark rational equals --a <object> --b <object>
As data
{"$proc":["rational","equals"],"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","equals"], { a: {}, b: {} });
console.log(JSON.stringify(result));

From the command line

$ mark rational equals --a <object> --b <object>

As data, in a program

{ "$proc": ["rational", "equals"], "input": { "a": {}, "b": {} } }

Input

FieldTypeRequiredDefaultDescription
aobjectyes
bobjectyes

Output

The schema does not list fields (boolean).

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": {}
      },
      "b": {
        "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": {}
      }
    },
    "required": [
      "a",
      "b"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "boolean"
  }
}