i;)o=l,l=r.add(r.multiply(f,o),s),c+=1;return l},SOR:function(n,t,u,i,a){for(var o,s,f,l,c,m=0,p=n.length,h=[],g=[],v=[];mo?(h[m][o]=n[m][o],g[m][o]=v[m][o]=0):mi;)s=c,c=r.add(r.multiply(l,s),f),m++;return c},householder:function(n){for(var t,u,i,a,o,s=n.length,f=n[0].length,l=0,c=[],m=[];l0?-1:1,t=o*e.sqrt(t),u=e.sqrt((t*t-n[l+1][l]*t)/2),c=r.zeros(s,1),c[l+1][0]=(n[l+1][l]-t)/(2*u),i=l+2;i0?-1:1,i=s*e.sqrt(i),a=e.sqrt((i*i-n[m+1][m]*i)/2),p=r.zeros(l,1),p[m+1][0]=(n[m+1][m]-i)/(2*a),o=m+2;o=0;m--){for(f=0,u=m+1;u<=c-1;u++)f=g[u]*n[m][u];g[m]=t[m][0]/n[m][m]}return g},jacobi:function(n){for(var t,u,i,a,o,s,f,l,c=1,m=0,p=n.length,h=r.identity(p,p),g=[];1===c;){for(m++,s=n[0][1],a=0,o=1,u=0;u0?e.PI/4:-e.PI/4:e.atan(2*n[a][o]/(n[a][a]-n[o][o]))/2,l=r.identity(p,p),l[a][a]=e.cos(f),l[a][o]=-e.sin(f),l[o][a]=e.sin(f),l[o][o]=e.cos(f),h=r.multiply(h,l),t=r.multiply(r.multiply(r.inv(l),n),l),n=t,c=0,u=1;u
.001&&(c=1)}for(u=0;u
=c;)a=i(r,t+u),o=i(r,t),p[m]=(n[a]-2*n[o]+n[2*o-a])/(u*u),u/=2,m++;for(f=p.length,s=1;1!=f;){for(l=0;lt);u++);return u-=1,n[u]+(t-e[u])*m[u]+r.sq(t-e[u])*l[u]+(t-e[u])*r.sq(t-e[u])*p[u]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var n,t,u=e.length,i=e[0].length,a=0,o=[],s=[],f=[],l=[],c=[],m=[],p=[],h=[],g=[],v=[];for(a=0;a=0||"number"==typeof r&&(isNaN(r)||!isFinite(r))},e.ISERROR=function(r){return e.ISERR(r)||r===t.na},e.ISEVEN=function(r){return!(1&Math.floor(Math.abs(r)))},e.ISFORMULA=function(){throw new Error("ISFORMULA is not implemented")},e.ISLOGICAL=function(r){return r===!0||r===!1},e.ISNA=function(r){return r===t.na},e.ISNONTEXT=function(r){return"string"!=typeof r},e.ISNUMBER=function(r){return"number"==typeof r&&!isNaN(r)&&isFinite(r)},e.ISODD=function(r){return!!(1&Math.floor(Math.abs(r)))},e.ISREF=function(){throw new Error("ISREF is not implemented")},e.ISTEXT=function(r){return"string"==typeof r},e.N=function(r){return this.ISNUMBER(r)?r:r instanceof Date?r.getTime():r===!0?1:r===!1?0:this.ISERROR(r)?r:0},e.NA=function(){return t.na},e.SHEET=function(){throw new Error("SHEET is not implemented")},e.SHEETS=function(){throw new Error("SHEETS is not implemented")},e.TYPE=function(r){return this.ISNUMBER(r)?1:this.ISTEXT(r)?2:this.ISLOGICAL(r)?4:this.ISERROR(r)?16:Array.isArray(r)?64:void 0}},function(r,e,n){function t(r){return/^[01]{1,10}$/.test(r)}var u=n(5),i=n(9).jStat,a=n(7),o=n(4),s=n(13);e.BESSELI=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:s.besseli(r,e)},e.BESSELJ=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:s.besselj(r,e)},e.BESSELK=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:s.besselk(r,e)},e.BESSELY=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:s.bessely(r,e)},e.BIN2DEC=function(r){if(!t(r))return u.num;var e=parseInt(r,2),n=r.toString();return 10===n.length&&"1"===n.substring(0,1)?parseInt(n.substring(1),2)-512:e},e.BIN2HEX=function(r,e){if(!t(r))return u.num;var n=r.toString();if(10===n.length&&"1"===n.substring(0,1))return(0xfffffffe00+parseInt(n.substring(1),2)).toString(16);var i=parseInt(r,2).toString(16);return void 0===e?i:isNaN(e)?u.value:e<0?u.num:(e=Math.floor(e),e>=i.length?a.REPT("0",e-i.length)+i:u.num)},e.BIN2OCT=function(r,e){if(!t(r))return u.num;var n=r.toString();if(10===n.length&&"1"===n.substring(0,1))return(1073741312+parseInt(n.substring(1),2)).toString(8);var i=parseInt(r,2).toString(8);return void 0===e?i:isNaN(e)?u.value:e<0?u.num:(e=Math.floor(e),e>=i.length?a.REPT("0",e-i.length)+i:u.num)},e.BITAND=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:r<0||e<0?u.num:Math.floor(r)!==r||Math.floor(e)!==e?u.num:r>0xffffffffffff||e>0xffffffffffff?u.num:r&e},e.BITLSHIFT=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:r<0?u.num:Math.floor(r)!==r?u.num:r>0xffffffffffff?u.num:Math.abs(e)>53?u.num:e>=0?r<>-e},e.BITOR=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:r<0||e<0?u.num:Math.floor(r)!==r||Math.floor(e)!==e?u.num:r>0xffffffffffff||e>0xffffffffffff?u.num:r|e},e.BITRSHIFT=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:r<0?u.num:Math.floor(r)!==r?u.num:r>0xffffffffffff?u.num:Math.abs(e)>53?u.num:e>=0?r>>e:r<<-e},e.BITXOR=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:r<0||e<0?u.num:Math.floor(r)!==r||Math.floor(e)!==e?u.num:r>0xffffffffffff||e>0xffffffffffff?u.num:r^e},e.COMPLEX=function(r,e,n){if(r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e))return r;if(n=void 0===n?"i":n,"i"!==n&&"j"!==n)return u.value;if(0===r&&0===e)return 0;if(0===r)return 1===e?n:e.toString()+n;if(0===e)return r.toString();var t=e>0?"+":"";return r.toString()+t+(1===e?n:e.toString()+n)},e.CONVERT=function(r,e,n){if(r=o.parseNumber(r),r instanceof Error)return r;for(var t,i=[["a.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["a.u. of charge","e",null,"electric_charge",!1,!1,1.60217653141414e-19],["a.u. of energy","Eh",null,"energy",!1,!1,4.35974417757576e-18],["a.u. of length","a?",null,"length",!1,!1,5.29177210818182e-11],["a.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["a.u. of time","?/Eh",null,"time",!1,!1,2.41888432650516e-17],["admiralty knot","admkn",null,"speed",!1,!0,.514773333],["ampere","A",null,"electric_current",!0,!1,1],["ampere per meter","A/m",null,"magnetic_field_intensity",!0,!1,1],["ångström","Å",["ang"],"length",!1,!0,1e-10],["are","ar",null,"area",!1,!0,100],["astronomical unit","ua",null,"length",!1,!1,1.49597870691667e-11],["bar","bar",null,"pressure",!1,!1,1e5],["barn","b",null,"area",!1,!1,1e-28],["becquerel","Bq",null,"radioactivity",!0,!1,1],["bit","bit",["b"],"information",!1,!0,1],["btu","BTU",["btu"],"energy",!1,!0,1055.05585262],["byte","byte",null,"information",!1,!0,8],["candela","cd",null,"luminous_intensity",!0,!1,1],["candela per square metre","cd/m?",null,"luminance",!0,!1,1],["coulomb","C",null,"electric_charge",!0,!1,1],["cubic ångström","ang3",["ang^3"],"volume",!1,!0,1e-30],["cubic foot","ft3",["ft^3"],"volume",!1,!0,.028316846592],["cubic inch","in3",["in^3"],"volume",!1,!0,16387064e-12],["cubic light-year","ly3",["ly^3"],"volume",!1,!0,8.46786664623715e-47],["cubic metre","m?",null,"volume",!0,!0,1],["cubic mile","mi3",["mi^3"],"volume",!1,!0,4168181825.44058],["cubic nautical mile","Nmi3",["Nmi^3"],"volume",!1,!0,6352182208],["cubic Pica","Pica3",["Picapt3","Pica^3","Picapt^3"],"volume",!1,!0,7.58660370370369e-8],["cubic yard","yd3",["yd^3"],"volume",!1,!0,.764554857984],["cup","cup",null,"volume",!1,!0,.0002365882365],["dalton","Da",["u"],"mass",!1,!1,1.66053886282828e-27],["day","d",["day"],"time",!1,!0,86400],["degree","°",null,"angle",!1,!1,.0174532925199433],["degrees Rankine","Rank",null,"temperature",!1,!0,.555555555555556],["dyne","dyn",["dy"],"force",!1,!0,1e-5],["electronvolt","eV",["ev"],"energy",!1,!0,1.60217656514141],["ell","ell",null,"length",!1,!0,1.143],["erg","erg",["e"],"energy",!1,!0,1e-7],["farad","F",null,"electric_capacitance",!0,!1,1],["fluid ounce","oz",null,"volume",!1,!0,295735295625e-16],["foot","ft",null,"length",!1,!0,.3048],["foot-pound","flb",null,"energy",!1,!0,1.3558179483314],["gal","Gal",null,"acceleration",!1,!1,.01],["gallon","gal",null,"volume",!1,!0,.003785411784],["gauss","G",["ga"],"magnetic_flux_density",!1,!0,1],["grain","grain",null,"mass",!1,!0,647989e-10],["gram","g",null,"mass",!1,!0,.001],["gray","Gy",null,"absorbed_dose",!0,!1,1],["gross registered ton","GRT",["regton"],"volume",!1,!0,2.8316846592],["hectare","ha",null,"area",!1,!0,1e4],["henry","H",null,"inductance",!0,!1,1],["hertz","Hz",null,"frequency",!0,!1,1],["horsepower","HP",["h"],"power",!1,!0,745.69987158227],["horsepower-hour","HPh",["hh","hph"],"energy",!1,!0,2684519.538],["hour","h",["hr"],"time",!1,!0,3600],["imperial gallon (U.K.)","uk_gal",null,"volume",!1,!0,.00454609],["imperial hundredweight","lcwt",["uk_cwt","hweight"],"mass",!1,!0,50.802345],["imperial quart (U.K)","uk_qt",null,"volume",!1,!0,.0011365225],["imperial ton","brton",["uk_ton","LTON"],"mass",!1,!0,1016.046909],["inch","in",null,"length",!1,!0,.0254],["international acre","uk_acre",null,"area",!1,!0,4046.8564224],["IT calorie","cal",null,"energy",!1,!0,4.1868],["joule","J",null,"energy",!0,!0,1],["katal","kat",null,"catalytic_activity",!0,!1,1],["kelvin","K",["kel"],"temperature",!0,!0,1],["kilogram","kg",null,"mass",!0,!0,1],["knot","kn",null,"speed",!1,!0,.514444444444444],["light-year","ly",null,"length",!1,!0,9460730472580800],["litre","L",["l","lt"],"volume",!1,!0,.001],["lumen","lm",null,"luminous_flux",!0,!1,1],["lux","lx",null,"illuminance",!0,!1,1],["maxwell","Mx",null,"magnetic_flux",!1,!1,1e-18],["measurement ton","MTON",null,"volume",!1,!0,1.13267386368],["meter per hour","m/h",["m/hr"],"speed",!1,!0,.00027777777777778],["meter per second","m/s",["m/sec"],"speed",!0,!0,1],["meter per second squared","m?s??",null,"acceleration",!0,!1,1],["parsec","pc",["parsec"],"length",!1,!0,0x6da012f958ee1c],["meter squared per second","m?/s",null,"kinematic_viscosity",!0,!1,1],["metre","m",null,"length",!0,!0,1],["miles per hour","mph",null,"speed",!1,!0,.44704],["millimetre of mercury","mmHg",null,"pressure",!1,!1,133.322],["minute","?",null,"angle",!1,!1,.000290888208665722],["minute","min",["mn"],"time",!1,!0,60],["modern teaspoon","tspm",null,"volume",!1,!0,5e-6],["mole","mol",null,"amount_of_substance",!0,!1,1],["morgen","Morgen",null,"area",!1,!0,2500],["n.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["n.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["n.u. of speed","c?",null,"speed",!1,!1,299792458],["n.u. of time","?/(me?c??)",null,"time",!1,!1,1.28808866778687e-21],["nautical mile","M",["Nmi"],"length",!1,!0,1852],["newton","N",null,"force",!0,!0,1],["œrsted","Oe ",null,"magnetic_field_intensity",!1,!1,79.5774715459477],["ohm","Ω",null,"electric_resistance",!0,!1,1],["ounce mass","ozm",null,"mass",!1,!0,.028349523125],["pascal","Pa",null,"pressure",!0,!1,1],["pascal second","Pa?s",null,"dynamic_viscosity",!0,!1,1],["pferdestärke","PS",null,"power",!1,!0,735.49875],["phot","ph",null,"illuminance",!1,!1,1e-4],["pica (1/6 inch)","pica",null,"length",!1,!0,.00035277777777778],["pica (1/72 inch)","Pica",["Picapt"],"length",!1,!0,.00423333333333333],["poise","P",null,"dynamic_viscosity",!1,!1,.1],["pond","pond",null,"force",!1,!0,.00980665],["pound force","lbf",null,"force",!1,!0,4.4482216152605],["pound mass","lbm",null,"mass",!1,!0,.45359237],["quart","qt",null,"volume",!1,!0,.000946352946],["radian","rad",null,"angle",!0,!1,1],["second","?",null,"angle",!1,!1,484813681109536e-20],["second","s",["sec"],"time",!0,!0,1],["short hundredweight","cwt",["shweight"],"mass",!1,!0,45.359237],["siemens","S",null,"electrical_conductance",!0,!1,1],["sievert","Sv",null,"equivalent_dose",!0,!1,1],["slug","sg",null,"mass",!1,!0,14.59390294],["square ångström","ang2",["ang^2"],"area",!1,!0,1e-20],["square foot","ft2",["ft^2"],"area",!1,!0,.09290304],["square inch","in2",["in^2"],"area",!1,!0,64516e-8],["square light-year","ly2",["ly^2"],"area",!1,!0,8.95054210748189e31],["square meter","m?",null,"area",!0,!0,1],["square mile","mi2",["mi^2"],"area",!1,!0,2589988.110336],["square nautical mile","Nmi2",["Nmi^2"],"area",!1,!0,3429904],["square Pica","Pica2",["Picapt2","Pica^2","Picapt^2"],"area",!1,!0,1792111111111e-17],["square yard","yd2",["yd^2"],"area",!1,!0,.83612736],["statute mile","mi",null,"length",!1,!0,1609.344],["steradian","sr",null,"solid_angle",!0,!1,1],["stilb","sb",null,"luminance",!1,!1,1e-4],["stokes","St",null,"kinematic_viscosity",!1,!1,1e-4],["stone","stone",null,"mass",!1,!0,6.35029318],["tablespoon","tbs",null,"volume",!1,!0,147868e-10],["teaspoon","tsp",null,"volume",!1,!0,492892e-11],["tesla","T",null,"magnetic_flux_density",!0,!0,1],["thermodynamic calorie","c",null,"energy",!1,!0,4.184],["ton","ton",null,"mass",!1,!0,907.18474],["tonne","t",null,"mass",!1,!1,1e3],["U.K. pint","uk_pt",null,"volume",!1,!0,.00056826125],["U.S. bushel","bushel",null,"volume",!1,!0,.03523907],["U.S. oil barrel","barrel",null,"volume",!1,!0,.158987295],["U.S. pint","pt",["us_pt"],"volume",!1,!0,.000473176473],["U.S. survey mile","survey_mi",null,"length",!1,!0,1609.347219],["U.S. survey/statute acre","us_acre",null,"area",!1,!0,4046.87261],["volt","V",null,"voltage",!0,!1,1],["watt","W",null,"power",!0,!0,1],["watt-hour","Wh",["wh"],"energy",!1,!0,3600],["weber","Wb",null,"magnetic_flux",!0,!1,1],["yard","yd",null,"length",!1,!0,.9144],["year","yr",null,"time",!1,!0,31557600]],a={Yi:["yobi",80,1.2089258196146292e24,"Yi","yotta"],Zi:["zebi",70,0x400000000000000000,"Zi","zetta"],Ei:["exbi",60,0x1000000000000000,"Ei","exa"],Pi:["pebi",50,0x4000000000000,"Pi","peta"],Ti:["tebi",40,1099511627776,"Ti","tera"],Gi:["gibi",30,1073741824,"Gi","giga"],Mi:["mebi",20,1048576,"Mi","mega"],ki:["kibi",10,1024,"ki","kilo"]},s={Y:["yotta",1e24,"Y"],Z:["zetta",1e21,"Z"],E:["exa",1e18,"E"],P:["peta",1e15,"P"],T:["tera",1e12,"T"],G:["giga",1e9,"G"],M:["mega",1e6,"M"],k:["kilo",1e3,"k"],h:["hecto",100,"h"],e:["dekao",10,"e"],d:["deci",.1,"d"],c:["centi",.01,"c"],m:["milli",.001,"m"],u:["micro",1e-6,"u"],n:["nano",1e-9,"n"],p:["pico",1e-12,"p"],f:["femto",1e-15,"f"],a:["atto",1e-18,"a"],z:["zepto",1e-21,"z"],y:["yocto",1e-24,"y"]},f=null,l=null,c=e,m=n,p=1,h=1,g=0;g=0)&&(f=i[g]),(i[g][1]===m||t.indexOf(m)>=0)&&(l=i[g]);if(null===f){var v=a[e.substring(0,2)],d=s[e.substring(0,1)];"da"===e.substring(0,2)&&(d=["dekao",10,"da"]),v?(p=v[2],c=e.substring(2)):d&&(p=d[1],c=e.substring(d[2].length));for(var y=0;y=0)&&(f=i[y])}if(null===l){var b=a[n.substring(0,2)],N=s[n.substring(0,1)];"da"===n.substring(0,2)&&(N=["dekao",10,"da"]),b?(h=b[2],m=n.substring(2)):N&&(h=N[1],m=n.substring(N[2].length));for(var E=0;E=0)&&(l=i[E])}return null===f||null===l?u.na:f[3]!==l[3]?u.na:r*f[6]*p/(l[6]*h)},e.DEC2BIN=function(r,e){if(r=o.parseNumber(r),r instanceof Error)return r;if(!/^-?[0-9]{1,3}$/.test(r)||r<-512||r>511)return u.num;if(r<0)return"1"+a.REPT("0",9-(512+r).toString(2).length)+(512+r).toString(2);var n=parseInt(r,10).toString(2);return"undefined"==typeof e?n:isNaN(e)?u.value:e<0?u.num:(e=Math.floor(e),e>=n.length?a.REPT("0",e-n.length)+n:u.num)},e.DEC2HEX=function(r,e){if(r=o.parseNumber(r),r instanceof Error)return r;if(!/^-?[0-9]{1,12}$/.test(r)||r<-549755813888||r>549755813887)return u.num;if(r<0)return(1099511627776+r).toString(16);var n=parseInt(r,10).toString(16);return"undefined"==typeof e?n:isNaN(e)?u.value:e<0?u.num:(e=Math.floor(e),e>=n.length?a.REPT("0",e-n.length)+n:u.num)},e.DEC2OCT=function(r,e){if(r=o.parseNumber(r),r instanceof Error)return r;if(!/^-?[0-9]{1,9}$/.test(r)||r<-536870912||r>536870911)return u.num;if(r<0)return(1073741824+r).toString(8);var n=parseInt(r,10).toString(8);return"undefined"==typeof e?n:isNaN(e)?u.value:e<0?u.num:(e=Math.floor(e),e>=n.length?a.REPT("0",e-n.length)+n:u.num)},e.DELTA=function(r,e){return e=void 0===e?0:e,r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:r===e?1:0},e.ERF=function(r,e){return e=void 0===e?0:e,r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:i.erf(r)},e.ERF.PRECISE=function(){throw new Error("ERF.PRECISE is not implemented")},e.ERFC=function(r){return isNaN(r)?u.value:i.erfc(r)},e.ERFC.PRECISE=function(){throw new Error("ERFC.PRECISE is not implemented")},e.GESTEP=function(r,e){return e=e||0,r=o.parseNumber(r),o.anyIsError(e,r)?r:r>=e?1:0},e.HEX2BIN=function(r,e){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return u.num;var n=10===r.length&&"f"===r.substring(0,1).toLowerCase(),t=n?parseInt(r,16)-1099511627776:parseInt(r,16);if(t<-512||t>511)return u.num;if(n)return"1"+a.REPT("0",9-(512+t).toString(2).length)+(512+t).toString(2);var i=t.toString(2);return void 0===e?i:isNaN(e)?u.value:e<0?u.num:(e=Math.floor(e),e>=i.length?a.REPT("0",e-i.length)+i:u.num)},e.HEX2DEC=function(r){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return u.num;var e=parseInt(r,16);return e>=549755813888?e-1099511627776:e},e.HEX2OCT=function(r,e){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return u.num;var n=parseInt(r,16);if(n>536870911&&n<0xffe0000000)return u.num;if(n>=0xffe0000000)return(n-0xffc0000000).toString(8);var t=n.toString(8);return void 0===e?t:isNaN(e)?u.value:e<0?u.num:(e=Math.floor(e),e>=t.length?a.REPT("0",e-t.length)+t:u.num)},e.IMABS=function(r){var n=e.IMREAL(r),t=e.IMAGINARY(r);return o.anyIsError(n,t)?u.value:Math.sqrt(Math.pow(n,2)+Math.pow(t,2))},e.IMAGINARY=function(r){if(void 0===r||r===!0||r===!1)return u.value;if(0===r||"0"===r)return 0;if(["i","j"].indexOf(r)>=0)return 1;r=r.replace("+i","+1i").replace("-i","-1i").replace("+j","+1j").replace("-j","-1j");var e=r.indexOf("+"),n=r.indexOf("-");0===e&&(e=r.indexOf("+",1)),0===n&&(n=r.indexOf("-",1));var t=r.substring(r.length-1,r.length),i="i"===t||"j"===t;return e>=0||n>=0?i?e>=0?isNaN(r.substring(0,e))||isNaN(r.substring(e+1,r.length-1))?u.num:Number(r.substring(e+1,r.length-1)):isNaN(r.substring(0,n))||isNaN(r.substring(n+1,r.length-1))?u.num:-Number(r.substring(n+1,r.length-1)):u.num:i?isNaN(r.substring(0,r.length-1))?u.num:r.substring(0,r.length-1):isNaN(r)?u.num:0},e.IMARGUMENT=function(r){var n=e.IMREAL(r),t=e.IMAGINARY(r);return o.anyIsError(n,t)?u.value:0===n&&0===t?u.div0:0===n&&t>0?Math.PI/2:0===n&&t<0?-Math.PI/2:0===t&&n>0?0:0===t&&n<0?-Math.PI:n>0?Math.atan(t/n):n<0&&t>=0?Math.atan(t/n)+Math.PI:Math.atan(t/n)-Math.PI},e.IMCONJUGATE=function(r){var n=e.IMREAL(r),t=e.IMAGINARY(r);if(o.anyIsError(n,t))return u.value;var i=r.substring(r.length-1);return i="i"===i||"j"===i?i:"i",0!==t?e.COMPLEX(n,-t,i):r},e.IMCOS=function(r){var n=e.IMREAL(r),t=e.IMAGINARY(r);if(o.anyIsError(n,t))return u.value;var i=r.substring(r.length-1);return i="i"===i||"j"===i?i:"i",e.COMPLEX(Math.cos(n)*(Math.exp(t)+Math.exp(-t))/2,-Math.sin(n)*(Math.exp(t)-Math.exp(-t))/2,i)},e.IMCOSH=function(r){var n=e.IMREAL(r),t=e.IMAGINARY(r);if(o.anyIsError(n,t))return u.value;var i=r.substring(r.length-1);return i="i"===i||"j"===i?i:"i",e.COMPLEX(Math.cos(t)*(Math.exp(n)+Math.exp(-n))/2,Math.sin(t)*(Math.exp(n)-Math.exp(-n))/2,i)},e.IMCOT=function(r){var n=e.IMREAL(r),t=e.IMAGINARY(r);return o.anyIsError(n,t)?u.value:e.IMDIV(e.IMCOS(r),e.IMSIN(r))},e.IMDIV=function(r,n){var t=e.IMREAL(r),i=e.IMAGINARY(r),a=e.IMREAL(n),s=e.IMAGINARY(n);if(o.anyIsError(t,i,a,s))return u.value;var f=r.substring(r.length-1),l=n.substring(n.length-1),c="i";if("j"===f?c="j":"j"===l&&(c="j"),0===a&&0===s)return u.num;var m=a*a+s*s;return e.COMPLEX((t*a+i*s)/m,(i*a-t*s)/m,c)},e.IMEXP=function(r){var n=e.IMREAL(r),t=e.IMAGINARY(r);if(o.anyIsError(n,t))return u.value;var i=r.substring(r.length-1);i="i"===i||"j"===i?i:"i";var a=Math.exp(n);return e.COMPLEX(a*Math.cos(t),a*Math.sin(t),i)},e.IMLN=function(r){var n=e.IMREAL(r),t=e.IMAGINARY(r);if(o.anyIsError(n,t))return u.value;var i=r.substring(r.length-1);return i="i"===i||"j"===i?i:"i",e.COMPLEX(Math.log(Math.sqrt(n*n+t*t)),Math.atan(t/n),i)},e.IMLOG10=function(r){var n=e.IMREAL(r),t=e.IMAGINARY(r);if(o.anyIsError(n,t))return u.value;var i=r.substring(r.length-1);return i="i"===i||"j"===i?i:"i",e.COMPLEX(Math.log(Math.sqrt(n*n+t*t))/Math.log(10),Math.atan(t/n)/Math.log(10),i)},e.IMLOG2=function(r){var n=e.IMREAL(r),t=e.IMAGINARY(r);if(o.anyIsError(n,t))return u.value;var i=r.substring(r.length-1);return i="i"===i||"j"===i?i:"i",e.COMPLEX(Math.log(Math.sqrt(n*n+t*t))/Math.log(2),Math.atan(t/n)/Math.log(2),i)},e.IMPOWER=function(r,n){n=o.parseNumber(n);var t=e.IMREAL(r),i=e.IMAGINARY(r);if(o.anyIsError(n,t,i))return u.value;var a=r.substring(r.length-1);a="i"===a||"j"===a?a:"i";var s=Math.pow(e.IMABS(r),n),f=e.IMARGUMENT(r);return e.COMPLEX(s*Math.cos(n*f),s*Math.sin(n*f),a)},e.IMPRODUCT=function(){for(var r=arguments[0],n=1;n=0)return 0;var e=r.indexOf("+"),n=r.indexOf("-");0===e&&(e=r.indexOf("+",1)),0===n&&(n=r.indexOf("-",1));var t=r.substring(r.length-1,r.length),i="i"===t||"j"===t;return e>=0||n>=0?i?e>=0?isNaN(r.substring(0,e))||isNaN(r.substring(e+1,r.length-1))?u.num:Number(r.substring(0,e)):isNaN(r.substring(0,n))||isNaN(r.substring(n+1,r.length-1))?u.num:Number(r.substring(0,n)):u.num:i?isNaN(r.substring(0,r.length-1))?u.num:0:isNaN(r)?u.num:r},e.IMSEC=function(r){if(r===!0||r===!1)return u.value;var n=e.IMREAL(r),t=e.IMAGINARY(r);return o.anyIsError(n,t)?u.value:e.IMDIV("1",e.IMCOS(r))},e.IMSECH=function(r){var n=e.IMREAL(r),t=e.IMAGINARY(r);return o.anyIsError(n,t)?u.value:e.IMDIV("1",e.IMCOSH(r))},e.IMSIN=function(r){var n=e.IMREAL(r),t=e.IMAGINARY(r);if(o.anyIsError(n,t))return u.value;var i=r.substring(r.length-1);return i="i"===i||"j"===i?i:"i",e.COMPLEX(Math.sin(n)*(Math.exp(t)+Math.exp(-t))/2,Math.cos(n)*(Math.exp(t)-Math.exp(-t))/2,i)},e.IMSINH=function(r){var n=e.IMREAL(r),t=e.IMAGINARY(r);if(o.anyIsError(n,t))return u.value;var i=r.substring(r.length-1);return i="i"===i||"j"===i?i:"i",e.COMPLEX(Math.cos(t)*(Math.exp(n)-Math.exp(-n))/2,Math.sin(t)*(Math.exp(n)+Math.exp(-n))/2,i)},e.IMSQRT=function(r){var n=e.IMREAL(r),t=e.IMAGINARY(r);if(o.anyIsError(n,t))return u.value;var i=r.substring(r.length-1);i="i"===i||"j"===i?i:"i";var a=Math.sqrt(e.IMABS(r)),s=e.IMARGUMENT(r);return e.COMPLEX(a*Math.cos(s/2),a*Math.sin(s/2),i)},e.IMCSC=function(r){if(r===!0||r===!1)return u.value;var n=e.IMREAL(r),t=e.IMAGINARY(r);return o.anyIsError(n,t)?u.num:e.IMDIV("1",e.IMSIN(r))},e.IMCSCH=function(r){if(r===!0||r===!1)return u.value;var n=e.IMREAL(r),t=e.IMAGINARY(r);return o.anyIsError(n,t)?u.num:e.IMDIV("1",e.IMSINH(r))},e.IMSUB=function(r,e){var n=this.IMREAL(r),t=this.IMAGINARY(r),i=this.IMREAL(e),a=this.IMAGINARY(e);if(o.anyIsError(n,t,i,a))return u.value;var s=r.substring(r.length-1),f=e.substring(e.length-1),l="i";return"j"===s?l="j":"j"===f&&(l="j"),this.COMPLEX(n-i,t-a,l)},e.IMSUM=function(){for(var r=o.flatten(arguments),e=r[0],n=1;n511)return u.num;if(n)return"1"+a.REPT("0",9-(512+t).toString(2).length)+(512+t).toString(2);var i=t.toString(2);return"undefined"==typeof e?i:isNaN(e)?u.value:e<0?u.num:(e=Math.floor(e),e>=i.length?a.REPT("0",e-i.length)+i:u.num)},e.OCT2DEC=function(r){if(!/^[0-7]{1,10}$/.test(r))return u.num;var e=parseInt(r,8);return e>=536870912?e-1073741824:e;
+},e.OCT2HEX=function(r,e){if(!/^[0-7]{1,10}$/.test(r))return u.num;var n=parseInt(r,8);if(n>=536870912)return"ff"+(n+3221225472).toString(16);var t=n.toString(16);return void 0===e?t:isNaN(e)?u.value:e<0?u.num:(e=Math.floor(e),e>=t.length?a.REPT("0",e-t.length)+t:u.num)}},function(r,e,n){function t(r,e){return r.reduce(function(r,n){return e*r+n},0)}function u(r,e,n,t,u){u||(u=-1);var i,a=2/r;if(0===e)return n;if(1===e)return t;for(var o=1;o!=e;++o)i=t*o*a+u*n,n=t,t=i;return t}function i(r,e,n,t,i){return function(a,o){if(0===o)return r(a);if(1===o)return e(a);if(o<0)throw n+": Order ("+o+") must be nonnegative";if(1==t&&0===a)throw n+": Undefined when x == 0";if(2==t&&a<=0)throw n+": Undefined when x <= 0";var s=r(a),f=e(a);return u(a,o,s,f,i)}}var a=Math,o=function(){function r(r){var e,u,l,c=r*r,m=a.abs(r)-.785398164;return a.abs(r)<8?(u=t(n,c),l=t(i,c),e=u/l):(c=64/c,u=t(o,c),l=t(s,c),e=a.sqrt(f/a.abs(r))*(a.cos(m)*u-a.sin(m)*l*8/a.abs(r))),e}function e(r){var e,n,u,i=r*r,o=a.abs(r)-2.356194491;return Math.abs(r)<8?(n=r*t(l,i),u=t(c,i),e=n/u):(i=64/i,n=t(m,i),u=t(p,i),e=a.sqrt(f/a.abs(r))*(a.cos(o)*n-a.sin(o)*u*8/a.abs(r)),r<0&&(e=-e)),e}var n=[57568490574,-13362590354,651619640.7,-11214424.18,77392.33017,-184.9052456].reverse(),i=[57568490411,1029532985,9494680.718,59272.64853,267.8532712,1].reverse(),o=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),s=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34935152e-8].reverse(),f=.636619772,l=[72362614232,-7895059235,242396853.1,-2972611.439,15704.4826,-30.16036606].reverse(),c=[144725228442,2300535178,18583304.74,99447.43394,376.9991397,1].reverse(),m=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),p=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return function(n,t){if(t=Math.round(t),0===t)return r(a.abs(n));if(1===t)return e(a.abs(n));if(t<0)throw"BESSELJ: Order ("+t+") must be nonnegative";if(0===a.abs(n))return 0;var i,o,s,f,l,c,m,p,h=2/a.abs(n);if(a.abs(n)>t)i=u(n,t,r(a.abs(n)),e(a.abs(n)),-1);else{for(s=2*a.floor((t+a.floor(a.sqrt(40*t)))/2),f=0,c=i=l=0,m=1,o=s;o>0;o--)p=o*h*m-c,c=m,m=p,a.abs(m)>1e10&&(m*=1e-10,c*=1e-10,i*=1e-10,l*=1e-10),f&&(l+=m),f=!f,o==t&&(i=c);l=2*l-m,i/=l}return n<0&&t%2?-i:i}}(),s=function(){function r(r){var e,i,c,m=r*r,p=r-.785398164;return r<8?(i=t(n,m),c=t(u,m),e=i/c+l*o(r,0)*a.log(r)):(m=64/m,i=t(s,m),c=t(f,m),e=a.sqrt(l/r)*(a.sin(p)*i+a.cos(p)*c*8/r)),e}function e(r){var e,n,u,i=r*r,s=r-2.356194491;return r<8?(n=r*t(c,i),u=t(m,i),e=n/u+l*(o(r,1)*a.log(r)-1/r)):(i=64/i,n=t(p,i),u=t(h,i),e=a.sqrt(l/r)*(a.sin(s)*n+a.cos(s)*u*8/r)),e}var n=[-2957821389,7062834065,-512359803.6,10879881.29,-86327.92757,228.4622733].reverse(),u=[40076544269,745249964.8,7189466.438,47447.2647,226.1030244,1].reverse(),s=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),f=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34945152e-8].reverse(),l=.636619772,c=[-4900604943e3,127527439e4,-51534381390,734926455.1,-4237922.726,8511.937935].reverse(),m=[249958057e5,424441966400,3733650367,22459040.02,102042.605,354.9632885,1].reverse(),p=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),h=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return i(r,e,"BESSELY",1,-1)}(),f=function(){function r(r){return r<=3.75?t(n,r*r/14.0625):a.exp(a.abs(r))/a.sqrt(a.abs(r))*t(u,3.75/a.abs(r))}function e(r){return r<3.75?r*t(i,r*r/14.0625):(r<0?-1:1)*a.exp(a.abs(r))/a.sqrt(a.abs(r))*t(o,3.75/a.abs(r))}var n=[1,3.5156229,3.0899424,1.2067492,.2659732,.0360768,.0045813].reverse(),u=[.39894228,.01328592,.00225319,-.00157565,.00916281,-.02057706,.02635537,-.01647633,.00392377].reverse(),i=[.5,.87890594,.51498869,.15084934,.02658733,.00301532,32411e-8].reverse(),o=[.39894228,-.03988024,-.00362018,.00163801,-.01031555,.02282967,-.02895312,.01787654,-.00420059].reverse();return function s(n,t){if(t=Math.round(t),0===t)return r(n);if(1==t)return e(n);if(t<0)throw"BESSELI Order ("+t+") must be nonnegative";if(0===a.abs(n))return 0;var u,i,o,f,l,c,m=2/a.abs(n);for(o=2*a.round((t+a.round(a.sqrt(40*t)))/2),f=u=0,l=1,i=o;i>0;i--)c=i*m*l+f,f=l,l=c,a.abs(l)>1e10&&(l*=1e-10,f*=1e-10,u*=1e-10),i==t&&(u=f);return u*=s(n,0)/l,n<0&&t%2?-u:u}}(),l=function(){function r(r){return r<=2?-a.log(r/2)*f(r,0)+t(n,r*r/4):a.exp(-r)/a.sqrt(r)*t(u,2/r)}function e(r){return r<=2?a.log(r/2)*f(r,1)+1/r*t(o,r*r/4):a.exp(-r)/a.sqrt(r)*t(s,2/r)}var n=[-.57721566,.4227842,.23069756,.0348859,.00262698,1075e-7,74e-7].reverse(),u=[1.25331414,-.07832358,.02189568,-.01062446,.00587872,-.0025154,53208e-8].reverse(),o=[1,.15443144,-.67278579,-.18156897,-.01919402,-.00110404,-4686e-8].reverse(),s=[1.25331414,.23498619,-.0365562,.01504268,-.00780353,.00325614,-68245e-8].reverse();return i(r,e,"BESSELK",2,1)}();e.besselj=o,e.bessely=s,e.besseli=f,e.besselk=l},function(r,e,n){function t(r){return 1===new Date(r,1,29).getMonth()}function u(r,e){return Math.ceil((e-r)/1e3/60/60/24)}function i(r){var e=r>-22038912e5?2:1;return(r-s)/864e5+e}var a=n(5),o=n(4),s=new Date(1900,0,1),f=[void 0,0,1,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,1,2,3,4,5,6,0],l=[[],[1,2,3,4,5,6,7],[7,1,2,3,4,5,6],[6,0,1,2,3,4,5],[],[],[],[],[],[],[],[7,1,2,3,4,5,6],[6,7,1,2,3,4,5],[5,6,7,1,2,3,4],[4,5,6,7,1,2,3],[3,4,5,6,7,1,2],[2,3,4,5,6,7,1],[1,2,3,4,5,6,7]],c=[[],[6,0],[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],void 0,void 0,void 0,[0,0],[1,1],[2,2],[3,3],[4,4],[5,5],[6,6]];e.DATE=function(r,e,n){if(r=o.parseNumber(r),e=o.parseNumber(e),n=o.parseNumber(n),o.anyIsError(r,e,n))return a.value;if(r<0||e<0||n<0)return a.num;var t=new Date(r,e-1,n);return t},e.DATEVALUE=function(r){if("string"!=typeof r)return a.value;var e=Date.parse(r);return isNaN(e)?a.value:e<=-22038912e5?(e-s)/864e5+1:(e-s)/864e5+2},e.DAY=function(r){var e=o.parseDate(r);return e instanceof Error?e:e.getDate()},e.DAYS=function(r,e){return r=o.parseDate(r),e=o.parseDate(e),r instanceof Error?r:e instanceof Error?e:i(r)-i(e)},e.DAYS360=function(r,e,n){if(n=o.parseBool(n),r=o.parseDate(r),e=o.parseDate(e),r instanceof Error)return r;if(e instanceof Error)return e;if(n instanceof Error)return n;var t,u,i=r.getMonth(),a=e.getMonth();if(n)t=31===r.getDate()?30:r.getDate(),u=31===e.getDate()?30:e.getDate();else{var s=new Date(r.getFullYear(),i+1,0).getDate(),f=new Date(e.getFullYear(),a+1,0).getDate();t=r.getDate()===s?30:r.getDate(),e.getDate()===f?t<30?(a++,u=1):u=30:u=e.getDate()}return 360*(e.getFullYear()-r.getFullYear())+30*(a-i)+(u-t)},e.EDATE=function(r,e){return r=o.parseDate(r),r instanceof Error?r:isNaN(e)?a.value:(e=parseInt(e,10),r.setMonth(r.getMonth()+e),i(r))},e.EOMONTH=function(r,e){return r=o.parseDate(r),r instanceof Error?r:isNaN(e)?a.value:(e=parseInt(e,10),i(new Date(r.getFullYear(),r.getMonth()+e+1,0)))},e.HOUR=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getHours()},e.INTERVAL=function(r){if("number"!=typeof r&&"string"!=typeof r)return a.value;r=parseInt(r,10);var e=Math.floor(r/94608e4);r%=94608e4;var n=Math.floor(r/2592e3);r%=2592e3;var t=Math.floor(r/86400);r%=86400;var u=Math.floor(r/3600);r%=3600;var i=Math.floor(r/60);r%=60;var o=r;return e=e>0?e+"Y":"",n=n>0?n+"M":"",t=t>0?t+"D":"",u=u>0?u+"H":"",i=i>0?i+"M":"",o=o>0?o+"S":"","P"+e+n+t+"T"+u+i+o},e.ISOWEEKNUM=function(r){if(r=o.parseDate(r),r instanceof Error)return r;r.setHours(0,0,0),r.setDate(r.getDate()+4-(r.getDay()||7));var e=new Date(r.getFullYear(),0,1);return Math.ceil(((r-e)/864e5+1)/7)},e.MINUTE=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getMinutes()},e.MONTH=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getMonth()+1},e.NETWORKDAYS=function(r,e,n){return this.NETWORKDAYS.INTL(r,e,1,n)},e.NETWORKDAYS.INTL=function(r,e,n,t){if(r=o.parseDate(r),r instanceof Error)return r;if(e=o.parseDate(e),e instanceof Error)return e;if(n=void 0===n?c[1]:c[n],!(n instanceof Array))return a.value;void 0===t?t=[]:t instanceof Array||(t=[t]);for(var u=0;u0?l.getUTCDay():l.getDay(),p=!1;m!==n[0]&&m!==n[1]||(p=!0);for(var h=0;h=u)return!0;var i=e.getFullYear(),a=new Date(i,2,1);return t(i)&&e>=a&&rl||a===l&&i>=f))return(s===c&&t(s)||m(r,e)||1===l&&29===f)&&(p=366),u(r,e)/p;var h=c-s+1,g=(new Date(c+1,0,1)-new Date(s,0,1))/1e3/60/60/24,v=g/h;return u(r,e)/v;case 2:return u(r,e)/360;case 3:return u(r,e)/365;case 4:return(f+30*l+360*c-(i+30*a+360*s))/360}}},function(module,exports,__webpack_require__){function compact(r){if(!r)return r;for(var e=[],n=0;nmaxCriteriaLength&&(maxCriteriaLength=criterias[i].length);for(var k=1;k1?error.num:u[t[0]]},exports.DMAX=function(r,e,n){if(isNaN(e)&&"string"!=typeof e)return error.value;var t=findResultIndex(r,n),u=[];if("string"==typeof e){var i=exports.FINDFIELD(r,e);u=utils.rest(r[i])}else u=utils.rest(r[e]);for(var a=u[t[0]],o=1;ou[t[o]]&&(a=u[t[o]]);return a},exports.DPRODUCT=function(r,e,n){if(isNaN(e)&&"string"!=typeof e)return error.value;var t=findResultIndex(r,n),u=[];if("string"==typeof e){var i=exports.FINDFIELD(r,e);u=utils.rest(r[i])}else u=utils.rest(r[e]);for(var a=[],o=0;o254?t.value:arguments.length0){var e=arguments[0],n=arguments.length-1,t=Math.floor(n/2),u=!1,i=n%2===0?null:arguments[arguments.length-1];if(t)for(var a=0;aa)return i.num;if(0!==s&&1!==s)return i.num;var f=e.PMT(r,n,t,0,s),l=0;1===u&&0===s&&(l=-t,u++);for(var c=u;c<=a;c++)l+=1===s?e.FV(r,c-2,f,t,1)-f:e.FV(r,c-1,f,t,0);return l*=r},e.CUMPRINC=function(r,n,t,u,a,s){if(r=o.parseNumber(r),n=o.parseNumber(n),t=o.parseNumber(t),o.anyIsError(r,n,t))return i.value;if(r<=0||n<=0||t<=0)return i.num;if(u<1||a<1||u>a)return i.num;if(0!==s&&1!==s)return i.num;var f=e.PMT(r,n,t,0,s),l=0;1===u&&(l=0===s?f+t*r:f,u++);for(var c=u;c<=a;c++)l+=s>0?f-(e.FV(r,c-2,f,t,1)-f)*r:f-e.FV(r,c-1,f,t,0)*r;return l},e.DB=function(r,e,n,t,u){if(u=void 0===u?12:u,r=o.parseNumber(r),e=o.parseNumber(e),n=o.parseNumber(n),t=o.parseNumber(t),u=o.parseNumber(u),o.anyIsError(r,e,n,t,u))return i.value;if(r<0||e<0||n<0||t<0)return i.num;if([1,2,3,4,5,6,7,8,9,10,11,12].indexOf(u)===-1)return i.num;if(t>n)return i.num;if(e>=r)return 0;for(var a=(1-Math.pow(e/r,1/n)).toFixed(3),s=r*a*u/12,f=s,l=0,c=t===n?n-1:t,m=2;m<=c;m++)l=(r-f)*a,f+=l;return 1===t?s:t===n?(r-f)*a:l},e.DDB=function(r,e,n,t,u){if(u=void 0===u?2:u,r=o.parseNumber(r),e=o.parseNumber(e),n=o.parseNumber(n),t=o.parseNumber(t),u=o.parseNumber(u),o.anyIsError(r,e,n,t,u))return i.value;if(r<0||e<0||n<0||t<0||u<=0)return i.num;if(t>n)return i.num;if(e>=r)return 0;for(var a=0,s=0,f=1;f<=t;f++)s=Math.min((r-a)*(u/n),r-e-a),a+=s;return s},e.DISC=function(){throw new Error("DISC is not implemented")},e.DOLLARDE=function(r,e){if(r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e))return i.value;if(e<0)return i.num;if(e>=0&&e<1)return i.div0;e=parseInt(e,10);var n=parseInt(r,10);n+=r%1*Math.pow(10,Math.ceil(Math.log(e)/Math.LN10))/e;var t=Math.pow(10,Math.ceil(Math.log(e)/Math.LN2)+1);return n=Math.round(n*t)/t},e.DOLLARFR=function(r,e){if(r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e))return i.value;if(e<0)return i.num;if(e>=0&&e<1)return i.div0;e=parseInt(e,10);var n=parseInt(r,10);return n+=r%1*Math.pow(10,-Math.ceil(Math.log(e)/Math.LN10))*e},e.DURATION=function(){throw new Error("DURATION is not implemented")},e.EFFECT=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?i.value:r<=0||e<1?i.num:(e=parseInt(e,10),Math.pow(1+r/e,e)-1)},e.FV=function(r,e,n,t,u){if(t=t||0,u=u||0,r=o.parseNumber(r),e=o.parseNumber(e),n=o.parseNumber(n),t=o.parseNumber(t),u=o.parseNumber(u),o.anyIsError(r,e,n,t,u))return i.value;var a;if(0===r)a=t+n*e;else{var s=Math.pow(1+r,e);a=1===u?t*s+n*(1+r)*(s-1)/r:t*s+n*(s-1)/r}return-a},e.FVSCHEDULE=function(r,e){if(r=o.parseNumber(r),e=o.parseNumberArray(o.flatten(e)),o.anyIsError(r,e))return i.value;for(var n=e.length,t=r,u=0;u0&&(a=!0),r[f]<0&&(s=!0);if(!a||!s)return i.num;e=void 0===e?.1:e;var l,c,m,p=e,h=1e-10,g=!0;do m=n(r,u,p),l=p-m/t(r,u,p),c=Math.abs(l-p),p=l,g=c>h&&Math.abs(m)>h;while(g);return p},e.ISPMT=function(r,e,n,t){return r=o.parseNumber(r),e=o.parseNumber(e),n=o.parseNumber(n),t=o.parseNumber(t),o.anyIsError(r,e,n,t)?i.value:t*r*(e/n-1)},e.MDURATION=function(){throw new Error("MDURATION is not implemented")},e.MIRR=function(r,n,t){if(r=o.parseNumberArray(o.flatten(r)),n=o.parseNumber(n),t=o.parseNumber(t),o.anyIsError(r,n,t))return i.value;for(var u=r.length,a=[],s=[],f=0;fm&&vn?i.num:(t=parseInt(t,10),(r-e)*(n-t+1)*2/(n*(n+1)))},e.TBILLEQ=function(r,e,n){return r=o.parseDate(r),e=o.parseDate(e),n=o.parseNumber(n),o.anyIsError(r,e,n)?i.value:n<=0?i.num:r>e?i.num:e-r>31536e6?i.num:365*n/(360-n*a.DAYS360(r,e,!1))},e.TBILLPRICE=function(r,e,n){return r=o.parseDate(r),e=o.parseDate(e),n=o.parseNumber(n),o.anyIsError(r,e,n)?i.value:n<=0?i.num:r>e?i.num:e-r>31536e6?i.num:100*(1-n*a.DAYS360(r,e,!1)/360)},e.TBILLYIELD=function(r,e,n){return r=o.parseDate(r),e=o.parseDate(e),n=o.parseNumber(n),o.anyIsError(r,e,n)?i.value:n<=0?i.num:r>e?i.num:e-r>31536e6?i.num:360*(100-n)/(n*a.DAYS360(r,e,!1))},e.VDB=function(){throw new Error("VDB is not implemented")},e.XIRR=function(r,e,n){if(r=o.parseNumberArray(o.flatten(r)),e=o.parseDateArray(o.flatten(e)),n=o.parseNumber(n),o.anyIsError(r,e,n))return i.value;for(var t=function(r,e,n){for(var t=n+1,u=r[0],i=1;i0&&(s=!0),r[l]<0&&(f=!0);if(!s||!f)return i.num;n=n||.1;var c,m,p,h=n,g=1e-10,v=!0;do p=t(r,e,h),c=h-p/u(r,e,h),m=Math.abs(c-h),h=c,v=m>g&&Math.abs(p)>g;while(v);return h},e.XNPV=function(r,e,n){if(r=o.parseNumber(r),e=o.parseNumberArray(o.flatten(e)),n=o.parseDateArray(o.flatten(n)),o.anyIsError(r,e,n))return i.value;for(var t=0,u=0;ui&&(u=a+1,i=e[a]):(u=a+1,i=e[a]))}else if(0===n){if("string"==typeof r){if(r=r.replace(/\?/g,"."),e[a].toLowerCase().match(r.toLowerCase()))return a+1}else if(e[a]===r)return a+1}else if(n===-1){if(e[a]===r)return a+1;e[a]>r&&(i?e[a]