{
  "id": "greater-than-less-than",
  "version": "8ae91d7be19b",
  "status": "published",
  "name": "Greater Than Less Than Calculator",
  "question": "Is it greater than less than or equal?",
  "summary": "Compares two numbers, decimals, negatives or fractions exactly and writes the right sign: greater than (>), less than (<) or equal (=), with the difference.",
  "category": "math",
  "subcategory": "arithmetic",
  "url": "https://www.acalculator.org/math/greater-than-less-than-calculator",
  "markdown": "https://www.acalculator.org/math/greater-than-less-than-calculator.md",
  "kind": "function",
  "method": "Read both numbers as exact fractions and compare: a > b when a − b is positive, a < b when it is negative, and a = b when it is 0.",
  "assumptions": [
    "A decimal is read exactly as typed; a mixed number w a/b is w + a/b (with the sign on the whole).",
    "A comma between digits is a thousands separator in groups of three (1,234); any other comma gives no answer."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "a": {
        "title": "First number",
        "description": "The first number: a whole number, a decimal, or a fraction such as 3/4 or 1 1/2.",
        "type": "string",
        "maxLength": 400
      },
      "b": {
        "title": "Second number",
        "description": "The second number: a whole number, a decimal, or a fraction such as 3/4 or 1 1/2.",
        "type": "string",
        "maxLength": 400
      }
    }
  },
  "outputs": {
    "result": {
      "label": "Comparison",
      "description": "The two numbers with the sign between them.",
      "format": "text"
    },
    "sign": {
      "label": "Sign",
      "description": ">, < or =.",
      "format": "text"
    },
    "words": {
      "label": "In words",
      "description": "The comparison in words.",
      "format": "text"
    },
    "difference": {
      "label": "Difference (first − second)",
      "description": "The first number minus the second, as an exact fraction in lowest terms.",
      "format": "text"
    },
    "decimal": {
      "label": "Difference (decimal)",
      "description": "The same difference as a decimal, to 12 significant figures.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "a": "3/4",
      "b": "0.7"
    },
    "outputs": {
      "result": "3/4 > 0.7",
      "sign": ">",
      "words": "3/4 is greater than 0.7",
      "difference": "1/20",
      "decimal": "0.05"
    },
    "text": "3/4 is greater than 0.7."
  },
  "examples": [
    {
      "given": {
        "a": "3/4",
        "b": "0.7"
      },
      "expect": {
        "result": "3/4 > 0.7",
        "sign": ">",
        "words": "3/4 is greater than 0.7",
        "difference": "1/20",
        "decimal": "0.05"
      },
      "source": "OpenStax, Prealgebra 2e, §5.1 Decimals (order decimals by place value), https://openstax.org/books/prealgebra-2e/pages/5-1-decimals (retrieved 2026-10-05); hand calculation in content.mdx: 3/4 = 0.75 > 0.70"
    },
    {
      "given": {
        "a": "-5",
        "b": "-2"
      },
      "expect": {
        "result": "−5 < −2",
        "sign": "<",
        "difference": "−3"
      },
      "source": "OpenStax, Prealgebra 2e, §3.1 Introduction to Integers (a < b when a is to the left of b on the number line), https://openstax.org/books/prealgebra-2e/pages/3-1-introduction-to-integers (retrieved 2026-10-05); hand calculation in content.mdx: −5 is left of −2 on the number line"
    },
    {
      "given": {
        "a": "2/4",
        "b": "0.5"
      },
      "expect": {
        "result": "2/4 = 0.5",
        "sign": "=",
        "words": "2/4 is equal to 0.5",
        "difference": "0",
        "decimal": "0"
      },
      "source": "OpenStax, Prealgebra 2e, §5.1 Decimals (order decimals by place value), https://openstax.org/books/prealgebra-2e/pages/5-1-decimals (retrieved 2026-10-05); hand calculation in content.mdx: 2/4 = 1/2 = 0.5"
    },
    {
      "given": {
        "a": "0.45",
        "b": "0.405"
      },
      "expect": {
        "sign": ">",
        "difference": "9/200"
      },
      "source": "OpenStax, Prealgebra 2e, §5.1 Decimals (order decimals by place value), https://openstax.org/books/prealgebra-2e/pages/5-1-decimals (retrieved 2026-10-05); hand calculation in content.mdx: 0.450 − 0.405 = 0.045 = 9/200"
    },
    {
      "given": {
        "a": "1 1/3",
        "b": "1,234"
      },
      "expect": {
        "sign": "<",
        "difference": "−1232 2/3"
      },
      "source": "OpenStax, Prealgebra 2e, §3.1 Introduction to Integers (a < b when a is to the left of b on the number line), https://openstax.org/books/prealgebra-2e/pages/3-1-introduction-to-integers (retrieved 2026-10-05); hand calculation in content.mdx: 4/3 − 1234 = −3698/3"
    }
  ],
  "sources": [
    "OpenStax, Prealgebra 2e, §3.1 Introduction to Integers: order positive and negative numbers with < and > on the number line. CC BY 4.0. Retrieved 2026-10-05. https://openstax.org/books/prealgebra-2e/pages/3-1-introduction-to-integers",
    "OpenStax, Prealgebra 2e, §5.1 Decimals: order decimals by comparing place values. CC BY 4.0. Retrieved 2026-10-05. https://openstax.org/books/prealgebra-2e/pages/5-1-decimals"
  ],
  "related": [
    "least-to-greatest",
    "fraction-to-decimal",
    "integer",
    "absolute-value"
  ],
  "changelog": []
}
