[Pkg-javascript-commits] [science.js] 41/87: Add missing science.ascending.
bhuvan krishna
bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:11:57 UTC 2016
This is an automated email from the git hooks/post-receive script.
bhuvan-guest pushed a commit to branch master
in repository science.js.
commit 46bb7eb47701023477683f86af689734c5f673e8
Author: Jason Davies <jason at jasondavies.com>
Date: Fri Sep 9 23:33:21 2011 +0100
Add missing science.ascending.
---
Makefile | 1 +
science.js | 3 +++
science.min.js | 2 +-
src/core/ascending.js | 3 +++
test/core/ascending-test.js | 18 ++++++++++++++++++
test/stats/bandwidth-test.js | 4 ++--
6 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index f53b53b..ad7b1c4 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,7 @@ all: \
science.core.js: \
src/core/core.js \
+ src/core/ascending.js \
src/core/constants.js \
src/core/expm1.js \
src/core/functor.js \
diff --git a/science.js b/science.js
index a85ed9a..55b9447 100644
--- a/science.js
+++ b/science.js
@@ -1,4 +1,7 @@
(function(){science = {version: "1.6.0"}; // semver
+science.ascending = function(a, b) {
+ return a - b;
+};
// Euler's constant.
science.EULER = .5772156649015329;
// Compute exp(x) - 1 accurately for small x.
diff --git a/science.min.js b/science.min.js
index b58bbb3..7e4b669 100644
--- a/science.min.js
+++ b/science.min.js
@@ -1 +1 @@
-(function(){science={version:"1.6.0"},science.EULER=.5772156649015329,science.expm1=function(a){return a<1e-5&&a>-0.00001?a+.5*a*a:Math.exp(a)-1},science.functor=function(a){return typeof a=="function"?a:function(){return a}},science.hypot=function(a,b){a=Math.abs(a),b=Math.abs(b);var c,d;a>b?(c=a,d=b):(c=b,d=a);var e=d/c;return c*Math.sqrt(1+e*e)},science.quadratic=function(){function b(b,c,d){var e=c*c-4*b*d;if(e>0){e=Math.sqrt(e)/(2*b);return a?[{r:-c-e,i:0},{r:-c+e,i:0}]:[-c-e,-c+e]} [...]
\ No newline at end of file
+(function(){science={version:"1.6.0"},science.ascending=function(a,b){return a-b},science.EULER=.5772156649015329,science.expm1=function(a){return a<1e-5&&a>-0.00001?a+.5*a*a:Math.exp(a)-1},science.functor=function(a){return typeof a=="function"?a:function(){return a}},science.hypot=function(a,b){a=Math.abs(a),b=Math.abs(b);var c,d;a>b?(c=a,d=b):(c=b,d=a);var e=d/c;return c*Math.sqrt(1+e*e)},science.quadratic=function(){function b(b,c,d){var e=c*c-4*b*d;if(e>0){e=Math.sqrt(e)/(2*b);retur [...]
\ No newline at end of file
diff --git a/src/core/ascending.js b/src/core/ascending.js
new file mode 100644
index 0000000..130b2b4
--- /dev/null
+++ b/src/core/ascending.js
@@ -0,0 +1,3 @@
+science.ascending = function(a, b) {
+ return a - b;
+};
diff --git a/test/core/ascending-test.js b/test/core/ascending-test.js
new file mode 100644
index 0000000..99eab9a
--- /dev/null
+++ b/test/core/ascending-test.js
@@ -0,0 +1,18 @@
+require("../../science");
+
+var vows = require("vows"),
+ assert = require("assert");
+
+var suite = vows.describe("science.ascending");
+
+suite.addBatch({
+ "ascending": {
+ "simple": function() {
+ var a = [1, 4, 5, 2, 3, 6];
+ a.sort(science.ascending);
+ assert.deepEqual(a, [1, 2, 3, 4, 5, 6]);
+ }
+ }
+});
+
+suite.export(module);
diff --git a/test/stats/bandwidth-test.js b/test/stats/bandwidth-test.js
index 69aa4f2..ebc450a 100644
--- a/test/stats/bandwidth-test.js
+++ b/test/stats/bandwidth-test.js
@@ -9,12 +9,12 @@ var suite = vows.describe("science.stats.bandwidth");
suite.addBatch({
"bandwidth": {
"nrd0": function() {
- var data = [1, 2, 3, 4];
+ var data = [1, 4, 3, 2];
assert.equal(science.stats.bandwidth.nrd0(data),
.7635139420854616);
},
"nrd": function() {
- var data = [1, 2, 3, 4];
+ var data = [1, 4, 3, 2];
assert.equal(science.stats.bandwidth.nrd(data),
.899249754011766);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/science.js.git
More information about the Pkg-javascript-commits
mailing list