Skip to content

Add factorial computation: utility module + REST endpoint#9

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/create-factorial-function
Draft

Add factorial computation: utility module + REST endpoint#9
Copilot wants to merge 2 commits intomasterfrom
copilot/create-factorial-function

Conversation

Copy link

Copilot AI commented Mar 18, 2026

Adds factorial calculation capability to the Task Manager API.

Changes

  • factorial.js — pure utility function; validates input is a non-negative integer ≤ 18 (cap enforces Number.MAX_SAFE_INTEGER safety; factorial(19) overflows safe integer range)
  • index.js — new GET /api/factorial/:n route returning { n, result }
  • tests/factorial.test.js — 13 tests covering utility edge cases and HTTP responses

Usage

GET /api/factorial/5
// → { "n": 5, "result": 120 }

GET /api/factorial/19
// → 400 { "error": "Input must not exceed 18 to ensure precise integer results" }

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Co-authored-by: kavyashri-as <213833080+kavyashri-as@users.noreply.github.com>
Copilot AI changed the title [WIP] Add factorial function implementation Add factorial computation: utility module + REST endpoint Mar 18, 2026
Copilot AI requested a review from kavyashri-as March 18, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants