Skip to content

taishira/calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calculator

Use calculator to perform basic arithmetic operations.

Functions

The calculator module provides the following functions:

add

Adds two numbers.

function add(a: number, b: number): number

Parameters

  • a: The first number.
  • b: The second number.

Returns

The sum of a and b.

subtract

Subtracts the second number from the first number.

function subtract(a: number, b: number): number

Parameters

  • a: The first number.
  • b: The second number.

Returns

The difference between a and b.

multiply

Multiplies two numbers.

function multiply(a: number, b: number): number

Parameters

  • a: The first number.
  • b: The second number.

Returns

The product of a and b.

divide

Divides the first number by the second number.

function divide(a: number, b: number): number

Parameters

  • a: The first number.
  • b: The second number.

Returns

The quotient of a divided by b.

Throws

  • Error if b is 0 (division by zero is not allowed).

square

Squares a number.

function square(x: number): number

Parameters

  • x: The number to be squared.

Returns

The square of x.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published