{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.calculatorx.com/schemas/math.fractions.input.json",
  "title": "Fractions — input",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "mode": {
      "type": "string",
      "enum": [
        "operate",
        "simplify",
        "to-dec",
        "from-dec"
      ]
    },
    "op": {
      "type": "string",
      "enum": [
        "+",
        "add",
        "plus",
        "-",
        "−",
        "sub",
        "subtract",
        "minus",
        "*",
        "x",
        "×",
        "mul",
        "multiply",
        "times",
        "/",
        "÷",
        "div",
        "divide"
      ]
    },
    "operator": {
      "type": "string",
      "enum": [
        "+",
        "add",
        "plus",
        "-",
        "−",
        "sub",
        "subtract",
        "minus",
        "*",
        "x",
        "×",
        "mul",
        "multiply",
        "times",
        "/",
        "÷",
        "div",
        "divide"
      ]
    },
    "aWhole": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        {
          "type": "string",
          "pattern": "^\\s*(?:[+-]?[0-9]+)?\\s*$",
          "maxLength": 128
        }
      ]
    },
    "bWhole": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        {
          "type": "string",
          "pattern": "^\\s*(?:[+-]?[0-9]+)?\\s*$",
          "maxLength": 128
        }
      ]
    },
    "aNum": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        {
          "type": "string",
          "pattern": "^\\s*[+-]?[0-9]+\\s*$",
          "maxLength": 128
        }
      ]
    },
    "n": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        {
          "type": "string",
          "pattern": "^\\s*[+-]?[0-9]+\\s*$",
          "maxLength": 128
        }
      ]
    },
    "bNum": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        {
          "type": "string",
          "pattern": "^\\s*[+-]?[0-9]+\\s*$",
          "maxLength": 128
        }
      ]
    },
    "c": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        {
          "type": "string",
          "pattern": "^\\s*[+-]?[0-9]+\\s*$",
          "maxLength": 128
        }
      ]
    },
    "aDen": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "not": {
            "const": 0
          }
        },
        {
          "type": "string",
          "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
          "maxLength": 128
        }
      ]
    },
    "d": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "not": {
            "const": 0
          }
        },
        {
          "type": "string",
          "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
          "maxLength": 128
        }
      ]
    },
    "bDen": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "not": {
            "const": 0
          }
        },
        {
          "type": "string",
          "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
          "maxLength": 128
        }
      ]
    },
    "decimal": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "string",
          "pattern": "^\\s*[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?\\s*$",
          "maxLength": 128
        }
      ]
    },
    "decInput": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "string",
          "pattern": "^\\s*[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?\\s*$",
          "maxLength": 128
        }
      ]
    }
  },
  "oneOf": [
    {
      "properties": {
        "mode": {
          "const": "operate"
        },
        "op": {
          "type": "string",
          "enum": [
            "+",
            "add",
            "plus",
            "-",
            "−",
            "sub",
            "subtract",
            "minus",
            "*",
            "x",
            "×",
            "mul",
            "multiply",
            "times",
            "/",
            "÷",
            "div",
            "divide"
          ]
        },
        "operator": {
          "type": "string",
          "enum": [
            "+",
            "add",
            "plus",
            "-",
            "−",
            "sub",
            "subtract",
            "minus",
            "*",
            "x",
            "×",
            "mul",
            "multiply",
            "times",
            "/",
            "÷",
            "div",
            "divide"
          ]
        },
        "aWhole": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*(?:[+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        },
        "bWhole": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*(?:[+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        },
        "aNum": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "n": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "bNum": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "c": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "aDen": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "not": {
                "const": 0
              }
            },
            {
              "type": "string",
              "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "d": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "not": {
                "const": 0
              }
            },
            {
              "type": "string",
              "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "bDen": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "not": {
                "const": 0
              }
            },
            {
              "type": "string",
              "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "decimal": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        },
        "decInput": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        }
      },
      "allOf": [
        {
          "anyOf": [
            {
              "required": [
                "aNum"
              ]
            },
            {
              "required": [
                "n"
              ]
            }
          ]
        },
        {
          "anyOf": [
            {
              "required": [
                "aDen"
              ]
            },
            {
              "required": [
                "d"
              ]
            }
          ]
        },
        {
          "anyOf": [
            {
              "required": [
                "bNum"
              ]
            },
            {
              "required": [
                "c"
              ]
            }
          ]
        },
        {
          "required": [
            "bDen"
          ]
        }
      ],
      "additionalProperties": false
    },
    {
      "required": [
        "mode"
      ],
      "properties": {
        "mode": {
          "const": "simplify"
        },
        "op": {
          "type": "string",
          "enum": [
            "+",
            "add",
            "plus",
            "-",
            "−",
            "sub",
            "subtract",
            "minus",
            "*",
            "x",
            "×",
            "mul",
            "multiply",
            "times",
            "/",
            "÷",
            "div",
            "divide"
          ]
        },
        "operator": {
          "type": "string",
          "enum": [
            "+",
            "add",
            "plus",
            "-",
            "−",
            "sub",
            "subtract",
            "minus",
            "*",
            "x",
            "×",
            "mul",
            "multiply",
            "times",
            "/",
            "÷",
            "div",
            "divide"
          ]
        },
        "aWhole": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*(?:[+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        },
        "bWhole": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*(?:[+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        },
        "aNum": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "n": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "bNum": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "c": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "aDen": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "not": {
                "const": 0
              }
            },
            {
              "type": "string",
              "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "d": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "not": {
                "const": 0
              }
            },
            {
              "type": "string",
              "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "bDen": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "not": {
                "const": 0
              }
            },
            {
              "type": "string",
              "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "decimal": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        },
        "decInput": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        }
      },
      "allOf": [
        {
          "anyOf": [
            {
              "required": [
                "aNum"
              ]
            },
            {
              "required": [
                "n"
              ]
            }
          ]
        },
        {
          "anyOf": [
            {
              "required": [
                "aDen"
              ]
            },
            {
              "required": [
                "d"
              ]
            }
          ]
        }
      ],
      "additionalProperties": false
    },
    {
      "required": [
        "mode"
      ],
      "properties": {
        "mode": {
          "const": "to-dec"
        },
        "op": {
          "type": "string",
          "enum": [
            "+",
            "add",
            "plus",
            "-",
            "−",
            "sub",
            "subtract",
            "minus",
            "*",
            "x",
            "×",
            "mul",
            "multiply",
            "times",
            "/",
            "÷",
            "div",
            "divide"
          ]
        },
        "operator": {
          "type": "string",
          "enum": [
            "+",
            "add",
            "plus",
            "-",
            "−",
            "sub",
            "subtract",
            "minus",
            "*",
            "x",
            "×",
            "mul",
            "multiply",
            "times",
            "/",
            "÷",
            "div",
            "divide"
          ]
        },
        "aWhole": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*(?:[+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        },
        "bWhole": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*(?:[+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        },
        "aNum": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "n": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "bNum": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "c": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "aDen": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "not": {
                "const": 0
              }
            },
            {
              "type": "string",
              "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "d": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "not": {
                "const": 0
              }
            },
            {
              "type": "string",
              "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "bDen": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "not": {
                "const": 0
              }
            },
            {
              "type": "string",
              "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "decimal": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        },
        "decInput": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        }
      },
      "allOf": [
        {
          "anyOf": [
            {
              "required": [
                "aNum"
              ]
            },
            {
              "required": [
                "n"
              ]
            }
          ]
        },
        {
          "anyOf": [
            {
              "required": [
                "aDen"
              ]
            },
            {
              "required": [
                "d"
              ]
            }
          ]
        }
      ],
      "additionalProperties": false
    },
    {
      "required": [
        "mode"
      ],
      "properties": {
        "mode": {
          "const": "from-dec"
        },
        "op": {
          "type": "string",
          "enum": [
            "+",
            "add",
            "plus",
            "-",
            "−",
            "sub",
            "subtract",
            "minus",
            "*",
            "x",
            "×",
            "mul",
            "multiply",
            "times",
            "/",
            "÷",
            "div",
            "divide"
          ]
        },
        "operator": {
          "type": "string",
          "enum": [
            "+",
            "add",
            "plus",
            "-",
            "−",
            "sub",
            "subtract",
            "minus",
            "*",
            "x",
            "×",
            "mul",
            "multiply",
            "times",
            "/",
            "÷",
            "div",
            "divide"
          ]
        },
        "aWhole": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*(?:[+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        },
        "bWhole": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*(?:[+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        },
        "aNum": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "n": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "bNum": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "c": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "aDen": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "not": {
                "const": 0
              }
            },
            {
              "type": "string",
              "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "d": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "not": {
                "const": 0
              }
            },
            {
              "type": "string",
              "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "bDen": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "not": {
                "const": 0
              }
            },
            {
              "type": "string",
              "pattern": "^(?!\\s*[+-]?0+\\s*$)\\s*[+-]?[0-9]+\\s*$",
              "maxLength": 128
            }
          ]
        },
        "decimal": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        },
        "decInput": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string",
              "pattern": "^\\s*[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?\\s*$",
              "maxLength": 128
            }
          ]
        }
      },
      "anyOf": [
        {
          "required": [
            "decimal"
          ]
        },
        {
          "required": [
            "decInput"
          ]
        }
      ],
      "additionalProperties": false
    }
  ],
  "description": "Four safe-integer rational operations, simplify/to-dec, and exact base10 rational conversion of shortest normalized binary64 decimal. Safe intermediates and reduced from-dec n/d required. String token≤64 trimmed/128 raw characters. Matching aliases; unknown fields refused; secondary validation checks text magnitude, raw nonzero underflow and aliases. (calculation_version 1.0.8)"
}
