lib-r-math.js
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -115,1 +115,5 @@ //park node crypto in diff namespace | ||
} | ||
export function unif_rand(){ | ||
return random2_64StepsAsFloat(); | ||
} |
@@ -55,4 +55,5 @@ /* | ||
export function chebyshev_init(dos: number[], nos: number, eta: number): number { | ||
let i: number, ii: number, | ||
err: number; | ||
let i: number; | ||
let ii: number; | ||
let err: number; | ||
@@ -59,0 +60,0 @@ |
@@ -1,3 +0,8 @@ | ||
export const sqrt = Math.sqrt; | ||
export const DBL_EPSILON = 1E-16; //true for javascript, this was tested | ||
export const sinh = Math.sinh; | ||
export const DBL_MAX = Number.MAX_VALUE; | ||
export const exp = Math.exp; | ||
export const sqxmin_BESS_K = 1.49e-154; | ||
export const xmax_BESS_K = 705.342;/* maximal x for UNscaled answer */ | ||
export const R_FINITE = (x: number) => Number.isFinite(x); | ||
@@ -13,12 +18,15 @@ export const NaN = Number.NaN; | ||
export const M_PI = 3.14159265358979323846264338327950288; | ||
export const M_LN_SQRT_2PI = 0.918938533204672741780329736406 // log(sqrt(2*pi)) | ||
export const M_LN_SQRT_PId2 = 0.225791352644727432363097614947 // log(sqrt(pi/2)) | ||
export const M_LN_SQRT_2PI = 0.918938533204672741780329736406; // log(sqrt(2*pi)) | ||
export const M_LN_SQRT_PId2 = 0.225791352644727432363097614947; // log(sqrt(pi/2)) | ||
export const R_D__0 = (log: boolean) => { return log ? ML_NEGINF : 0.0; }; | ||
export const floor = Math.floor; | ||
export const trunc = Math.trunc; | ||
export const M_SQRT_2dPI = 0.797884560802865355879892119869; // sqrt(2/pi) | ||
export enum ME { | ||
ME_NONE = 0,// no error | ||
ME_NONE = 0, // no error | ||
ME_DOMAIN = 1, // argument out of domain | ||
ME_RANGE = 2,// value out of range | ||
ME_NOCONV = 4,//process did not converge | ||
ME_PRECISION = 8,//does not have "full" precision | ||
ME_UNDERFLOW = 16// and underflow occured (important for IEEE) | ||
ME_RANGE = 2, // value out of range | ||
ME_NOCONV = 4, //process did not converge | ||
ME_PRECISION = 8, //does not have "full" precision | ||
ME_UNDERFLOW = 16 // and underflow occured (important for IEEE) | ||
} | ||
@@ -34,6 +42,12 @@ | ||
export const MATHLIB_WARNING4 = function (fmt: string, x: any, x2: any, x3: any, x4: any) { | ||
console.warn(fmt, x, x2, x3, x4); | ||
} | ||
export const ML_ERROR = (x: ME, s: any) => { | ||
if (x > ME.ME_DOMAIN) { | ||
let msg: string = ""; | ||
let msg: string; | ||
switch (x) { | ||
@@ -55,2 +69,4 @@ case ME.ME_DOMAIN: | ||
break; | ||
default: | ||
msg = ''; | ||
} | ||
@@ -57,0 +73,0 @@ MATHLIB_WARNING(msg, s); |
@@ -52,4 +52,4 @@ /* | ||
import { ME, ML_ERROR, ML_ERR_return_NAN } from "./general" | ||
import { chebyshev_eval } from "./chebyshev" | ||
import { ME, ML_ERROR, ML_ERR_return_NAN } from './general' | ||
import { chebyshev_eval } from './chebyshev'; | ||
@@ -56,0 +56,0 @@ const algmcs: number[] = [ |
{ | ||
"name": "lib-r-math.js", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "Javascript Pure Implementation of Statistical R \"core\" numerical libRmath.so", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,2 +20,5 @@ # libRmath.js | ||
|------------------|--------------------|-------------|--------------------| | ||
|sexp.c | ./sexp.ts| 8-feb-2017 | (Random variates from the standard exponential distribution) exp_rand (internally used) function | | ||
|dunif.c | ./dunif.ts| 8-feb-2017 | R "dunif" function | | ||
|bessel_k.c | ./bessel_k.ts| 8-feb-2017 | R "besselK" function http://www.netlib.org/specfun/rkbesl | | ||
|runif.c | ./runif.ts| 4-feb-2017 | implemented 3 RNG and native browser/node agnostic 64 RNG map to floating number | | ||
@@ -39,3 +42,3 @@ |bd0.c | ./lib/bd0.ts |23-jan-2017 | hidden, used by modules dbinom.c ,dpois.c dt.c | | ||
bessel_j.c | TODO | | | | ||
bessel_k.c | TODO | | | | ||
bessel_k.c | done | no | R "besselK" function http://www.netlib.org/specfun/rkbesl | | ||
bessel_y.c | TODO | | | | ||
@@ -66,3 +69,3 @@ beta.c |done ./lib/beta.ts | no | [beta](https://en.wikipedia.org/wiki/Beta_function) | | ||
dt.c |TODO | | | | ||
dunif.c | TODO| | | | ||
dunif.c | done| no | R "dunif" function | | ||
dweibull.c | TODO| | | | ||
@@ -151,3 +154,3 @@ expm1.c |TODO | | | | ||
rweibull.c | TODO| | | | ||
sexp.c |TODO | | | | ||
sexp.c | done | no | (Random variates from the standard exponential distribution) exp_rand (internally used) function | | ||
sign.c | TODO| | | | ||
@@ -154,0 +157,0 @@ signrank.c | TODO| | | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
129125
26
2513
159