This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
function COMPLEX(real, imaginary, suffix) { | |
// Return error if either number is a non-numeric value | |
if (isNaN(real) || isNaN(imaginary)) return '#VALUE!'; | |
// Set suffix | |
var suffix = (typeof suffix === 'undefined') ? 'i' : suffix; | |
// Return error if suffix is neither "i" nor "j" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
function CONVERT(number, from_unit, to_unit) { | |
// Return error if number is a non-numeric value | |
if (isNaN(number)) return '#VALUE!'; | |
// List of units supported by CONVERT and units defined by the International System of Units | |
// [Name, Symbol, Alternate symbols, Quantity, International System of Units, Supported by CONVERT, Conversion ratio] | |
var units = [ | |
["a.u. of action","ħ",null,"action",false,false,1.05457168181818e-34], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
function DEC2BIN(number, places) { | |
// Return error if number is not a number | |
if (isNaN(number)) return '#VALUE!'; | |
// Return error if number is not decimal, is lower than -512, or is greater than 511 | |
if (!/^-?[0-9]{1,3}$/.test(number) || number < -512 || number > 511) return '#NUM!'; | |
// Ignore places and return a 10-character binary number if number is negative |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
function DEC2OCT(number, places) { | |
// Return error if number is not a number | |
if (isNaN(number)) return '#VALUE!'; | |
// Return error if number is not decimal, is lower than -549755813888, or is greater than 549755813887 | |
if (!/^-?[0-9]{1,9}$/.test(number) || number < -536870912 || number > 536870911) return '#NUM!'; | |
// Ignore places and return a 10-character octal number if number is negative |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
function DELTA(number1, number2) { | |
// Set number2 to zero if undefined | |
number2 = (typeof number2 === 'undefined') ? 0 : number2; | |
// Return error if either number is not a number | |
if (isNaN(number1) || isNaN(number2)) return '#VALUE!'; | |
// Return delta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
function ERFC(x) { | |
// Return error if x is not a number | |
if (isNaN(x)) return '#VALUE!'; | |
// Return ERFC using jStat [http://www.jstat.org/] | |
return jStat.erfc(x); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
function ERF(lower_bound, upper_bound) { | |
// Set number2 to zero if undefined | |
upper_bound = (typeof upper_bound === 'undefined') ? 0 : upper_bound; | |
// Return error if either number is not a number | |
if (isNaN(lower_bound) || isNaN(upper_bound)) return '#VALUE!'; | |
// Return ERFC using jStat [http://www.jstat.org/] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
function GESTEP(number, step) { | |
// Set step to zero if undefined | |
step = (typeof step === 'undefined') ? 0 : step; | |
// Return error if either number is not a number | |
if (isNaN(number) || isNaN(step)) return '#VALUE!'; | |
// Return delta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
function HEX2BIN(number, places) { | |
// Return error if number is not hexadecimal or contains more than ten characters (10 digits) | |
if (!/^[0-9A-Fa-f]{1,10}$/.test(number)) return '#NUM!'; | |
// Check if number is negative | |
var negative = (number.length === 10 && number.substring(0, 1).toLowerCase() === 'f') ? true : false; | |
// Convert hexadecimal number to decimal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
function HEX2DEC(number) { | |
// Return error if number is not hexadecimal or contains more than ten characters (10 digits) | |
if (!/^[0-9A-Fa-f]{1,10}$/.test(number)) return '#NUM!'; | |
// Convert hexadecimal number to decimal | |
var decimal = parseInt(number, 16); | |
// Return decimal number |