Math Library

API

Build Status

Coverage Status

Table of Contents

goldenRatio

Function to return the golden ratio

Examples

n with n being a number n.goldenRatio()

Returns Number The goldenRatio of the number

round

Function to return the rounded form of a number method

Examples

1.95.round() => 2

Returns Number n with n being a number rounded to it's closest int by .50 in either direction

floor

Function to return the floor method

Examples

1.95.floor() =>  1

Returns number n with n being a number rounded down from it's float form to int

ceil

Function to return the ceil method

Examples

1.15.round() => 2

Returns number n with n being a number rounded up from it's float form to int

pad

Function that pads the number with 0's before and after the decimal for specified padding

Parameters

  • x
  • y

Examples

n.y.pad(4,4) => 000n.y000

Returns Number with the number being padded with zeroes to users specs

toRadian

Function that turns degrees to radians

Examples

n for n being a degree n.toRadian() => 135deg 3pie/4 rad

Returns Number with number being in radians

toDegree

Function that turns degrees to radians

Examples

n for n being a radian n.toDegree() =>

Returns Number with number being in degrees

toDollars

Function that turns decimal to dollar

Examples

n for n being a decimal n.toDollars() =>

Returns Number with number being in decimal

tax

Function that returns the tax rate of a number

Parameters

  • tax number rate paid in tax as a decimal

Examples

n for n being a Number n.tax() => 100.tax(8.875) = 8.88

Returns Number with the number being the amount of money in tax

taxWith

Function that returns the tax rate of a number added to the amount

Parameters

  • tax number rate paid in tax as a decimal

Examples

n for n being a Number n.tax() => 100.tax(8.875) = 188.88

Returns Number with the number being the amount of money in tax

interest

Function that calculates the interest on a number given the years and rate

Parameters

  • rate Number Interest rate
  • years Number Number of years to calculate the interest

Returns Number with the calculated interest

mortgage

Function that calculates a mortage based on principal number of payments and interest rate

Parameters

  • numberOfPayments Number times principal to be paid
  • interestRate Number Rate at which money will cost you more money

intToHex

Function that returns hex value for a given int

Returns Hexidecimal Returns a Hex value for corresponding int value