Skip to content

Latest commit

 

History

History
68 lines (54 loc) · 1.41 KB

README.md

File metadata and controls

68 lines (54 loc) · 1.41 KB

math

This is a repository about math APIs.

2018-10-22
LinWei

Achieve some math APIs.
See Math.

Note:
No support to Internet Explorer.

APIs:

Math._pow

Description:
Return the base to the exponent power.

source
See Math.pow

Example:

Math._pow(2, 3)
// => 8

Math._pow(4, 0.5)
// => 2

Math._sqrt

Description:
Return the square root of a number.

source
See Math.sqrt

Example:

Math._sqrt(16)
// => 4

Math._sqrt('0x10')
// => 4

Math._sqrt(-1)
// => NaN

Math._toHex

Description:
Convert a number to hexadecimal sequence.

source

Example:

Math._toHex(64)
// => '40'

Math._toHex(NaN)
// => '0'