1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713 |
- const cephes = require('./cephes.js');
- // Export compiled promise, in Node.js this is just a dummy promise as the
- // WebAssembly program will be compiled synchronously. It takes about 20ms
- // as of Node.js v10.6.1.
- exports.compiled = cephes.compiled;
- // from cephes/isnan.c
- exports.signbit = function signbit(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: int
- const fn_ret = cephes._cephes_signbit(carg_x) | 0;
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/isnan.c
- exports.isnan = function isnan(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: int
- const fn_ret = cephes._cephes_isnan(carg_x) | 0;
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/isnan.c
- exports.isfinite = function isfinite(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: int
- const fn_ret = cephes._cephes_isfinite(carg_x) | 0;
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/cbrt.c
- exports.cbrt = function cbrt(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_cbrt(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/polevl.c
- exports.polevl = function polevl(/* double */ x, /* double[] */ coef, /* int */ N) {
- //Save the STACKTOP because the following code will do some stack allocs
- const stacktop = cephes.stackSave();
- // argument: double x
- if (typeof x !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // argument: double[] coef
- if (!(coef instanceof Float64Array)) {
- cephes.stackRestore(stacktop);
- throw new TypeError('coef must be either a Float64Array');
- }
- const carg_coef = cephes.stackAlloc(coef.length << 3);
- cephes.writeArrayToMemory(new Uint8Array(coef.buffer, coef.byteOffset, coef.byteLength), carg_coef);
- // argument: int N
- if (typeof N !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('N must be a number');
- }
- const carg_N = N | 0;
- // return: double
- const fn_ret = cephes._cephes_polevl(carg_x, carg_coef, carg_N);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- // Restore internal stacktop before returning
- cephes.stackRestore(stacktop);
- return ret;
- };
- // from cephes/chbevl.c
- exports.chbevl = function chbevl(/* double */ x, /* double[] */ array, /* int */ n) {
- //Save the STACKTOP because the following code will do some stack allocs
- const stacktop = cephes.stackSave();
- // argument: double x
- if (typeof x !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // argument: double[] array
- if (!(array instanceof Float64Array)) {
- cephes.stackRestore(stacktop);
- throw new TypeError('array must be either a Float64Array');
- }
- const carg_array = cephes.stackAlloc(array.length << 3);
- cephes.writeArrayToMemory(new Uint8Array(array.buffer, array.byteOffset, array.byteLength), carg_array);
- // argument: int n
- if (typeof n !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('n must be a number');
- }
- const carg_n = n | 0;
- // return: double
- const fn_ret = cephes._cephes_chbevl(carg_x, carg_array, carg_n);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- // Restore internal stacktop before returning
- cephes.stackRestore(stacktop);
- return ret;
- };
- // from cephes/round.c
- exports.round = function round(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_round(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/floor.c
- exports.frexp = function frexp(/* double */ x) {
- //Save the STACKTOP because the following code will do some stack allocs
- const stacktop = cephes.stackSave();
- // argument: double x
- if (typeof x !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // argument: int* pw2
- const carg_pw2 = cephes.stackAlloc(4); // No need to zero-set it.
- // return: double
- const fn_ret = cephes._cephes_frexp(carg_x, carg_pw2);
- // There are pointers, so return the values of thoese too
- const ret = [fn_ret, {
- 'pw2': cephes.getValue(carg_pw2, 'i32'),
- }];
- // Restore internal stacktop before returning
- cephes.stackRestore(stacktop);
- return ret;
- };
- // from cephes/floor.c
- exports.ldexp = function ldexp(/* double */ x, /* int */ pw2) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // argument: int pw2
- if (typeof pw2 !== 'number') {
- throw new TypeError('pw2 must be a number');
- }
- const carg_pw2 = pw2 | 0;
- // return: double
- const fn_ret = cephes._cephes_ldexp(carg_x, carg_pw2);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/expx2.c
- exports.expx2 = function expx2(/* double */ x, /* int */ sign) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // argument: int sign
- if (typeof sign !== 'number') {
- throw new TypeError('sign must be a number');
- }
- const carg_sign = sign | 0;
- // return: double
- const fn_ret = cephes._cephes_expx2(carg_x, carg_sign);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/sin.c
- exports.radian = function radian(/* double */ d, /* double */ m, /* double */ s) {
- // argument: double d
- if (typeof d !== 'number') {
- throw new TypeError('d must be a number');
- }
- const carg_d = d;
- // argument: double m
- if (typeof m !== 'number') {
- throw new TypeError('m must be a number');
- }
- const carg_m = m;
- // argument: double s
- if (typeof s !== 'number') {
- throw new TypeError('s must be a number');
- }
- const carg_s = s;
- // return: double
- const fn_ret = cephes._cephes_radian(carg_d, carg_m, carg_s);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/sincos.c
- exports.sincos = function sincos(/* double */ x, /* int */ flg) {
- //Save the STACKTOP because the following code will do some stack allocs
- const stacktop = cephes.stackSave();
- // argument: double x
- if (typeof x !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // argument: double* s
- const carg_s = cephes.stackAlloc(8); // No need to zero-set it.
- // argument: double* c
- const carg_c = cephes.stackAlloc(8); // No need to zero-set it.
- // argument: int flg
- if (typeof flg !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('flg must be a number');
- }
- const carg_flg = flg | 0;
- // return: int
- const fn_ret = cephes._cephes_sincos(carg_x, carg_s, carg_c, carg_flg) | 0;
- // There are pointers, so return the values of thoese too
- const ret = [fn_ret, {
- 's': cephes.getValue(carg_s, 'double'),
- 'c': cephes.getValue(carg_c, 'double'),
- }];
- // Restore internal stacktop before returning
- cephes.stackRestore(stacktop);
- return ret;
- };
- // from cephes/tan.c
- exports.cot = function cot(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_cot(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/tandg.c
- exports.cotdg = function cotdg(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_cotdg(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/unity.c
- exports.log1p = function log1p(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_log1p(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/unity.c
- exports.expm1 = function expm1(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_expm1(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/unity.c
- exports.cosm1 = function cosm1(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_cosm1(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/asin.c
- exports.acos = function acos(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_acos(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/acosh.c
- exports.acosh = function acosh(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_acosh(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/asinh.c
- exports.asinh = function asinh(/* double */ xx) {
- // argument: double xx
- if (typeof xx !== 'number') {
- throw new TypeError('xx must be a number');
- }
- const carg_xx = xx;
- // return: double
- const fn_ret = cephes._cephes_asinh(carg_xx);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/atanh.c
- exports.atanh = function atanh(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_atanh(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/asin.c
- exports.asin = function asin(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_asin(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/atan.c
- exports.atan = function atan(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_atan(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/atan.c
- exports.atan2 = function atan2(/* double */ y, /* double */ x) {
- // argument: double y
- if (typeof y !== 'number') {
- throw new TypeError('y must be a number');
- }
- const carg_y = y;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_atan2(carg_y, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/sin.c
- exports.cos = function cos(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_cos(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/sindg.c
- exports.cosdg = function cosdg(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_cosdg(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/exp.c
- exports.exp = function exp(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_exp(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/exp2.c
- exports.exp2 = function exp2(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_exp2(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/exp10.c
- exports.exp10 = function exp10(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_exp10(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/cosh.c
- exports.cosh = function cosh(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_cosh(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/sinh.c
- exports.sinh = function sinh(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_sinh(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/tanh.c
- exports.tanh = function tanh(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_tanh(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/log.c
- exports.log = function log(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_log(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/log2.c
- exports.log2 = function log2(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_log2(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/log10.c
- exports.log10 = function log10(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_log10(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/pow.c
- exports.pow = function pow(/* double */ x, /* double */ y) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // argument: double y
- if (typeof y !== 'number') {
- throw new TypeError('y must be a number');
- }
- const carg_y = y;
- // return: double
- const fn_ret = cephes._cephes_pow(carg_x, carg_y);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/powi.c
- exports.powi = function powi(/* double */ x, /* int */ nn) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // argument: int nn
- if (typeof nn !== 'number') {
- throw new TypeError('nn must be a number');
- }
- const carg_nn = nn | 0;
- // return: double
- const fn_ret = cephes._cephes_powi(carg_x, carg_nn);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/sin.c
- exports.sin = function sin(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_sin(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/sindg.c
- exports.sindg = function sindg(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_sindg(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/tan.c
- exports.tan = function tan(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_tan(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/tandg.c
- exports.tandg = function tandg(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_tandg(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/ei.c
- exports.ei = function ei(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_ei(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/expn.c
- exports.expn = function expn(/* int */ n, /* double */ x) {
- // argument: int n
- if (typeof n !== 'number') {
- throw new TypeError('n must be a number');
- }
- const carg_n = n | 0;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_expn(carg_n, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/shichi.c
- exports.shichi = function shichi(/* double */ x) {
- //Save the STACKTOP because the following code will do some stack allocs
- const stacktop = cephes.stackSave();
- // argument: double x
- if (typeof x !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // argument: double* si
- const carg_si = cephes.stackAlloc(8); // No need to zero-set it.
- // argument: double* ci
- const carg_ci = cephes.stackAlloc(8); // No need to zero-set it.
- // return: int
- const fn_ret = cephes._cephes_shichi(carg_x, carg_si, carg_ci) | 0;
- // There are pointers, so return the values of thoese too
- const ret = [fn_ret, {
- 'si': cephes.getValue(carg_si, 'double'),
- 'ci': cephes.getValue(carg_ci, 'double'),
- }];
- // Restore internal stacktop before returning
- cephes.stackRestore(stacktop);
- return ret;
- };
- // from cephes/sici.c
- exports.sici = function sici(/* double */ x) {
- //Save the STACKTOP because the following code will do some stack allocs
- const stacktop = cephes.stackSave();
- // argument: double x
- if (typeof x !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // argument: double* si
- const carg_si = cephes.stackAlloc(8); // No need to zero-set it.
- // argument: double* ci
- const carg_ci = cephes.stackAlloc(8); // No need to zero-set it.
- // return: int
- const fn_ret = cephes._cephes_sici(carg_x, carg_si, carg_ci) | 0;
- // There are pointers, so return the values of thoese too
- const ret = [fn_ret, {
- 'si': cephes.getValue(carg_si, 'double'),
- 'ci': cephes.getValue(carg_ci, 'double'),
- }];
- // Restore internal stacktop before returning
- cephes.stackRestore(stacktop);
- return ret;
- };
- // from cephes/beta.c
- exports.lbeta = function lbeta(/* double */ a, /* double */ b) {
- // argument: double a
- if (typeof a !== 'number') {
- throw new TypeError('a must be a number');
- }
- const carg_a = a;
- // argument: double b
- if (typeof b !== 'number') {
- throw new TypeError('b must be a number');
- }
- const carg_b = b;
- // return: double
- const fn_ret = cephes._cephes_lbeta(carg_a, carg_b);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/beta.c
- exports.beta = function beta(/* double */ a, /* double */ b) {
- // argument: double a
- if (typeof a !== 'number') {
- throw new TypeError('a must be a number');
- }
- const carg_a = a;
- // argument: double b
- if (typeof b !== 'number') {
- throw new TypeError('b must be a number');
- }
- const carg_b = b;
- // return: double
- const fn_ret = cephes._cephes_beta(carg_a, carg_b);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/fac.c
- exports.fac = function fac(/* int */ i) {
- // argument: int i
- if (typeof i !== 'number') {
- throw new TypeError('i must be a number');
- }
- const carg_i = i | 0;
- // return: double
- const fn_ret = cephes._cephes_fac(carg_i);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/gamma.c
- exports.gamma = function gamma(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_gamma(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/gamma.c
- exports.lgam = function lgam(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_lgam(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/incbet.c
- exports.incbet = function incbet(/* double */ aa, /* double */ bb, /* double */ xx) {
- // argument: double aa
- if (typeof aa !== 'number') {
- throw new TypeError('aa must be a number');
- }
- const carg_aa = aa;
- // argument: double bb
- if (typeof bb !== 'number') {
- throw new TypeError('bb must be a number');
- }
- const carg_bb = bb;
- // argument: double xx
- if (typeof xx !== 'number') {
- throw new TypeError('xx must be a number');
- }
- const carg_xx = xx;
- // return: double
- const fn_ret = cephes._cephes_incbet(carg_aa, carg_bb, carg_xx);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/incbi.c
- exports.incbi = function incbi(/* double */ aa, /* double */ bb, /* double */ yy0) {
- // argument: double aa
- if (typeof aa !== 'number') {
- throw new TypeError('aa must be a number');
- }
- const carg_aa = aa;
- // argument: double bb
- if (typeof bb !== 'number') {
- throw new TypeError('bb must be a number');
- }
- const carg_bb = bb;
- // argument: double yy0
- if (typeof yy0 !== 'number') {
- throw new TypeError('yy0 must be a number');
- }
- const carg_yy0 = yy0;
- // return: double
- const fn_ret = cephes._cephes_incbi(carg_aa, carg_bb, carg_yy0);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/igam.c
- exports.igam = function igam(/* double */ a, /* double */ x) {
- // argument: double a
- if (typeof a !== 'number') {
- throw new TypeError('a must be a number');
- }
- const carg_a = a;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_igam(carg_a, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/igam.c
- exports.igamc = function igamc(/* double */ a, /* double */ x) {
- // argument: double a
- if (typeof a !== 'number') {
- throw new TypeError('a must be a number');
- }
- const carg_a = a;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_igamc(carg_a, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/igami.c
- exports.igami = function igami(/* double */ a, /* double */ y0) {
- // argument: double a
- if (typeof a !== 'number') {
- throw new TypeError('a must be a number');
- }
- const carg_a = a;
- // argument: double y0
- if (typeof y0 !== 'number') {
- throw new TypeError('y0 must be a number');
- }
- const carg_y0 = y0;
- // return: double
- const fn_ret = cephes._cephes_igami(carg_a, carg_y0);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/psi.c
- exports.psi = function psi(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_psi(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/rgamma.c
- exports.rgamma = function rgamma(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_rgamma(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/ndtr.c
- exports.erf = function erf(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_erf(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/ndtr.c
- exports.erfc = function erfc(/* double */ a) {
- // argument: double a
- if (typeof a !== 'number') {
- throw new TypeError('a must be a number');
- }
- const carg_a = a;
- // return: double
- const fn_ret = cephes._cephes_erfc(carg_a);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/dawsn.c
- exports.dawsn = function dawsn(/* double */ xx) {
- // argument: double xx
- if (typeof xx !== 'number') {
- throw new TypeError('xx must be a number');
- }
- const carg_xx = xx;
- // return: double
- const fn_ret = cephes._cephes_dawsn(carg_xx);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/fresnl.c
- exports.fresnl = function fresnl(/* double */ xxa) {
- //Save the STACKTOP because the following code will do some stack allocs
- const stacktop = cephes.stackSave();
- // argument: double xxa
- if (typeof xxa !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('xxa must be a number');
- }
- const carg_xxa = xxa;
- // argument: double* ssa
- const carg_ssa = cephes.stackAlloc(8); // No need to zero-set it.
- // argument: double* cca
- const carg_cca = cephes.stackAlloc(8); // No need to zero-set it.
- // return: int
- const fn_ret = cephes._cephes_fresnl(carg_xxa, carg_ssa, carg_cca) | 0;
- // There are pointers, so return the values of thoese too
- const ret = [fn_ret, {
- 'ssa': cephes.getValue(carg_ssa, 'double'),
- 'cca': cephes.getValue(carg_cca, 'double'),
- }];
- // Restore internal stacktop before returning
- cephes.stackRestore(stacktop);
- return ret;
- };
- // from cephes/airy.c
- exports.airy = function airy(/* double */ x) {
- //Save the STACKTOP because the following code will do some stack allocs
- const stacktop = cephes.stackSave();
- // argument: double x
- if (typeof x !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // argument: double* ai
- const carg_ai = cephes.stackAlloc(8); // No need to zero-set it.
- // argument: double* aip
- const carg_aip = cephes.stackAlloc(8); // No need to zero-set it.
- // argument: double* bi
- const carg_bi = cephes.stackAlloc(8); // No need to zero-set it.
- // argument: double* bip
- const carg_bip = cephes.stackAlloc(8); // No need to zero-set it.
- // return: int
- const fn_ret = cephes._cephes_airy(carg_x, carg_ai, carg_aip, carg_bi, carg_bip) | 0;
- // There are pointers, so return the values of thoese too
- const ret = [fn_ret, {
- 'ai': cephes.getValue(carg_ai, 'double'),
- 'aip': cephes.getValue(carg_aip, 'double'),
- 'bi': cephes.getValue(carg_bi, 'double'),
- 'bip': cephes.getValue(carg_bip, 'double'),
- }];
- // Restore internal stacktop before returning
- cephes.stackRestore(stacktop);
- return ret;
- };
- // from cephes/j0.c
- exports.j0 = function j0(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_j0(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/j1.c
- exports.j1 = function j1(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_j1(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/jn.c
- exports.jn = function jn(/* int */ n, /* double */ x) {
- // argument: int n
- if (typeof n !== 'number') {
- throw new TypeError('n must be a number');
- }
- const carg_n = n | 0;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_jn(carg_n, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/jv.c
- exports.jv = function jv(/* double */ n, /* double */ x) {
- // argument: double n
- if (typeof n !== 'number') {
- throw new TypeError('n must be a number');
- }
- const carg_n = n;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_jv(carg_n, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/j0.c
- exports.y0 = function y0(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_y0(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/j1.c
- exports.y1 = function y1(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_y1(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/yn.c
- exports.yn = function yn(/* int */ n, /* double */ x) {
- // argument: int n
- if (typeof n !== 'number') {
- throw new TypeError('n must be a number');
- }
- const carg_n = n | 0;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_yn(carg_n, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/struve.c
- exports.yv = function yv(/* double */ v, /* double */ x) {
- // argument: double v
- if (typeof v !== 'number') {
- throw new TypeError('v must be a number');
- }
- const carg_v = v;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_yv(carg_v, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/i0.c
- exports.i0 = function i0(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_i0(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/i0.c
- exports.i0e = function i0e(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_i0e(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/i1.c
- exports.i1 = function i1(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_i1(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/i1.c
- exports.i1e = function i1e(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_i1e(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/iv.c
- exports.iv = function iv(/* double */ v, /* double */ x) {
- // argument: double v
- if (typeof v !== 'number') {
- throw new TypeError('v must be a number');
- }
- const carg_v = v;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_iv(carg_v, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/k0.c
- exports.k0 = function k0(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_k0(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/k0.c
- exports.k0e = function k0e(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_k0e(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/k1.c
- exports.k1 = function k1(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_k1(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/k1.c
- exports.k1e = function k1e(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_k1e(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/kn.c
- exports.kn = function kn(/* int */ nn, /* double */ x) {
- // argument: int nn
- if (typeof nn !== 'number') {
- throw new TypeError('nn must be a number');
- }
- const carg_nn = nn | 0;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_kn(carg_nn, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/hyperg.c
- exports.hyperg = function hyperg(/* double */ a, /* double */ b, /* double */ x) {
- // argument: double a
- if (typeof a !== 'number') {
- throw new TypeError('a must be a number');
- }
- const carg_a = a;
- // argument: double b
- if (typeof b !== 'number') {
- throw new TypeError('b must be a number');
- }
- const carg_b = b;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_hyperg(carg_a, carg_b, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/hyp2f1.c
- exports.hyp2f1 = function hyp2f1(/* double */ a, /* double */ b, /* double */ c, /* double */ x) {
- // argument: double a
- if (typeof a !== 'number') {
- throw new TypeError('a must be a number');
- }
- const carg_a = a;
- // argument: double b
- if (typeof b !== 'number') {
- throw new TypeError('b must be a number');
- }
- const carg_b = b;
- // argument: double c
- if (typeof c !== 'number') {
- throw new TypeError('c must be a number');
- }
- const carg_c = c;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_hyp2f1(carg_a, carg_b, carg_c, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/ellpe.c
- exports.ellpe = function ellpe(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_ellpe(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/ellie.c
- exports.ellie = function ellie(/* double */ phi, /* double */ m) {
- // argument: double phi
- if (typeof phi !== 'number') {
- throw new TypeError('phi must be a number');
- }
- const carg_phi = phi;
- // argument: double m
- if (typeof m !== 'number') {
- throw new TypeError('m must be a number');
- }
- const carg_m = m;
- // return: double
- const fn_ret = cephes._cephes_ellie(carg_phi, carg_m);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/ellpk.c
- exports.ellpk = function ellpk(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_ellpk(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/ellik.c
- exports.ellik = function ellik(/* double */ phi, /* double */ m) {
- // argument: double phi
- if (typeof phi !== 'number') {
- throw new TypeError('phi must be a number');
- }
- const carg_phi = phi;
- // argument: double m
- if (typeof m !== 'number') {
- throw new TypeError('m must be a number');
- }
- const carg_m = m;
- // return: double
- const fn_ret = cephes._cephes_ellik(carg_phi, carg_m);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/ellpj.c
- exports.ellpj = function ellpj(/* double */ u, /* double */ m) {
- //Save the STACKTOP because the following code will do some stack allocs
- const stacktop = cephes.stackSave();
- // argument: double u
- if (typeof u !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('u must be a number');
- }
- const carg_u = u;
- // argument: double m
- if (typeof m !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('m must be a number');
- }
- const carg_m = m;
- // argument: double* sn
- const carg_sn = cephes.stackAlloc(8); // No need to zero-set it.
- // argument: double* cn
- const carg_cn = cephes.stackAlloc(8); // No need to zero-set it.
- // argument: double* dn
- const carg_dn = cephes.stackAlloc(8); // No need to zero-set it.
- // argument: double* ph
- const carg_ph = cephes.stackAlloc(8); // No need to zero-set it.
- // return: int
- const fn_ret = cephes._cephes_ellpj(carg_u, carg_m, carg_sn, carg_cn, carg_dn, carg_ph) | 0;
- // There are pointers, so return the values of thoese too
- const ret = [fn_ret, {
- 'sn': cephes.getValue(carg_sn, 'double'),
- 'cn': cephes.getValue(carg_cn, 'double'),
- 'dn': cephes.getValue(carg_dn, 'double'),
- 'ph': cephes.getValue(carg_ph, 'double'),
- }];
- // Restore internal stacktop before returning
- cephes.stackRestore(stacktop);
- return ret;
- };
- // from cephes/btdtr.c
- exports.btdtr = function btdtr(/* double */ a, /* double */ b, /* double */ x) {
- // argument: double a
- if (typeof a !== 'number') {
- throw new TypeError('a must be a number');
- }
- const carg_a = a;
- // argument: double b
- if (typeof b !== 'number') {
- throw new TypeError('b must be a number');
- }
- const carg_b = b;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_btdtr(carg_a, carg_b, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/kolmogorov.c
- exports.smirnov = function smirnov(/* int */ n, /* double */ e) {
- // argument: int n
- if (typeof n !== 'number') {
- throw new TypeError('n must be a number');
- }
- const carg_n = n | 0;
- // argument: double e
- if (typeof e !== 'number') {
- throw new TypeError('e must be a number');
- }
- const carg_e = e;
- // return: double
- const fn_ret = cephes._cephes_smirnov(carg_n, carg_e);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/kolmogorov.c
- exports.kolmogorov = function kolmogorov(/* double */ y) {
- // argument: double y
- if (typeof y !== 'number') {
- throw new TypeError('y must be a number');
- }
- const carg_y = y;
- // return: double
- const fn_ret = cephes._cephes_kolmogorov(carg_y);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/kolmogorov.c
- exports.smirnovi = function smirnovi(/* int */ n, /* double */ p) {
- // argument: int n
- if (typeof n !== 'number') {
- throw new TypeError('n must be a number');
- }
- const carg_n = n | 0;
- // argument: double p
- if (typeof p !== 'number') {
- throw new TypeError('p must be a number');
- }
- const carg_p = p;
- // return: double
- const fn_ret = cephes._cephes_smirnovi(carg_n, carg_p);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/kolmogorov.c
- exports.kolmogi = function kolmogi(/* double */ p) {
- // argument: double p
- if (typeof p !== 'number') {
- throw new TypeError('p must be a number');
- }
- const carg_p = p;
- // return: double
- const fn_ret = cephes._cephes_kolmogi(carg_p);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/nbdtr.c
- exports.nbdtri = function nbdtri(/* int */ k, /* int */ n, /* double */ p) {
- // argument: int k
- if (typeof k !== 'number') {
- throw new TypeError('k must be a number');
- }
- const carg_k = k | 0;
- // argument: int n
- if (typeof n !== 'number') {
- throw new TypeError('n must be a number');
- }
- const carg_n = n | 0;
- // argument: double p
- if (typeof p !== 'number') {
- throw new TypeError('p must be a number');
- }
- const carg_p = p;
- // return: double
- const fn_ret = cephes._cephes_nbdtri(carg_k, carg_n, carg_p);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/stdtr.c
- exports.stdtri = function stdtri(/* int */ k, /* double */ p) {
- // argument: int k
- if (typeof k !== 'number') {
- throw new TypeError('k must be a number');
- }
- const carg_k = k | 0;
- // argument: double p
- if (typeof p !== 'number') {
- throw new TypeError('p must be a number');
- }
- const carg_p = p;
- // return: double
- const fn_ret = cephes._cephes_stdtri(carg_k, carg_p);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/bdtr.c
- exports.bdtr = function bdtr(/* int */ k, /* int */ n, /* double */ p) {
- // argument: int k
- if (typeof k !== 'number') {
- throw new TypeError('k must be a number');
- }
- const carg_k = k | 0;
- // argument: int n
- if (typeof n !== 'number') {
- throw new TypeError('n must be a number');
- }
- const carg_n = n | 0;
- // argument: double p
- if (typeof p !== 'number') {
- throw new TypeError('p must be a number');
- }
- const carg_p = p;
- // return: double
- const fn_ret = cephes._cephes_bdtr(carg_k, carg_n, carg_p);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/bdtr.c
- exports.bdtrc = function bdtrc(/* int */ k, /* int */ n, /* double */ p) {
- // argument: int k
- if (typeof k !== 'number') {
- throw new TypeError('k must be a number');
- }
- const carg_k = k | 0;
- // argument: int n
- if (typeof n !== 'number') {
- throw new TypeError('n must be a number');
- }
- const carg_n = n | 0;
- // argument: double p
- if (typeof p !== 'number') {
- throw new TypeError('p must be a number');
- }
- const carg_p = p;
- // return: double
- const fn_ret = cephes._cephes_bdtrc(carg_k, carg_n, carg_p);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/bdtr.c
- exports.bdtri = function bdtri(/* int */ k, /* int */ n, /* double */ y) {
- // argument: int k
- if (typeof k !== 'number') {
- throw new TypeError('k must be a number');
- }
- const carg_k = k | 0;
- // argument: int n
- if (typeof n !== 'number') {
- throw new TypeError('n must be a number');
- }
- const carg_n = n | 0;
- // argument: double y
- if (typeof y !== 'number') {
- throw new TypeError('y must be a number');
- }
- const carg_y = y;
- // return: double
- const fn_ret = cephes._cephes_bdtri(carg_k, carg_n, carg_y);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/chdtr.c
- exports.chdtr = function chdtr(/* double */ df, /* double */ x) {
- // argument: double df
- if (typeof df !== 'number') {
- throw new TypeError('df must be a number');
- }
- const carg_df = df;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_chdtr(carg_df, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/chdtr.c
- exports.chdtrc = function chdtrc(/* double */ df, /* double */ x) {
- // argument: double df
- if (typeof df !== 'number') {
- throw new TypeError('df must be a number');
- }
- const carg_df = df;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_chdtrc(carg_df, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/chdtr.c
- exports.chdtri = function chdtri(/* double */ df, /* double */ y) {
- // argument: double df
- if (typeof df !== 'number') {
- throw new TypeError('df must be a number');
- }
- const carg_df = df;
- // argument: double y
- if (typeof y !== 'number') {
- throw new TypeError('y must be a number');
- }
- const carg_y = y;
- // return: double
- const fn_ret = cephes._cephes_chdtri(carg_df, carg_y);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/fdtr.c
- exports.fdtr = function fdtr(/* int */ ia, /* int */ ib, /* double */ x) {
- // argument: int ia
- if (typeof ia !== 'number') {
- throw new TypeError('ia must be a number');
- }
- const carg_ia = ia | 0;
- // argument: int ib
- if (typeof ib !== 'number') {
- throw new TypeError('ib must be a number');
- }
- const carg_ib = ib | 0;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_fdtr(carg_ia, carg_ib, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/fdtr.c
- exports.fdtrc = function fdtrc(/* int */ ia, /* int */ ib, /* double */ x) {
- // argument: int ia
- if (typeof ia !== 'number') {
- throw new TypeError('ia must be a number');
- }
- const carg_ia = ia | 0;
- // argument: int ib
- if (typeof ib !== 'number') {
- throw new TypeError('ib must be a number');
- }
- const carg_ib = ib | 0;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_fdtrc(carg_ia, carg_ib, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/fdtr.c
- exports.fdtri = function fdtri(/* int */ ia, /* int */ ib, /* double */ y) {
- // argument: int ia
- if (typeof ia !== 'number') {
- throw new TypeError('ia must be a number');
- }
- const carg_ia = ia | 0;
- // argument: int ib
- if (typeof ib !== 'number') {
- throw new TypeError('ib must be a number');
- }
- const carg_ib = ib | 0;
- // argument: double y
- if (typeof y !== 'number') {
- throw new TypeError('y must be a number');
- }
- const carg_y = y;
- // return: double
- const fn_ret = cephes._cephes_fdtri(carg_ia, carg_ib, carg_y);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/gdtr.c
- exports.gdtr = function gdtr(/* double */ a, /* double */ b, /* double */ x) {
- // argument: double a
- if (typeof a !== 'number') {
- throw new TypeError('a must be a number');
- }
- const carg_a = a;
- // argument: double b
- if (typeof b !== 'number') {
- throw new TypeError('b must be a number');
- }
- const carg_b = b;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_gdtr(carg_a, carg_b, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/gdtr.c
- exports.gdtrc = function gdtrc(/* double */ a, /* double */ b, /* double */ x) {
- // argument: double a
- if (typeof a !== 'number') {
- throw new TypeError('a must be a number');
- }
- const carg_a = a;
- // argument: double b
- if (typeof b !== 'number') {
- throw new TypeError('b must be a number');
- }
- const carg_b = b;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_gdtrc(carg_a, carg_b, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/nbdtr.c
- exports.nbdtr = function nbdtr(/* int */ k, /* int */ n, /* double */ p) {
- // argument: int k
- if (typeof k !== 'number') {
- throw new TypeError('k must be a number');
- }
- const carg_k = k | 0;
- // argument: int n
- if (typeof n !== 'number') {
- throw new TypeError('n must be a number');
- }
- const carg_n = n | 0;
- // argument: double p
- if (typeof p !== 'number') {
- throw new TypeError('p must be a number');
- }
- const carg_p = p;
- // return: double
- const fn_ret = cephes._cephes_nbdtr(carg_k, carg_n, carg_p);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/nbdtr.c
- exports.nbdtrc = function nbdtrc(/* int */ k, /* int */ n, /* double */ p) {
- // argument: int k
- if (typeof k !== 'number') {
- throw new TypeError('k must be a number');
- }
- const carg_k = k | 0;
- // argument: int n
- if (typeof n !== 'number') {
- throw new TypeError('n must be a number');
- }
- const carg_n = n | 0;
- // argument: double p
- if (typeof p !== 'number') {
- throw new TypeError('p must be a number');
- }
- const carg_p = p;
- // return: double
- const fn_ret = cephes._cephes_nbdtrc(carg_k, carg_n, carg_p);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/ndtr.c
- exports.ndtr = function ndtr(/* double */ a) {
- // argument: double a
- if (typeof a !== 'number') {
- throw new TypeError('a must be a number');
- }
- const carg_a = a;
- // return: double
- const fn_ret = cephes._cephes_ndtr(carg_a);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/ndtri.c
- exports.ndtri = function ndtri(/* double */ y0) {
- // argument: double y0
- if (typeof y0 !== 'number') {
- throw new TypeError('y0 must be a number');
- }
- const carg_y0 = y0;
- // return: double
- const fn_ret = cephes._cephes_ndtri(carg_y0);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/pdtr.c
- exports.pdtr = function pdtr(/* int */ k, /* double */ m) {
- // argument: int k
- if (typeof k !== 'number') {
- throw new TypeError('k must be a number');
- }
- const carg_k = k | 0;
- // argument: double m
- if (typeof m !== 'number') {
- throw new TypeError('m must be a number');
- }
- const carg_m = m;
- // return: double
- const fn_ret = cephes._cephes_pdtr(carg_k, carg_m);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/pdtr.c
- exports.pdtrc = function pdtrc(/* int */ k, /* double */ m) {
- // argument: int k
- if (typeof k !== 'number') {
- throw new TypeError('k must be a number');
- }
- const carg_k = k | 0;
- // argument: double m
- if (typeof m !== 'number') {
- throw new TypeError('m must be a number');
- }
- const carg_m = m;
- // return: double
- const fn_ret = cephes._cephes_pdtrc(carg_k, carg_m);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/pdtr.c
- exports.pdtri = function pdtri(/* int */ k, /* double */ y) {
- // argument: int k
- if (typeof k !== 'number') {
- throw new TypeError('k must be a number');
- }
- const carg_k = k | 0;
- // argument: double y
- if (typeof y !== 'number') {
- throw new TypeError('y must be a number');
- }
- const carg_y = y;
- // return: double
- const fn_ret = cephes._cephes_pdtri(carg_k, carg_y);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/stdtr.c
- exports.stdtr = function stdtr(/* int */ k, /* double */ t) {
- // argument: int k
- if (typeof k !== 'number') {
- throw new TypeError('k must be a number');
- }
- const carg_k = k | 0;
- // argument: double t
- if (typeof t !== 'number') {
- throw new TypeError('t must be a number');
- }
- const carg_t = t;
- // return: double
- const fn_ret = cephes._cephes_stdtr(carg_k, carg_t);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/planck.c
- exports.plancki = function plancki(/* double */ w, /* double */ T) {
- // argument: double w
- if (typeof w !== 'number') {
- throw new TypeError('w must be a number');
- }
- const carg_w = w;
- // argument: double T
- if (typeof T !== 'number') {
- throw new TypeError('T must be a number');
- }
- const carg_T = T;
- // return: double
- const fn_ret = cephes._cephes_plancki(carg_w, carg_T);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/planck.c
- exports.planckc = function planckc(/* double */ w, /* double */ T) {
- // argument: double w
- if (typeof w !== 'number') {
- throw new TypeError('w must be a number');
- }
- const carg_w = w;
- // argument: double T
- if (typeof T !== 'number') {
- throw new TypeError('T must be a number');
- }
- const carg_T = T;
- // return: double
- const fn_ret = cephes._cephes_planckc(carg_w, carg_T);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/planck.c
- exports.planckd = function planckd(/* double */ w, /* double */ T) {
- // argument: double w
- if (typeof w !== 'number') {
- throw new TypeError('w must be a number');
- }
- const carg_w = w;
- // argument: double T
- if (typeof T !== 'number') {
- throw new TypeError('T must be a number');
- }
- const carg_T = T;
- // return: double
- const fn_ret = cephes._cephes_planckd(carg_w, carg_T);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/planck.c
- exports.planckw = function planckw(/* double */ T) {
- // argument: double T
- if (typeof T !== 'number') {
- throw new TypeError('T must be a number');
- }
- const carg_T = T;
- // return: double
- const fn_ret = cephes._cephes_planckw(carg_T);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/spence.c
- exports.spence = function spence(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_spence(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/zetac.c
- exports.zetac = function zetac(/* double */ x) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_zetac(carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/zeta.c
- exports.zeta = function zeta(/* double */ x, /* double */ q) {
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // argument: double q
- if (typeof q !== 'number') {
- throw new TypeError('q must be a number');
- }
- const carg_q = q;
- // return: double
- const fn_ret = cephes._cephes_zeta(carg_x, carg_q);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/struve.c
- exports.struve = function struve(/* double */ v, /* double */ x) {
- // argument: double v
- if (typeof v !== 'number') {
- throw new TypeError('v must be a number');
- }
- const carg_v = v;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_struve(carg_v, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
- // from cephes/polevl.c
- exports.p1evl = function p1evl(/* double */ x, /* double[] */ coef, /* int */ N) {
- //Save the STACKTOP because the following code will do some stack allocs
- const stacktop = cephes.stackSave();
- // argument: double x
- if (typeof x !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // argument: double[] coef
- if (!(coef instanceof Float64Array)) {
- cephes.stackRestore(stacktop);
- throw new TypeError('coef must be either a Float64Array');
- }
- const carg_coef = cephes.stackAlloc(coef.length << 3);
- cephes.writeArrayToMemory(new Uint8Array(coef.buffer, coef.byteOffset, coef.byteLength), carg_coef);
- // argument: int N
- if (typeof N !== 'number') {
- cephes.stackRestore(stacktop);
- throw new TypeError('N must be a number');
- }
- const carg_N = N | 0;
- // return: double
- const fn_ret = cephes._cephes_p1evl(carg_x, carg_coef, carg_N);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- // Restore internal stacktop before returning
- cephes.stackRestore(stacktop);
- return ret;
- };
- // from cephes/polylog.c
- exports.polylog = function polylog(/* int */ n, /* double */ x) {
- // argument: int n
- if (typeof n !== 'number') {
- throw new TypeError('n must be a number');
- }
- const carg_n = n | 0;
- // argument: double x
- if (typeof x !== 'number') {
- throw new TypeError('x must be a number');
- }
- const carg_x = x;
- // return: double
- const fn_ret = cephes._cephes_polylog(carg_n, carg_x);
- // No pointers, so just return fn_ret
- const ret = fn_ret;
- return ret;
- };
|