stat_c 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/ext/stat_c/stat_c.c +6 -3
- data/lib/stat_c/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd7506aea370251a6f91d5e6b6dd7dec6f8e6662
|
4
|
+
data.tar.gz: 17bc1d29da62b1a7308c054d832a089cc0ae4d2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07d8a9391e1c0c24bc8f52fd85019996e3fde773fb6e4c487d0656ce4b7d2039d117b1b424941c2fb405a21866c7fefc2c09465d2cb371235af43c1aa5c7528c
|
7
|
+
data.tar.gz: 6b374a44fa989f01c1c6369c6358b3255418325500a11ea80855226e147a796e338e05bf6d3399ec2a7cbc57fb75c44f3132c062a237f00be72451efc08b96ca
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# StatC
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/stat_c.svg)](https://badge.fury.io/rb/stat_c) [![Build Status](https://travis-ci.org/mooreryan/stat_c.svg?branch=master)](https://travis-ci.org/mooreryan/stat_c) [![Coverage Status](https://coveralls.io/repos/github/mooreryan/stat_c/badge.svg?branch=master)](https://coveralls.io/github/mooreryan/stat_c?branch=master)
|
4
|
+
|
3
5
|
Fast, well documented C stats extension for Ruby.
|
4
6
|
|
5
7
|
## Installation
|
data/ext/stat_c/stat_c.c
CHANGED
@@ -67,7 +67,8 @@ static VALUE sc_mean(VALUE obj, VALUE ary)
|
|
67
67
|
|
68
68
|
unsigned long i = 0;
|
69
69
|
long double sum = 0;
|
70
|
-
size_t len =
|
70
|
+
size_t len = 0;
|
71
|
+
len = assert_array_not_empty(ary);
|
71
72
|
|
72
73
|
for (i = 0; i < len; ++i) {
|
73
74
|
sum += NUM2DBL(rb_ary_entry(ary, i));
|
@@ -105,7 +106,8 @@ static VALUE sc_var(int argc, VALUE* argv, VALUE obj)
|
|
105
106
|
|
106
107
|
unsigned long i = 0;
|
107
108
|
long double sum = 0;
|
108
|
-
size_t len =
|
109
|
+
size_t len = 0;
|
110
|
+
len = assert_array_not_empty(ary);
|
109
111
|
|
110
112
|
long double mean = NUM2DBL(sc_mean(obj, ary));
|
111
113
|
|
@@ -177,7 +179,8 @@ static VALUE sc_se(int argc, VALUE* argv, VALUE obj)
|
|
177
179
|
|
178
180
|
long double sd = NUM2DBL(sc_sd(argc, argv, obj));
|
179
181
|
|
180
|
-
size_t len =
|
182
|
+
size_t len = 0;
|
183
|
+
len = assert_array_not_empty(ary);
|
181
184
|
|
182
185
|
return DBL2NUM(sd / sqrt(len));
|
183
186
|
}
|
data/lib/stat_c/version.rb
CHANGED