ruby_native_statistics 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e02c85ccefb4607536d9be8484cb2925360d14df3d13c0b8181b1109daec3148
4
- data.tar.gz: 8aeb0ebb62119163f771f470ab1d0f512cd2b1ed812e1c629fba2075002c78ca
3
+ metadata.gz: af6f814231417189ed6603a5d1720773ece2f00c4933b09e82e5bd048cffab1c
4
+ data.tar.gz: 8084a6f089db196e31912467dd5e2d66d4ff8f67f0d8aa0997fd49435328cd4f
5
5
  SHA512:
6
- metadata.gz: d3b7bf0d8dfa816b30e3e5230efade5d7ec3c89b301c9d344c6a5d7287710b23c7239df82239350917faba1fa4979cd403b0cc3c1968511e158fd2f6746523d4
7
- data.tar.gz: 969154e141ea33684e3080bb5189f349393f4ad11956d911e60c0b8cbd46476f3acf148ea81aa28917fa78a3281c6ff3f8d0c614960df696826095fe5759a349
6
+ metadata.gz: 4db606d6948a7d0c36cd3735d1dd08071acd00ee682e5ce85d49dcc8b01359fafe95e50a7d4ac5a3c5137531f118de6173a607e96ede09956092d05c8bcb5518
7
+ data.tar.gz: 127c3d4c7d540f298890c49e1cb3a88679a5a47a1747877a8467ddce6f1bc98d1c723c6f6eed8fc944498bbb5b9bb380238755daf244b94cce1bd101d47a9098
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_native_statistics (1.0.2)
4
+ ruby_native_statistics (1.1.0)
5
5
  rake-compiler (~> 1.2)
6
6
 
7
7
  GEM
data/changelog.md CHANGED
@@ -1,3 +1,7 @@
1
+ # Version 1.1.0
2
+
3
+ - Fix percentile bug reported by @Gbird22
4
+
1
5
  # Version 1.0.3
2
6
 
3
7
  - Update all supported Ruby versions
@@ -1,4 +1,5 @@
1
1
  #include "conversions.h"
2
+ #include "float.h"
2
3
 
3
4
  int compare_doubles(const void *a, const void *b)
4
5
  {
@@ -8,7 +9,17 @@ int compare_doubles(const void *a, const void *b)
8
9
  double cmp_a = *dbl_a;
9
10
  double cmp_b = *dbl_b;
10
11
 
11
- return (cmp_a - cmp_b);
12
+ if (fabs(cmp_a - cmp_b) <= (DBL_EPSILON * fabs(cmp_a + cmp_b)))
13
+ {
14
+ return 0;
15
+ }
16
+
17
+ if (cmp_a > cmp_b)
18
+ {
19
+ return 1;
20
+ }
21
+
22
+ return -1;
12
23
  }
13
24
 
14
25
  double *sorted_ruby_array(VALUE array, long array_length)
@@ -20,7 +31,7 @@ double *sorted_ruby_array(VALUE array, long array_length)
20
31
 
21
32
  if (working_array == NULL)
22
33
  {
23
- rb_raise(rb_eStandardError, "unknown problem calculating median (possibly array is too large)");
34
+ rb_raise(rb_eStandardError, "unknown problem sorting array (possibly array is too large)");
24
35
  }
25
36
 
26
37
  for (i = 0; i < array_length; i++)
@@ -1,3 +1,3 @@
1
1
  module RubyNativeStatistics
2
- VERSION = "1.0.3"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_native_statistics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cory Buecker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-28 00:00:00.000000000 Z
11
+ date: 2024-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  requirements: []
134
- rubygems_version: 3.5.5
134
+ rubygems_version: 3.5.6
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: High performance, native (C) implementations of various statistical functions.