spreadsheet
typeScript/javascript spreadsheet parser, with formulas.
git clone https://git.vogt.world/spreadsheet.git
Log | Files | README.md
← Commit log
commit
message
[doc.sh] simple bash script to compile docs to markdown file
author
Ben Vogt <[email protected]>
date
2017-05-19 03:13:28
stats
9 file(s) changed, 1405 insertions(+), 91 deletions(-)
files
DOCS.md
README.md
TODO.md
docs.sh
package.json
src/Formulas/Date.ts
src/Formulas/Financial.ts
src/Formulas/Math.ts
src/Utilities/MathHelpers.ts
   1diff --git a/DOCS.md b/DOCS.md
   2new file mode 100644
   3index 0000000..e0af4a4
   4--- /dev/null
   5+++ b/DOCS.md
   6@@ -0,0 +1,1229 @@
   7+# Documentation
   8+
   9+## AllFormulas
  10+
  11+## Date
  12+
  13+
  14+### DATE 
  15+
  16+```
  17+  Converts a provided year, month, and day into a date. 
  18+@param year - The year component of the date. 
  19+@param month - The month component of the date. 
  20+@param day - The day component of the date. 
  21+@returns {number} newly created date. 
  22+@constructor
  23+```
  24+
  25+### DATEVALUE 
  26+
  27+```
  28+  Converts a provided date string in a known format to a date value. 
  29+@param dateString - The string representing the date. Understood formats include any date format which is normally auto-converted when entered, without quotation marks, directly into a cell. Understood formats may depend on region and language settings. 
  30+@returns {number} of days since 190011, inclusively. 
  31+@constructor
  32+```
  33+
  34+### EDATE 
  35+
  36+```
  37+  Returns a date a specified number of months before or after another date. 
  38+@param startDate - The date from which to calculate the result. 
  39+@param months - The number of months before (negative) or after (positive) start_date to calculate. 
  40+@returns {number} date a specified number of months before or after another date 
  41+@constructor
  42+```
  43+
  44+### EOMONTH 
  45+
  46+```
  47+  Returns a date representing the last day of a month which falls a specified number of months before or after another date. 
  48+@param startDate - The date from which to calculate the the result. 
  49+@param months - The number of months before (negative) or after (positive) start_date to consider. The last calendar day of the calculated month is returned. 
  50+@returns {number} the last day of a month 
  51+@constructor
  52+```
  53+
  54+### DAY 
  55+
  56+```
  57+  Returns the day of the month that a specific date falls on, in numeric format. 
  58+@param date - The date from which to extract the day. Must be a reference to a cell containing a date, a function returning a date type, or a number. 
  59+@returns {number} day of the month 
  60+@constructor
  61+```
  62+
  63+### DAYS 
  64+
  65+```
  66+  Returns the number of days between two dates. 
  67+@param endDate most recently occurring 
  68+@param startDate not most recently occurring 
  69+@returns {number} of days between start_date and end_date 
  70+@constructor
  71+```
  72+
  73+### DAYS360 
  74+
  75+```
  76+  Returns the difference between two days based on the 360 day year used in some financial interest calculations. 
  77+@param startDate - The start date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number. 
  78+@param endDate - The end date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number. 
  79+@param methodToUse - [ OPTIONAL - 0 by default ] - An indicator of what day count method to use. 0 indicates the US method - Under the US method, if start_date is the last day of a month, the day of month of tart_date is changed to 30 for the purposes of the calculation. Furthermore if end_date is the last day of a month and the day of the month of start_date is earlier than the 30th, end_date is changed to the first day of the month following end_date, otherwise the day of month of end_date is changed to 30. Any other value indicates the European method - Under the European method, any start_date or end_date that falls on the 31st of a month has its day of month changed to 30. 
  80+@returns {number} of days between two dates 
  81+@constructor
  82+```
  83+
  84+### MONTH 
  85+
  86+```
  87+  Returns the month of the year a specific date falls in, in numeric format. 
  88+@param date - The date from which to extract the month. Must be a reference to a cell containing a date, a function returning a date type, or a number. 
  89+@returns {number} month of the year that the input date falls on. 
  90+@constructor
  91+```
  92+
  93+### YEAR 
  94+
  95+```
  96+  Returns the year specified by a given date. 
  97+@param date - The date from which to calculate the year. Must be a cell reference to a cell containing a date, a function returning a date type, or a number. 
  98+@returns {number} year of the input date 
  99+@constructor
 100+```
 101+
 102+### WEEKDAY 
 103+
 104+```
 105+  Returns a number representing the day of the week of the date provided. 
 106+@param date - The date for which to determine the day of the week. Must be a reference to a cell containing a date, a function returning a date type, or a number. 
 107+@param offsetType - [ OPTIONAL - 1 by default ] - A number indicating which numbering system to use to represent weekdays. By default counts starting with Sunday = 1. If type is 1, days are counted from Sunday and the value of Sunday is 1, therefore the value of Saturday is 7. If type is 2, days are counted from Monday and the value of Monday is 1, therefore the value of Sunday is 7. If type is 3, days are counted from Monday and the value of Monday is 0, therefore the value of Sunday is 6. 
 108+@returns {number} day of week 
 109+@constructor
 110+```
 111+
 112+### WEEKNUM 
 113+
 114+```
 115+  Returns a number representing the week of the year where the provided date falls. When inputting the date, it is best to use the DATE function, as text values may return errors.  Behind the scenes, there are two week numbering "systems" used for this function: System 1 - The first week of the year is considered to be the week containing January 1, which is numbered week 1. System 2 - The first week of the year is considered to be the week containing the first Thursday of the year, which is numbered as week 1. System 2 is the approach specified in ISO 8601, also known as the European system for numbering weeks.  
 116+@param date - The date for which to determine the week number. Must be a reference to a cell containing a date, a function returning a date type, or a number. 
 117+@param shiftType - [ OPTIONAL - default is 1 ] - A number representing the day that a week starts on as well as the system used for determining the first week of the year (1=Sunday, 2=Monday). 
 118+@returns {number} representing week number of year. 
 119+@constructor
 120+```
 121+
 122+### DATEDIF 
 123+
 124+```
 125+  Calculates the number of days, months, or years between two dates. 
 126+@param startDate - The start date to consider in the calculation. Must be a reference to a cell containing a DATE, a function returning a DATE type, or a number. 
 127+@param endDate - The end date to consider in the calculation. Must be a reference to a cell containing a DATE, a function returning a DATE type, or a number. 
 128+@param unit - A text abbreviation for unit of time. For example,"M" for month. Accepted values are "Y": the number of whole years between start_date and end_date, "M": the number of whole months between start_date and end_date, "D": the number of days between start_date and end_date, "MD": the number of days between start_date and end_date after subtracting whole months, "YM": the number of whole months between start_date and end_date after ubtracting whole years, "YD": the number of days between start_date and end_date, assuming start_date and end_date were no more than one year apart. 
 129+@returns {number} number of days, months, or years between two dates. 
 130+@constructor
 131+```
 132+
 133+### YEARFRAC 
 134+
 135+```
 136+  Returns the number of years, including fractional years, between two dates using a specified day count convention.  Further reading:  http:christian-fries.deblogfile2013-yearfrac.html  http:finmath.netfinmath-lib  
 137+@param startDate - The start date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number. 
 138+@param endDate - The end date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number. 
 139+@param dayCountConvention - [ OPTIONAL - 0 by default ] - An indicator of what day count method to use. 
 140+@returns {number}the number of years, including fractional years, between two dates 
 141+@constructor
 142+```
 143+
 144+### TIMEVALUE 
 145+
 146+```
 147+  Returns the fraction of a 24-hour day the time represents. 
 148+@param timeString - The string that holds the time representation. Eg: "10am", "10:10", "10:10am", "10:10:11", or "10:10:11am". 
 149+@returns {number} representing the fraction of a 24-hour day 
 150+@constructor
 151+```
 152+
 153+### HOUR 
 154+
 155+```
 156+  Returns the hour component of a specific time, in numeric format. 
 157+@param time - The time from which to calculate the hour component. Must be a reference to a cell containing a datetime, a function returning a datetime type, or a number. 
 158+@returns {number} 
 159+@constructor
 160+```
 161+
 162+### MINUTE 
 163+
 164+```
 165+  Returns the minute component of a specific time, in numeric format. 
 166+@param time - The time from which to calculate the minute component. Must be a reference to a cell containing a datetime, a function returning a datetime type, or a number. 
 167+@returns {number} minute of the time passed in. 
 168+@constructor
 169+```
 170+
 171+### SECOND 
 172+
 173+```
 174+  Returns the second component of a specific time, in numeric format. 
 175+@param time - The time from which to calculate the second component. Must be a reference to a cell containing a datetime, a function returning a datetime type, or a number. 
 176+@returns {number} second component of a specific time. 
 177+@constructor
 178+```
 179+
 180+### TWORKDAYS 
 181+
 182+```
 183+  Returns the number of net working days between two provided days. 
 184+@param startDate - The start date of the period from which to calculate the number of net working days. 
 185+@param endDate - The end date of the period from which to calculate the number of net working days. 
 186+@param holidays - [ OPTIONAL ] - A range or array constant containing the date serial numbers to consider holidays. The values provided within an array for holidays must be date serial number values, as returned by N or date values, as returned by DATE, DATEVALUE or TO_DATE. Values specified by a range should be standard date values or date serial numbers. 
 187+@returns {number} the number of net working days between two provided dates. 
 188+@constructor
 189+```
 190+
 191+### INTL 
 192+
 193+```
 194+  Returns the number of networking days between two provided days excluding specified weekend days and holidays. 
 195+@param startDate - The start date of the period from which to calculate the number of net working days. 
 196+@param endDate - The end date of the period from which to calculate the number of net working days. 
 197+@param weekend - [ OPTIONAL - 1 by default ] - A number or string representing which days of the week are considered weekends. String method: weekends can be specified using seven 0’s and 1’s, where the first number in the et represents Monday and the last number is for Sunday. A zero means that the day is a work day, a 1 means that the day is a weekend. For example, “0000011” would mean Saturday and Sunday are weekends. Number method: instead of using the string method above, a single number can be used. 1 = SaturdaySunday are weekends, 2 = SundayMonday, and this pattern repeats until 7 = FridaySaturday. 11 = Sunday is the only weekend, 12 = Monday is the only weekend, and this pattern repeats until 17 = Saturday is the only weekend. 
 198+@param holidays - [ OPTIONAL ] - A range or array constant containing the dates to consider as holidays. The values provided within an array for holidays must be date serial number values, as returned by N or date values, as returned by DATE, DATEVALUE or TO_DATE. Values specified by a range should be standard date values or date serial numbers. 
 199+@returns {number} of networking days between two provided days 
 200+@constructor
 201+```
 202+
 203+### NOW 
 204+
 205+```
 206+  Returns the current date and time as a date value. 
 207+@returns {number} representing the current date and time. 
 208+@constructor
 209+```
 210+
 211+### TODAY 
 212+
 213+```
 214+  Returns the current date as a date value. 
 215+@returns {number} today 
 216+@constructor
 217+```
 218+
 219+### TIME 
 220+
 221+```
 222+  Converts a provided hour, minute, and second into a time. Will silently recalculate numeric time values which fall outside of valid ranges. Eg: TIME(24, 0, 0) is the same as TIME(0, 0, 0). 
 223+@param hours - The hour component of the time. 
 224+@param minutes - The minute component of the time. 
 225+@param seconds - The second component of the time. 
 226+@returns {number} time of day 
 227+@constructor
 228+```
 229+
 230+### WORKDAY 
 231+
 232+```
 233+  Calculates the end date after a specified number of working days. 
 234+@param startDate - The date from which to begin counting. 
 235+@param numberOfDays - The number of working days to advance from start_date. If negative, counts backwards. If not an integer, truncate. 
 236+@param holidays - [ OPTIONAL ] - A range or array constant containing the dates to consider holidays. The values provided within an array for holidays must be date serial number values, as returned by N or date values, as returned by DATE, DATEVALUE or TO_DATE. Values specified by a range should be standard date values or date serial numbers. 
 237+@returns {number} end date after a specified number of working days. 
 238+@constructor
 239+```
 240+
 241+### INTL 
 242+
 243+```
 244+  Calculates the date after a specified number of workdays excluding specified weekend days and holidays. 
 245+@param startDate - The date from which to begin counting. 
 246+@param numberOfDays - The number of working days to advance from start_date. If negative, counts backwards. 
 247+@param weekend - [ OPTIONAL - 1 by default ] - A number or string representing which days of the week are considered weekends. String method: weekends can be specified using seven 0’s and 1’s, where the first number in the et represents Monday and the last number is for Sunday. A zero means that the day is a work day, a 1 means that the day is a weekend. For example, “0000011” would mean Saturday and Sunday are weekends. Number method: instead of using the string method above, a single number can be used. 1 = SaturdaySunday are weekends, 2 = SundayMonday, and this pattern repeats until 7 = FridaySaturday. 11 = Sunday is the only weekend, 12 = Monday is the only weekend, and this pattern repeats until 17 = Saturday is the only weekend. 
 248+@param holidays - [ OPTIONAL ] - A range or array constant containing the dates to consider holidays. 
 249+@returns {number} 
 250+@constructor
 251+```
 252+## Engineering
 253+
 254+
 255+### BIN2DEC 
 256+
 257+```
 258+  Converts a signed binary number to decimal format. 
 259+@param signedBinaryNumber - The signed 10-bit binary value to be converted to decimal, provided as a tring. The most significant bit of signed_binary_number is the sign bit; that is, negative numbers are represented in two's complement format. 
 260+@returns {number} 
 261+@constructor
 262+```
 263+
 264+### BIN2HEX 
 265+
 266+```
 267+  Converts a signed binary number to signed hexadecimal format. 
 268+@param signedBinaryNumber - The signed 10-bit binary value to be converted to signed hexadecimal, provided as a string. The most significant bit of signed_binary_number is the sign bit; that is, negative numbers are represented in two's complement format. 
 269+@param significantDigits - [ OPTIONAL ] - The number of significant digits to ensure in the result. 
 270+@returns {string} string representation of a signed hexadecimal 
 271+@constructor
 272+```
 273+
 274+### BIN2OCT 
 275+
 276+```
 277+  Converts a signed binary number to signed octal format. 
 278+@param signedBinaryNumber - The signed 10-bit binary value to be converted to signed octal, provided as a tring. The most significant bit of signed_binary_number is the sign bit; that is, negative numbers are represented in two's complement format. 
 279+@param significantDigits - [ OPTIONAL ] - The number of significant digits to ensure in the result. If this is greater than the number of significant digits in the result, the result is left-padded with zeros until the total number of digits reaches significant_digits. 
 280+@returns {string} number in octal format 
 281+@constructor
 282+```
 283+
 284+### DEC2OCT 
 285+
 286+```
 287+  Converts a decimal number to signed octal format. 
 288+@param decimalDumber - The decimal value to be converted to signed octal,provided as a string. For this function, this value has a maximum of 536870911 if positive, and a minimum of -53687092 if negative. 
 289+@param significantDigits - [ OPTIONAL ] The number of significant digits to ensure in the result. If this is greater than the number of significant digits in the result, the result is left-padded with zeros until the total number of digits reaches significant_digits. 
 290+@returns {string} octal string representation of the decimal number 
 291+@constructor
 292+```
 293+
 294+### DEC2HEX 
 295+
 296+```
 297+  Converts a decimal number to signed hexadecimal format. 
 298+@param decimalDumber - The decimal value to be converted to signed hexadecimal, provided as a string. This value has a maximum of 549755813887 if positive, and a minimum of -549755814888 if negative. 
 299+@param significantDigits - [ OPTIONAL ] - The number of significant digits to ensure in the result. If this is greater than the number of significant digits in the result, the result is left-padded with zeros until the total number of digits reaches significant_digits. This value is ignored if decimal_number is negative. 
 300+@returns {string} hexadecimal string representation of the decimal number 
 301+@constructor
 302+```
 303+
 304+### DEC2BIN 
 305+
 306+```
 307+  Converts a decimal number to signed binary format. 
 308+@param decimalDumber - The decimal value to be converted to signed binary, provided as a string. For this function, this value has a maximum of 511 if positive, and a minimum of -512 if negative. 
 309+@param significantDigits - [ OPTIONAL ] The number of significant digits to ensure in the result. If this is greater than the number of significant digits in the result, the result is left-padded with zeros until the total number of digits reaches significant_digits. 
 310+@returns {string} signed binary string representation of the input decimal number. 
 311+@constructor
 312+```
 313+
 314+### DELTA 
 315+
 316+```
 317+  Compare two numeric values, returning 1 if they're equal. 
 318+@param one - The first number to compare. 
 319+@param two - The second number to compare. 
 320+@returns {number} 1 if they're equal, 0 if they're not equal. 
 321+@constructor
 322+```
 323+## Financial
 324+
 325+
 326+### DDB 
 327+
 328+```
 329+  Calculates the depreciation of an asset for a specified period using the double-declining balance method. 
 330+@param cost - The initial cost of the asset. 
 331+@param salvage - The value of the asset at the end of depreciation. 
 332+@param life - The number of periods over which the asset is depreciated. 
 333+@param period - The single period within life for which to calculate depreciation. 
 334+@param factor - [ OPTIONAL - 2 by default ] - The factor by which depreciation decreases. 
 335+@returns {number} depreciation of an asset for a specified period 
 336+@constructor
 337+```
 338+
 339+### DB 
 340+
 341+```
 342+  Calculates the depreciation of an asset for a specified period using the arithmetic declining balance method. 
 343+@param cost - The initial cost of the asset. 
 344+@param salvage - The value of the asset at the end of depreciation. 
 345+@param life - The number of periods over which the asset is depreciated. 
 346+@param period - The single period within life for which to calculate depreciation. 
 347+@param month - [ OPTIONAL - 12 by default ] - The number of months in the first year of depreciation. 
 348+@returns {number} depreciated value 
 349+@constructor
 350+```
 351+
 352+### DOLLAR 
 353+
 354+```
 355+  Formats a number into the locale-specific currency format. WARNING: Currently the equivalent of TRUNC, since this returns numbers 
 356+@param number - The value to be formatted. 
 357+@param places - [ OPTIONAL - 2 by default ] - The number of decimal places to display. 
 358+@returns {number} dollars 
 359+@constructor
 360+```
 361+
 362+### DOLLARDE 
 363+
 364+```
 365+  Converts a price quotation given as a decimal fraction into a decimal value. 
 366+@param fractionalPrice - The price quotation given using fractional decimal conventions. 
 367+@param unit - The units of the fraction, e.g. 8 for 18ths or 32 for 132nds. 
 368+@returns {number} decimal value. 
 369+@constructor
 370+```
 371+
 372+### DOLLARFR 
 373+
 374+```
 375+  Converts a price quotation given as a decimal value into a decimal fraction. 
 376+@param decimalPrice - The price quotation given as a decimal value. 
 377+@param unit - The units of the desired fraction, e.g. 8 for 18ths or 32 for 132nds 
 378+@returns {number} price quotation as decimal fraction. 
 379+@constructor
 380+```
 381+
 382+### EFFECT 
 383+
 384+```
 385+  Calculates the annual effective interest rate given the nominal rate and number of compounding periods per year. 
 386+@param nominalRate - The nominal interest rate per year. 
 387+@param periodsPerYear - The number of compounding periods per year. 
 388+@returns {number} annual effective interest rate 
 389+@constructor
 390+```
 391+
 392+### PMT 
 393+
 394+```
 395+  Calculates the periodic payment for an annuity investment based on constant-amount periodic payments and a constant interest rate. 
 396+@param rate - The interest rate. 
 397+@param periods - The number of payments to be made. 
 398+@param presentValue - The current value of the annuity. 
 399+@param futureValue [ OPTIONAL ] - The future value remaining after the final payment has been made. 
 400+@param endOrBeginning [ OPTIONAL - 0 by default ] - Whether payments are due at the end (0) or beginning (1) of each period. 
 401+@returns {number} 
 402+@constructor
 403+```
 404+
 405+### CUMPRINC 
 406+
 407+```
 408+  Calculates the cumulative principal paid over a range of payment periods for an investment based on constant-amount periodic payments and a constant interest rate. 
 409+@param rate - The interest rate. 
 410+@param numberOfPeriods - The number of payments to be made. 
 411+@param presentValue - The current value of the annuity. 
 412+@param firstPeriod - The number of the payment period to begin the cumulative calculation. must be greater than or equal to 1. 
 413+@param lastPeriod - The number of the payment period to end the cumulative calculation, must be greater than first_period. 
 414+@param endOrBeginning - Whether payments are due at the end (0) or beginning (1) of each period 
 415+@returns {number} cumulative principal 
 416+@constructor
 417+```
 418+
 419+### CUMIPMT 
 420+
 421+```
 422+  Calculates the cumulative interest over a range of payment periods for an investment based on constant-amount periodic payments and a constant interest rate. 
 423+@param rate - The interest rate. 
 424+@param numberOfPeriods - The number of payments to be made. 
 425+@param presentValue - The current value of the annuity. 
 426+@param firstPeriod - The number of the payment period to begin the cumulative calculation, must be greater than or equal to 1. 
 427+@param lastPeriod - The number of the payment period to end the cumulative calculation, must be greater than first_period. 
 428+@param endOrBeginning - Whether payments are due at the end (0) or beginning (1) of each period. 
 429+@returns {number} cumulative interest 
 430+@constructor
 431+```
 432+
 433+### ACCRINT 
 434+
 435+```
 436+  Calculates the accrued interest of a security that has periodic payments. WARNING: This function has been implemented to specifications as outlined in Google Spreadsheets, LibreOffice, and OpenOffice. It functions much the same as MSExcel's ACCRINT, but there are several key differences. Below are links to illustrate the differences. Please see the source code for more information on differences. Links: https:quant.stackexchange.comquestion7040whats-the-algorithm-behind-excels-accrint, https:upport.office.comen-uarticleACCRINT-function-fe45d089-6722-4fb3-9379-e1f911d8dc74, https:quant.stackexchange.comquestion7040whats-the-algorithm-behind-excels-accrint, https:upport.google.comdocanswer3093200 . 
 437+@param issue - The date the security was initially issued. 
 438+@param firstPayment - The first date interest will be paid. 
 439+@param settlement - The settlement date of the security, the date after issuance when the security is delivered to the buyer. Is the maturity date of the security if it is held until maturity rather than sold. 
 440+@param rate - The annualized rate of interest. 
 441+@param redemption - The redemption amount per 100 face value, or par. 
 442+@param frequency - The number of coupon payments per year. For annual payments, frequency = 1; for emiannual, frequency = 2; for quarterly, frequency = 4. 
 443+@param dayCountConvention - [ OPTIONAL - 0 by default ] - An indicator of what day count method to use. 0 or omitted = US (NASD) 30360, 1 = Actualactual, 2 = Actual360, 3 = Actual365, 4 = European 30360. 
 444+@returns {number} 
 445+@constructor TODO: This function is based off of the open-source versions I was able to dig up online. We should implement a TODO:     second version that is closer to what MSExcel does and is named something like `ACCRINT.MS`.
 446+```
 447+## Logical
 448+
 449+
 450+### AND 
 451+
 452+```
 453+  Returns true if all of the provided arguments are logically true, and false if any of the provided arguments are logically false. 
 454+@param values At least one expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE, or an expression that can be coerced to a logical value. 
 455+@returns {boolean} if all values are logically true. 
 456+@constructor
 457+```
 458+
 459+### EXACT 
 460+
 461+```
 462+  Tests whether two strings are identical, returning true if they are. 
 463+@param one - The first string to compare 
 464+@param two - The second string to compare 
 465+@returns {boolean} 
 466+@constructor
 467+```
 468+
 469+### TRUE 
 470+
 471+```
 472+  Returns true. 
 473+@returns {boolean} true boolean 
 474+@constructor
 475+```
 476+
 477+### FALSE 
 478+
 479+```
 480+  Returns false. 
 481+@returns {boolean} false boolean 
 482+@constructor
 483+```
 484+
 485+### NOT 
 486+
 487+```
 488+  Returns the opposite of a logical value - NOT(TRUE) returns FALSE; NOT(FALSE) returns TRUE. 
 489+@param value - An expression or reference to a cell holding an expression that represents some logical value. 
 490+@returns {boolean} opposite of a logical value input 
 491+@constructor
 492+```
 493+
 494+### OR 
 495+
 496+```
 497+  Returns true if any of the provided arguments are logically true, and false if all of the provided arguments are logically false. 
 498+@param values An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE, or an expression that can be coerced to a logical value. 
 499+@returns {boolean} 
 500+@constructor
 501+```
 502+
 503+### XOR 
 504+
 505+```
 506+  Exclusive or or exclusive disjunction is a logical operation that outputs true only when inputs differ. 
 507+@param values to check for exclusivity. 
 508+@returns {boolean} returns true if only one input is considered logically true. 
 509+@constructor
 510+```
 511+## Math
 512+
 513+
 514+### ABS 
 515+
 516+```
 517+  Returns the absolute value of a number. 
 518+@param value to get the absolute value of. 
 519+@returns {number} absolute value 
 520+@constructor
 521+```
 522+
 523+### ACOS 
 524+
 525+```
 526+  Returns the inverse cosine of a value, in radians. 
 527+@param value The value for which to calculate the inverse cosine. Must be between -1 and 1, inclusive. 
 528+@returns {number} inverse cosine of value 
 529+@constructor
 530+```
 531+
 532+### ACOSH 
 533+
 534+```
 535+  Returns the inverse hyperbolic cosine of a number. 
 536+@param value The value for which to calculate the inverse hyperbolic cosine. Must be greater than or equal to 1. 
 537+@returns {number} to find the inverse hyperbolic cosine for. 
 538+@constructor
 539+```
 540+
 541+### ACOTH 
 542+
 543+```
 544+  Calculate the hyperbolic arc-cotangent of a value 
 545+@param value number not between -1 and 1 inclusively. 
 546+@returns {number} hyperbolic arc-cotangent 
 547+@constructor
 548+```
 549+
 550+### ASIN 
 551+
 552+```
 553+  Returns the inverse sine of a value, in radians. 
 554+@param value The value for which to calculate the inverse sine. Must be between -1 and 1, inclusive. 
 555+@returns {number} inverse sine of input value 
 556+@constructor
 557+```
 558+
 559+### ASINH 
 560+
 561+```
 562+  Returns the inverse hyperbolic sine of a number. 
 563+@param value The value for which to calculate the inverse hyperbolic sine. 
 564+@returns {number} inverse hyperbolic sine of input 
 565+@constructor
 566+```
 567+
 568+### ATAN 
 569+
 570+```
 571+  Returns the inverse tangent of a value, in radians. 
 572+@param value The value for which to calculate the inverse tangent. 
 573+@returns {number} inverse tangent of input value 
 574+@constructor
 575+```
 576+
 577+### ATAN2 
 578+
 579+```
 580+  Returns the angle between the x-axis and a line segment from the origin (0,0) to specified coordinate pair (x,y), in radians. 
 581+@param x The x coordinate of the endpoint of the line segment for which to calculate the angle from the x-axis. 
 582+@param y The y coordinate of the endpoint of the line segment for which to calculate the angle from the x-axis. 
 583+@returns {number} angle in radians 
 584+@constructor
 585+```
 586+
 587+### ATANH 
 588+
 589+```
 590+  Returns the inverse hyperbolic tangent of a number. 
 591+@param value The value for which to calculate the inverse hyperbolic tangent. Must be between -1 and 1, exclusive. 
 592+@returns {number} inverse hyperbolic tangent of input 
 593+@constructor
 594+```
 595+
 596+### EVEN 
 597+
 598+```
 599+  Rounds a number up to the nearest even integer. 
 600+@param value The value to round to the next greatest even number. 
 601+@returns {number} next greatest even number 
 602+@constructor
 603+```
 604+
 605+### MOD 
 606+
 607+```
 608+  Returns the result of the modulo operator, the remainder after a division operation. 
 609+@param dividend The number to be divided to find the remainder. 
 610+@param divisor The number to divide by. 
 611+@returns {number} 
 612+@constructor
 613+```
 614+
 615+### ODD 
 616+
 617+```
 618+  Rounds a number up to the nearest odd integer. 
 619+@param value The value to round to the next greatest odd number. 
 620+@returns {number} value to round up to next greatest odd number. 
 621+@constructor
 622+```
 623+
 624+### POWER 
 625+
 626+```
 627+  Returns a number raised to a power. 
 628+@param base - The number to raise to the exponent power. 
 629+@param exponent - The exponent to raise base to. 
 630+@returns {number} resulting number 
 631+@constructor
 632+```
 633+
 634+### SUM 
 635+
 636+```
 637+  Returns the sum of a series of numbers andor cells. 
 638+@param values The first number or range to add together. 
 639+@returns {number} The sum of the series 
 640+@constructor
 641+```
 642+
 643+### SQRT 
 644+
 645+```
 646+  Returns the positive square root of a positive number. 
 647+@param value - The number for which to calculate the positive square root. 
 648+@returns {number} square root 
 649+@constructor
 650+```
 651+
 652+### SQRTPI 
 653+
 654+```
 655+  Returns the positive square root of the product of Pi and the given positive number. 
 656+@param value - The number which will be multiplied by Pi and have the product's square root returned 
 657+@returns {number} the positive square root of the product of Pi and the given positive number. 
 658+@constructor
 659+```
 660+
 661+### COS 
 662+
 663+```
 664+  Returns the cosine of an angle provided in radians. 
 665+@param value - The angle to find the cosine of, in radians. 
 666+@returns {number} cosine of angle 
 667+@constructor
 668+```
 669+
 670+### COSH 
 671+
 672+```
 673+  Returns the hyperbolic cosine of any real number. 
 674+@param value - Any real value to calculate the hyperbolic cosine of. 
 675+@returns {number} the hyperbolic cosine of the input 
 676+@constructor
 677+```
 678+
 679+### COT 
 680+
 681+```
 682+  Returns the cotangent of any real number. Defined as cot(x) = 1  tan(x). 
 683+@param value - number to calculate the cotangent for 
 684+@returns {number} cotangent 
 685+@constructor
 686+```
 687+
 688+### COTH 
 689+
 690+```
 691+  Return the hyperbolic cotangent of a value, defined as coth(x) = 1  tanh(x). 
 692+@param value - value to calculate the hyperbolic cotangent value of 
 693+@returns {number} hyperbolic cotangent 
 694+@constructor
 695+```
 696+
 697+### INT 
 698+
 699+```
 700+  Rounds a number down to the nearest integer that is less than or equal to it. 
 701+@param value -  The value to round down to the nearest integer. 
 702+@returns {number} Rounded number 
 703+@constructor
 704+```
 705+
 706+### ISEVEN 
 707+
 708+```
 709+  Checks whether the provided value is even. 
 710+@param value - The value to be verified as even. 
 711+@returns {boolean} whether this value is even or not 
 712+@constructor
 713+```
 714+
 715+### ISODD 
 716+
 717+```
 718+  Checks whether the provided value is odd. 
 719+@param value - The value to be verified as odd. 
 720+@returns {boolean} whether this value is odd or not 
 721+@constructor
 722+```
 723+
 724+### SIN 
 725+
 726+```
 727+  Returns the sine of an angle provided in radians. 
 728+@param value - The angle to find the sine of, in radians. 
 729+@returns {number} Sine of angle. 
 730+@constructor
 731+```
 732+
 733+### SINH 
 734+
 735+```
 736+  Returns the hyperbolic sine of any real number. 
 737+@param value - real number to find the hyperbolic sine of 
 738+@returns {number} hyperbolic sine 
 739+@constructor
 740+```
 741+
 742+### PI 
 743+
 744+```
 745+  The value Pi. 
 746+@returns {number} Pi. 
 747+@constructor
 748+```
 749+
 750+### LOG10 
 751+
 752+```
 753+  Returns the the logarithm of a number, base 10. 
 754+@param value - The value for which to calculate the logarithm, base 10. 
 755+@returns {number} logarithm of the number, in base 10. 
 756+@constructor
 757+```
 758+
 759+### LOG 
 760+
 761+```
 762+  Returns the the logarithm of a number given a base. 
 763+@param value - The value for which to calculate the logarithm given base. 
 764+@param base - The base to use for calculation of the logarithm. Defaults to 10. 
 765+@returns {number} 
 766+@constructor
 767+```
 768+
 769+### LN 
 770+
 771+```
 772+  Returns the logarithm of a number, base e (Euler's number). 
 773+@param value - The value for which to calculate the logarithm, base e. 
 774+@returns {number} logarithm calculated 
 775+@constructor
 776+```
 777+
 778+### TAN 
 779+
 780+```
 781+  Returns the tangent of an angle provided in radians. 
 782+@param value - The angle to find the tangent of, in radians. 
 783+@returns {number} tangent in radians 
 784+@constructor
 785+```
 786+
 787+### TANH 
 788+
 789+```
 790+  Returns the hyperbolic tangent of any real number. 
 791+@param value - Any real value to calculate the hyperbolic tangent of. 
 792+@returns {number} hyperbolic tangent 
 793+@constructor
 794+```
 795+
 796+### CEILING 
 797+
 798+```
 799+  Rounds a number up to the nearest integer multiple of specified significance. 
 800+@param value The value to round up to the nearest integer multiple of factor. 
 801+@param factor - [ OPTIONAL ] The number to whose multiples value will be rounded. 
 802+@returns {number} 
 803+@constructor
 804+```
 805+
 806+### FLOOR 
 807+
 808+```
 809+  Rounds a number down to the nearest integer multiple of specified significance. 
 810+@param value - The value to round down to the nearest integer multiple of factor. 
 811+@param factor - The number to whose multiples value will be rounded. 
 812+@returns {number} 
 813+@constructor
 814+```
 815+
 816+### IF 
 817+
 818+```
 819+  Returns one value if a logical expression is TRUE and another if it is FALSE. 
 820+@param logicalExpression - An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE. 
 821+@param valueIfTrue - The value the function returns if logical_expression is TRUE 
 822+@param valueIfFalse - The value the function returns if logical_expression is FALSE. 
 823+@returns one value if a logical expression is TRUE and another if it is FALSE. 
 824+@constructor
 825+```
 826+
 827+### COUNTIF 
 828+
 829+```
 830+  Returns a conditional count across a range. 
 831+@param range - The range that is tested against criterion., value[1]; 
 832+@param criteria - The pattern or test to apply to range. If the range to check against contains text, this must be a string. It can be a comparison based string (e.g. "=1", "<1", ">=1") or it can be a wild-card string, in which  matches any number of characters, and ? matches the next character. Both ? and  can be escaped by placing a ~ in front of them. If it is neither, it will compared with values in the range using equality comparison. 
 833+@returns {number} 
 834+@constructor
 835+```
 836+
 837+### COUNTIFS 
 838+
 839+```
 840+  Returns the count of a range depending on multiple criteria. 
 841+@param values[0] criteria_range1 - The range to check against criterion1. 
 842+@param values[1] criterion1 - The pattern or test to apply to criteria_range1. 
 843+@param values[2...N] Repeated sets of ranges and criterion to check. 
 844+@returns {number} count 
 845+@constructor
 846+```
 847+
 848+### ROUND 
 849+
 850+```
 851+  Rounds a number to a certain number of decimal places according to standard rules. 
 852+@param value - The value to round to places number of places. 
 853+@param places - The number of decimal places to which to round. 
 854+@returns {number} 
 855+@constructor
 856+```
 857+
 858+### ROUNDDOWN 
 859+
 860+```
 861+  Rounds a number to a certain number of decimal places, always rounding down to the next valid increment. 
 862+@param value - The value to round to places number of places, always rounding down. 
 863+@param places - (optional) The number of decimal places to which to round. 
 864+@returns {number} 
 865+@constructor
 866+```
 867+
 868+### ROUNDUP 
 869+
 870+```
 871+  Rounds a number to a certain number of decimal places, always rounding up to the next valid increment. 
 872+@param value - The value to round to places number of places, always rounding up. 
 873+@param places - (optional) The number of decimal places to which to round. 
 874+@returns {number} 
 875+@constructor
 876+```
 877+
 878+### SUMIF 
 879+
 880+```
 881+  Returns a conditional sum across a range. 
 882+@param range -  The range which is tested against criterion. 
 883+@param criteria - The pattern or test to apply to range. If the range to check against contains text, this must be a tring. It can be a comparison based string (e.g. "=1", "<1", ">=1") or it can be a wild-card string, in which  matches any number of characters, and ? matches the next character. Both ? and  can be escaped by placing a ~ in front of them. 
 884+@param sumRange - (optional) The range to be summed, if different from range. 
 885+@returns {number} 
 886+@constructor
 887+```
 888+
 889+### SUMSQ 
 890+
 891+```
 892+  Returns the sum of the squares of a series of numbers andor cells. 
 893+@param values  The values or range(s) whose squares to add together. 
 894+@returns {number} the sum of the squares if the input. 
 895+@constructor
 896+```
 897+
 898+### TRUNC 
 899+
 900+```
 901+  Truncates a number to a certain number of significant digits by omitting less significant digits. 
 902+@param value - The value to be truncated. 
 903+@param places - [ OPTIONAL - 0 by default ] - The number of significant digits to the right of the decimal point to retain. If places is greater than the number of significant digits in value, value is returned without modification. places may be negative, in which case the specified number of digits to the left of the decimal place are changed to zero. All digits to the right of the decimal place are discarded. If all digits of value are changed to zero, TRUNC imply returns 0. 
 904+@returns {number} after truncation 
 905+@constructor
 906+```
 907+
 908+### RADIANS 
 909+
 910+```
 911+  Converts an angle value in degrees to radians. 
 912+@param angle - The angle to convert from degrees to radians. 
 913+@returns {number} radians 
 914+@constructor
 915+```
 916+
 917+### DEGREES 
 918+
 919+```
 920+  Converts an angle value in radians to degrees. 
 921+@param angle - The angle to convert from radians to degrees. 
 922+@returns {number} degrees 
 923+@constructor
 924+```
 925+
 926+### ERFC 
 927+
 928+```
 929+  Returns the complementary Gauss error function of a value. 
 930+@param value - The number for which to calculate the complementary Gauss error function. 
 931+@returns {number} complementary Gauss error function of a value 
 932+@constructor
 933+```
 934+
 935+### ERF 
 936+
 937+```
 938+  Returns the error function integrated between lower_limit and upper_limit. 
 939+@param lowerLimit - The lower bound for integrating ERF. 
 940+@param upperLimit - [Optional]. The upper bound for integrating ERF. If omitted, ERF integrates between zero and lower_limit. 
 941+@returns {number} error function integrated between lower_limit and upper_limit 
 942+@constructor
 943+```
 944+
 945+### SUMX2PY2 
 946+
 947+```
 948+  Calculates the sum of the sums of the squares of values in two arrays. 
 949+@param arrayX - The array or range of values whose squares will be added to the squares of corresponding entries in arrayY and added together. 
 950+@param arrayY - The array or range of values whose squares will be added to the squares of corresponding entries in arrayX and added together. 
 951+@returns {number} sum of the sums of the squares 
 952+@constructor
 953+```
 954+
 955+### SUMX2MY2 
 956+
 957+```
 958+  Calculates the sum of the differences of the squares of values in two arrays. 
 959+@param arrayX - The array or range of values whose squares will be reduced by the squares of corresponding entries in array_y and added together. 
 960+@param arrayY - The array or range of values whose squares will be subtracted from the squares of corresponding entries in array_x and added together. 
 961+@returns {number} sum of the differences of the squares 
 962+@constructor
 963+```
 964+
 965+### UNTUNIQUE 
 966+
 967+```
 968+  Counts the number of unique values in a list of specified values and ranges. 
 969+@param values The values or ranges to consider for uniqueness. Supports an arbitrary number of arguments for this function. 
 970+@returns {number} of unique values passed in. 
 971+@constructor
 972+```
 973+
 974+### UMPRODUCT 
 975+
 976+```
 977+  Calculates the sum of the products of corresponding entries in two equal-sized arrays or ranges. 
 978+@param values Arrays or ranges whose entries will be multiplied with corresponding entries in the second such array or range. 
 979+@returns {number} sum of the products 
 980+@constructor
 981+```
 982+
 983+### COMBIN 
 984+
 985+```
 986+  Returns the number of ways to choose some number of objects from a pool of a given size of objects. 
 987+@param m - The size of the pool of objects to choose from. 
 988+@param k - The number of objects to choose. 
 989+@returns {number} number of ways 
 990+@constructor
 991+```
 992+## Statistical
 993+
 994+
 995+### DEVSQ 
 996+
 997+```
 998+  Calculates the sum of squares of deviations based on a sample. 
 999+@param values - The values or ranges of the sample. 
1000+@returns {number} sum of squares of deviations 
1001+@constructor
1002+```
1003+
1004+### MEDIAN 
1005+
1006+```
1007+  Returns the median value in a numeric dataset. 
1008+@param values - The value(s) or range(s) to consider when calculating the median value. 
1009+@returns {number} the median value of the dataset 
1010+@constructor
1011+```
1012+
1013+### AVERAGE 
1014+
1015+```
1016+  Returns the numerical average value in a dataset, ignoring text. 
1017+@param values - The values or ranges to consider when calculating the average value. 
1018+@returns {number} the average value of this dataset. 
1019+@constructor
1020+```
1021+
1022+### AVEDEV 
1023+
1024+```
1025+  Calculates the average of the magnitudes of deviations of data from a dataset's mean. 
1026+@param values - The value(s) or range(s) 
1027+@returns {number} average of the magnitudes of deviations of data from a dataset's mean 
1028+@constructor
1029+```
1030+
1031+### AVERAGEA 
1032+
1033+```
1034+  Returns the numerical average value in a dataset, coercing text values in ranges to 0 values. 
1035+@param values - value(s) or range(s) to consider when calculating the average value. 
1036+@returns {number} the numerical average value in a dataset 
1037+@constructor
1038+```
1039+
1040+### CORREL 
1041+
1042+```
1043+  Calculates r, the Pearson product-moment correlation coefficient of a dataset. Any text encountered in the arguments will be ignored. CORREL is synonymous with PEARSON. 
1044+@param dataY - The range representing the array or matrix of dependent data. 
1045+@param dataX - The range representing the array or matrix of independent data. 
1046+@returns {number} the Pearson product-moment correlation coefficient. 
1047+@constructor
1048+```
1049+
1050+### PEARSON 
1051+
1052+```
1053+  Calculates r, the Pearson product-moment correlation coefficient of a dataset. Any text encountered in the arguments will be ignored. PEARSON is synonymous with CORREL. 
1054+@param dataY - The range representing the array or matrix of dependent data. 
1055+@param dataX - The range representing the array or matrix of independent data. 
1056+@returns {number} the Pearson product-moment correlation coefficient. 
1057+@constructor
1058+```
1059+
1060+### EXPONDIST 
1061+
1062+```
1063+  Returns the value of the exponential distribution function with a specified lambda at a specified value. 
1064+@param x - The input to the exponential distribution function. If cumulative is TRUE then EXPONDIST returns the cumulative probability of all values up to x. 
1065+@param lambda - The lambda to specify the exponential distribution function. 
1066+@param cumulative - Whether to use the exponential cumulative distribution. 
1067+@returns {number} value of the exponential distribution function. 
1068+@constructor
1069+```
1070+
1071+### EFTTAILED 
1072+
1073+```
1074+  Calculates the left-tailed F probability distribution (degree of diversity) for two data sets with given input x. Alternately called Fisher-Snedecor distribution or Snecdor's F distribution. 
1075+@param x - The input to the F probability distribution function. The value at which to evaluate the function. Must be a positive number. 
1076+@param degreesFreedom1 - The numerator degrees of freedom. 
1077+@param degreesFreedom2 - The denominator degrees of freedom. 
1078+@param cumulative - Logical value that determines the form of the function. If true returns the cumulative distribution function. If false returns the probability density function. 
1079+@returns {number|boolean} left-tailed F probability distribution 
1080+@constructor TODO: This function should be stricter in its return type.
1081+```
1082+
1083+### FINV 
1084+
1085+```
1086+  Returns the inverse of the (right-tailed) F probability distribution. If p = FDIST(x,...), then FINV(p,...) = x. The F distribution can be used in an F-test that compares the degree of variability in two data sets. 
1087+@param probability - A probability associated with the F cumulative distribution. 
1088+@param degFreedom1 - Required. The numerator degrees of freedom. 
1089+@param degFreedom2 - Required. The denominator degrees of freedom. 
1090+@returns {number} inverse of the (right-tailed) F probability distribution 
1091+@constructor
1092+```
1093+
1094+### FISHER 
1095+
1096+```
1097+  Returns the Fisher transformation of a specified value. 
1098+@param value - The value for which to calculate the Fisher transformation. 
1099+@returns {number} Fisher transformation 
1100+@constructor
1101+```
1102+
1103+### FISHERINV 
1104+
1105+```
1106+  Returns the inverse Fisher transformation of a specified value. 
1107+@param value - The value for which to calculate the inverse Fisher transformation. 
1108+@returns {number} inverse Fisher transformation 
1109+@constructor
1110+```
1111+
1112+### MAX 
1113+
1114+```
1115+  Returns the maximum value in a numeric dataset. 
1116+@param values - The values or range(s) to consider when calculating the maximum value. 
1117+@returns {number} the maximum value of the dataset 
1118+@constructor
1119+```
1120+
1121+### MAXA 
1122+
1123+```
1124+  Returns the maximum numeric value in a dataset. 
1125+@param values - The value(s) or range(s) to consider when calculating the maximum value. 
1126+@returns {number} maximum value of the dataset 
1127+@constructor
1128+```
1129+
1130+### MIN 
1131+
1132+```
1133+  Returns the minimum value in a numeric dataset. 
1134+@param values - The value(s) or range(s) to consider when calculating the minimum value. 
1135+@returns {number} the minimum value of the dataset 
1136+@constructor
1137+```
1138+
1139+### MINA 
1140+
1141+```
1142+  Returns the minimum numeric value in a dataset. 
1143+@param values - The value(s) or range(s) to consider when calculating the minimum value. 
1144+@returns {number} the minimum value in the dataset 
1145+@constructor
1146+```
1147+
1148+### AVERAGEIF 
1149+
1150+```
1151+  Returns the average of a range depending on criteria. 
1152+@param criteriaRange - The range to check against criterion. 
1153+@param criterion - The pattern or test to apply to criteria_range. 
1154+@param averageRange - [optional] The range to average. If not included, criteria_range is used for the average instead. 
1155+@returns {number} 
1156+@constructor TODO: This needs to also accept a third parameter "average_range"
1157+```
1158+
1159+### COUNT 
1160+
1161+```
1162+  Returns the a count of the number of numeric values in a dataset. 
1163+@param values - The values or ranges to consider when counting. 
1164+@returns {number} number of numeric values in a dataset. 
1165+@constructor
1166+```
1167+
1168+### COUNTA 
1169+
1170+```
1171+  Returns the a count of the number of values in a dataset. 
1172+@param values - The values or ranges to consider when counting. 
1173+@returns {number} number of values in a dataset. 
1174+@constructor
1175+```
1176+## Text
1177+
1178+
1179+### ARABIC 
1180+
1181+```
1182+  Computes the value of a Roman numeral. 
1183+@param text - The Roman numeral to format, whose value must be between 1 and 3999, inclusive. 
1184+@returns {number} value in integer format 
1185+@constructor
1186+```
1187+
1188+### CHAR 
1189+
1190+```
1191+  Convert a number into a character according to the current Unicode table. 
1192+@param value - The number of the character to look up from the current Unicode table in decimal format. 
1193+@returns {string} character corresponding to Unicode number 
1194+@constructor
1195+```
1196+
1197+### CODE 
1198+
1199+```
1200+  Returns the numeric Unicode map value of the first character in the string provided. 
1201+@param value - The string whose first character's Unicode map value will be returned. 
1202+@returns {number} number of the first character's Unicode value 
1203+@constructor
1204+```
1205+
1206+### SPLIT 
1207+
1208+```
1209+  Divides text around a specified character or string, and puts each fragment into a separate cell in the row. 
1210+@param text - The text to divide. 
1211+@param delimiter - The character or characters to use to split text. 
1212+@param splitByEach - [optional] Whether or not to divide text around each character contained in delimiter. 
1213+@returns {Array<string>} containing the split 
1214+@constructor TODO: At some point this needs to return a more complex type than Array. Needs to return a type that has a dimension.
1215+```
1216+
1217+### NCATENATE 
1218+
1219+```
1220+  Appends strings to one another. 
1221+@param values - to append to one another. Must contain at least one value 
1222+@returns {string} concatenated string 
1223+@constructor
1224+```
1225+
1226+### CONVERT 
1227+
1228+```
1229+  Converts a numeric value to a different unit of measure. 
1230+@param value - the numeric value in start_unit to convert to end_unit. 
1231+@param startUnit - The starting unit, the unit currently assigned to value. 
1232+@param endUnit - The unit of measure into which to convert value. 
1233+@returns {number} 
1234+@constructor TODO: Looking up units is not efficient at all. We should use an object instead of iterating through an array.
1235+```
1236diff --git a/README.md b/README.md
1237index 10022a8..a798beb 100644
1238--- a/README.md
1239+++ b/README.md
1240@@ -21,7 +21,7 @@ In MS Excel, and Google Spreadsheets, literal ranges are denoted with opening an
1241 
1242 
1243 ## Docs
1244-[Docs here](DOCUMENTATION.md)
1245+[Docs here](DOCS.md)
1246 
1247 
1248 ## Contributing
1249@@ -33,6 +33,9 @@ If you're adding a new formula, before you submit a pull request or push ensure
1250 1) The formula is tested inside the proper category file in `tests/Formulas`.
1251 2) The formula tests for reference errors, N/A errors, value errors for each input.
1252 3) That the formula is tested for parsing inside `SheetFormulaTest.ts`.
1253+4) Run tests with `npm run test`.
1254+5) Build with `npm run build`.
1255+6) Build DOCS.md with `npm run docs`.
1256 
1257 
1258 ### Why?
1259diff --git a/TODO.md b/TODO.md
1260index 5d908b4..54e290d 100644
1261--- a/TODO.md
1262+++ b/TODO.md
1263@@ -3,15 +3,12 @@ Things I should do.
1264 
1265 
1266 ### Cells should have `formatAs` fields.
1267-Instead of having non-primitives, (i.e. Date, DateTime, Time, Dollar), cells should have formats based on the highest-order type that was used during the compilation and execution of a cell's dependency. For example, `DATE` might return a number, but the cell that called `DATE` would be aware of it calling a formula that returns an non-primitive type, and would display the returned number as a Date. If you're using `DATE` in conjunction with `DOLLAR` it would still display the returned value as a Date. The heirarhchy would look like: [Date, DateTime, Time, Dollar, number, boolean, string]. Advantages to this would include not having to cast down when using primitive operators, and flexibility in display. It would also simplify the types themselves, by having types be constants and just having helpers to convert, display, and do normal operations with them.
1268+Instead of having non-primitives, (i.e. Date, DateTime, Time, Dollar), cells should have formats based on the highest-order type that was used during the compilation and execution of a cell's dependency. For example, `DATE` might return a number, but the cell that called `DATE` would be aware of it calling a formula that returns an non-primitive type, and would display the returned number as a Date. If you're using `DATE` in conjunction with `DOLLAR` it would still display the returned value as a Date. The hierarchy would look like: [Date, DateTime, Time, Dollar, number, boolean, string]. Advantages to this would include not having to cast down when using primitive operators, and flexibility in display. It would also simplify the types themselves, by having types be constants and just having helpers to convert, display, and do normal operations with them.
1269 
1270 
1271 ### Implement TO_DATE, TO_NUMBER, TO_DOLLARS, TO_TEXT
1272 Contingent upon cells having formats or types for primitives.
1273 
1274 
1275-### Scrape jsdocs for functions, put in simple index.html, doc.md files to serve up simple documentation
1276-
1277-
1278 ### CONVERT could offer more accurate conversions for units in the same system
1279 For example 64 tbs to a qt.
1280diff --git a/docs.sh b/docs.sh
1281new file mode 100755
1282index 0000000..5423868
1283--- /dev/null
1284+++ b/docs.sh
1285@@ -0,0 +1,92 @@
1286+#!/bin/bash
1287+
1288+# Documentation generation script. Accepts directory as input, and uses bash tools to pull doc strings and generate a
1289+# markdown file. Resulting file is a little rough, but I prefer this to using a large build system.
1290+#
1291+# Usage: ./doc.sh src/Formulas
1292+
1293+SRC_DIRECTORY=$1
1294+CURRENT_BLOCK=""
1295+BLOCK_MARKER="\`\`\`"
1296+CAPTURE_NEXT_FUNCTION_NAME=""
1297+FINALIZED_BLOCK=""
1298+DOCUMENTATION_FILE=DOCS.md
1299+
1300+function start_block() {
1301+  LINE="$1"
1302+  CURRENT_BLOCK=""
1303+  add_to_block "$LINE"
1304+}
1305+
1306+
1307+function add_to_block() {
1308+  LINE="$1"
1309+  LINE=$(echo "$LINE" | sed 's/\*\**//g' | sed 's/\s*\/\s*//g' | sed "s/^[ \s]*//")
1310+  CURRENT_BLOCK="${CURRENT_BLOCK}\n""$LINE"
1311+}
1312+
1313+
1314+function process_line() {
1315+  LINE=$1
1316+  if [[ $LINE =~ \s*\/\*\*$ ]]
1317+  then
1318+    # If this line matches the opening of a doc comment, start block
1319+    start_block "$LINE"
1320+  elif [[ $LINE =~ \s*\*\/$ ]]
1321+  then
1322+    # If this line matches the end of a doc comment, end block
1323+    add_to_block "$LINE"
1324+    CAPTURE_NEXT_FUNCTION_NAME="TRUE"
1325+  elif [[ $LINE =~ \s*\*.*$ ]]
1326+  then
1327+    # If this line starts with a *, and ends with anything, it's inside a comment.
1328+    add_to_block "$LINE"
1329+  else
1330+    if [[ -n "$CAPTURE_NEXT_FUNCTION_NAME" ]]
1331+    then
1332+      CAPTURE_NEXT_FUNCTION_NAME=""
1333+
1334+      # Take the current block, strip line endings where necessary.
1335+      CURRENT_BLOCK=$(printf "$CURRENT_BLOCK" | paste -sd " " - | sed -e $'s/@/\\\n@/g')
1336+
1337+      # Grab the function name
1338+      FUNCTION_NAME=$(echo "$LINE" | grep -oE '[A-Z0-9]{1,9}\s')
1339+
1340+      # Build the finalized block
1341+      FINALIZED_BLOCK="\n### ${FUNCTION_NAME}\n${FINALIZED_BLOCK}"
1342+      FINALIZED_BLOCK=$FINALIZED_BLOCK$(printf "\n$BLOCK_MARKER\n$CURRENT_BLOCK\n$BLOCK_MARKER")
1343+
1344+      # Write block
1345+      echo "Writing formula documentation for: $FUNCTION_NAME"
1346+      printf "$FINALIZED_BLOCK\n" >> $DOCUMENTATION_FILE
1347+      FINALIZED_BLOCK=""
1348+    fi
1349+  fi
1350+}
1351+
1352+
1353+function parse_file() {
1354+  echo "Writing documentation for file: $FILE"
1355+  FILE=$1
1356+
1357+  # Write the file name to the documentation file
1358+  FILE_TITLE=$(basename $FILE .ts)
1359+  printf "## $FILE_TITLE\n\n" >> $DOCUMENTATION_FILE
1360+
1361+  # Loop through every line in file.
1362+  while IFS= read -r p; do
1363+    process_line "$p"
1364+  done < "$FILE"
1365+}
1366+
1367+
1368+
1369+# Write the header of the documentation
1370+printf "# Documentation\n\n" > $DOCUMENTATION_FILE
1371+
1372+for f in $(ls $SRC_DIRECTORY/*ts)
1373+do
1374+	parse_file "$f"
1375+done
1376+
1377+
1378diff --git a/package.json b/package.json
1379index 7b931af..04691c2 100644
1380--- a/package.json
1381+++ b/package.json
1382@@ -5,6 +5,7 @@
1383   "scripts": {
1384     "clean": "rm -rf output/* && rm -rf test_output/*",
1385     "build": "tsc && cp lib/parser.js output/",
1386+    "docs": "./docs.sh src/Formulas",
1387     "test": "./tests.sh",
1388     "test:quiet": "./tests.sh | grep -v Test:"
1389   },
1390diff --git a/src/Formulas/Date.ts b/src/Formulas/Date.ts
1391index f495474..687ffa8 100644
1392--- a/src/Formulas/Date.ts
1393+++ b/src/Formulas/Date.ts
1394@@ -254,23 +254,6 @@ var WEEKDAY = function (date, offsetType?) : number {
1395 };
1396 
1397 
1398-/**
1399- * Given a moment, an array of days of the week for shifting, will calculate the week number.
1400- * @param dm moment to iterate towards
1401- * @param shifterArray array of numbers for mapping week days to shifted weekdays
1402- * @returns {number} of weeks in year
1403- */
1404-function calculateWeekNum(dm : moment.Moment, shifterArray : Array<number>) : number {
1405-  var startOfYear = moment.utc(dm).startOf("year");
1406-  var weeksCount = 1;
1407-  var d = moment.utc(dm).startOf("year").add(6 - shifterArray[startOfYear.day()], "days");
1408-  while (d.isBefore(dm)) {
1409-    d.add(7, "days");
1410-    weeksCount++;
1411-  }
1412-  return weeksCount;
1413-}
1414-
1415 /**
1416  * Returns a number representing the week of the year where the provided date falls. When inputting the date, it is best
1417  * to use the DATE function, as text values may return errors.
1418@@ -288,6 +271,18 @@ function calculateWeekNum(dm : moment.Moment, shifterArray : Array<number>) : nu
1419  * @constructor
1420  */
1421 var WEEKNUM = function (date, shiftType?) : number {
1422+  // Given a moment, an array of days of the week for shifting, will calculate the week number.
1423+  function calculateWeekNum(dm : moment.Moment, shifterArray : Array<number>) : number {
1424+    var startOfYear = moment.utc(dm).startOf("year");
1425+    var weeksCount = 1;
1426+    var d = moment.utc(dm).startOf("year").add(6 - shifterArray[startOfYear.day()], "days");
1427+    while (d.isBefore(dm)) {
1428+      d.add(7, "days");
1429+      weeksCount++;
1430+    }
1431+    return weeksCount;
1432+  }
1433+
1434   ArgsChecker.checkLengthWithin(arguments, 1, 2, "WEEKNUM");
1435   date = TypeConverter.firstValueAsDateNumber(date, true); // tell firstValueAsDateNumber to coerce boolean
1436   shiftType = shiftType ? TypeConverter.firstValueAsNumber(shiftType) : 1;
1437diff --git a/src/Formulas/Financial.ts b/src/Formulas/Financial.ts
1438index 9ec430e..7fa8031 100644
1439--- a/src/Formulas/Financial.ts
1440+++ b/src/Formulas/Financial.ts
1441@@ -378,16 +378,7 @@ var CUMIPMT = function (rate, numberOfPeriods, presentValue, firstPeriod, lastPe
1442  * Calculates the accrued interest of a security that has periodic payments.
1443  * WARNING: This function has been implemented to specifications as outlined in Google Spreadsheets, LibreOffice, and
1444  * OpenOffice. It functions much the same as MSExcel's ACCRINT, but there are several key differences. Below are links
1445- * to illustrate the differences. Please see the source code for more information on differences.
1446- *
1447- * Links:
1448- * * https://quant.stackexchange.com/questions/7040/whats-the-algorithm-behind-excels-accrint
1449- *
1450- * * https://support.office.com/en-us/article/ACCRINT-function-fe45d089-6722-4fb3-9379-e1f911d8dc74
1451- *
1452- * * https://quant.stackexchange.com/questions/7040/whats-the-algorithm-behind-excels-accrint
1453- *
1454- * * https://support.google.com/docs/answer/3093200
1455+ * to illustrate the differences. Please see the source code for more information on differences. Links: https://quant.stackexchange.com/questions/7040/whats-the-algorithm-behind-excels-accrint, https://support.office.com/en-us/article/ACCRINT-function-fe45d089-6722-4fb3-9379-e1f911d8dc74, https://quant.stackexchange.com/questions/7040/whats-the-algorithm-behind-excels-accrint, https://support.google.com/docs/answer/3093200 .
1456  * @param issue - The date the security was initially issued.
1457  * @param firstPayment - The first date interest will be paid.
1458  * @param settlement - The settlement date of the security, the date after issuance when the security is
1459diff --git a/src/Formulas/Math.ts b/src/Formulas/Math.ts
1460index 190f868..9fe043f 100644
1461--- a/src/Formulas/Math.ts
1462+++ b/src/Formulas/Math.ts
1463@@ -20,6 +20,9 @@ import {
1464   ValueError,
1465   NAError
1466 } from "../Errors";
1467+import {
1468+  erf
1469+} from "../Utilities/MathHelpers";
1470 
1471 /**
1472  * Returns the absolute value of a number.
1473@@ -821,52 +824,6 @@ var ERF = function (lowerLimit, upperLimit?) : number {
1474 };
1475 
1476 
1477-/**
1478- * Returns the error function evaluated at x. See also:
1479- *
1480- * * http://jstat.github.io/special-functions.html#erf
1481- *
1482- * * https://github.com/jstat/jstat/search?utf8=%E2%9C%93&q=erf&type=
1483- *
1484- * @param x to evaluate
1485- * @returns {number} error
1486- */
1487-function erf(x) {
1488-  var cof = [-1.3026537197817094, 6.4196979235649026e-1, 1.9476473204185836e-2,
1489-    -9.561514786808631e-3, -9.46595344482036e-4, 3.66839497852761e-4,
1490-    4.2523324806907e-5, -2.0278578112534e-5, -1.624290004647e-6,
1491-    1.303655835580e-6, 1.5626441722e-8, -8.5238095915e-8,
1492-    6.529054439e-9, 5.059343495e-9, -9.91364156e-10,
1493-    -2.27365122e-10, 9.6467911e-11, 2.394038e-12,
1494-    -6.886027e-12, 8.94487e-13, 3.13092e-13,
1495-    -1.12708e-13, 3.81e-16, 7.106e-15,
1496-    -1.523e-15, -9.4e-17, 1.21e-16,
1497-    -2.8e-17];
1498-  var j = cof.length - 1;
1499-  var isneg = false;
1500-  var d = 0;
1501-  var dd = 0;
1502-  var t, ty, tmp, res;
1503-
1504-  if (x < 0) {
1505-    x = -x;
1506-    isneg = true;
1507-  }
1508-
1509-  t = 2 / (2 + x);
1510-  ty = 4 * t - 2;
1511-
1512-  for(; j > 0; j--) {
1513-    tmp = d;
1514-    d = ty * d - dd + cof[j];
1515-    dd = tmp;
1516-  }
1517-
1518-  res = t * Math.exp(-x * x + 0.5 * (cof[0] + ty * d) - dd);
1519-  return isneg ? res - 1 : 1 - res;
1520-}
1521-
1522-
1523 /**
1524  * Calculates the sum of the sums of the squares of values in two arrays.
1525  * @param arrayX - The array or range of values whose squares will be added to the squares of corresponding
1526diff --git a/src/Utilities/MathHelpers.ts b/src/Utilities/MathHelpers.ts
1527index 53c440a..44d4689 100644
1528--- a/src/Utilities/MathHelpers.ts
1529+++ b/src/Utilities/MathHelpers.ts
1530@@ -290,6 +290,51 @@ function cdf(x, df1, df2) {
1531   return ibeta((df1 * x) / (df1 * x + df2), df1 / 2, df2 / 2);
1532 }
1533 
1534+/**
1535+ * Returns the error function evaluated at x. See also:
1536+ *
1537+ * * http://jstat.github.io/special-functions.html#erf
1538+ *
1539+ * * https://github.com/jstat/jstat/search?utf8=%E2%9C%93&q=erf&type=
1540+ *
1541+ * @param x to evaluate
1542+ * @returns {number} error
1543+ */
1544+function erf(x) {
1545+  var cof = [-1.3026537197817094, 6.4196979235649026e-1, 1.9476473204185836e-2,
1546+    -9.561514786808631e-3, -9.46595344482036e-4, 3.66839497852761e-4,
1547+    4.2523324806907e-5, -2.0278578112534e-5, -1.624290004647e-6,
1548+    1.303655835580e-6, 1.5626441722e-8, -8.5238095915e-8,
1549+    6.529054439e-9, 5.059343495e-9, -9.91364156e-10,
1550+    -2.27365122e-10, 9.6467911e-11, 2.394038e-12,
1551+    -6.886027e-12, 8.94487e-13, 3.13092e-13,
1552+    -1.12708e-13, 3.81e-16, 7.106e-15,
1553+    -1.523e-15, -9.4e-17, 1.21e-16,
1554+    -2.8e-17];
1555+  var j = cof.length - 1;
1556+  var isneg = false;
1557+  var d = 0;
1558+  var dd = 0;
1559+  var t, ty, tmp, res;
1560+
1561+  if (x < 0) {
1562+    x = -x;
1563+    isneg = true;
1564+  }
1565+
1566+  t = 2 / (2 + x);
1567+  ty = 4 * t - 2;
1568+
1569+  for(; j > 0; j--) {
1570+    tmp = d;
1571+    d = ty * d - dd + cof[j];
1572+    dd = tmp;
1573+  }
1574+
1575+  res = t * Math.exp(-x * x + 0.5 * (cof[0] + ty * d) - dd);
1576+  return isneg ? res - 1 : 1 - res;
1577+}
1578+
1579 /**
1580  * Returns the value of x in the pdf of the Gamma distribution with the parameters shape (k) and scale (theta). Notice
1581  * that if using the alpha beta convention, scale = 1/beta. For more information see
1582@@ -322,6 +367,7 @@ export {
1583   betaln,
1584   cdf,
1585   covariance,
1586+  erf,
1587   gammafn,
1588   gammaln,
1589   ibeta,