dec_number 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/dec_number.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s| # -*-ruby-*-
2
2
  s.name = "dec_number"
3
- s.version = '0.1.0'
3
+ s.version = '0.1.1'
4
4
  s.authors = ["Paris Sinclair"]
5
5
  s.email = ["paris@rubypanther.com"]
6
6
  s.summary = "ICU-decNumber wrapper for arbitrary precision math with context objects"
@@ -1,4 +1,4 @@
1
1
  ## -*-Ruby-*-
2
2
  source 'http://rubygems.org'
3
- gem 'mkmfmf'
4
- gem 'core-source'
3
+ gemspec
4
+
@@ -411,15 +411,20 @@ static VALUE num_modulo(VALUE self, VALUE rval) {
411
411
  static VALUE num_round(int argc, VALUE *argv, VALUE self) {
412
412
  VALUE result, rval;
413
413
  decContext *context_ptr;
414
- decNumber *self_ptr, *result_ptr;
415
- dec_num_setup( result, self, result_ptr, self_ptr, context_ptr );
416
-
414
+ decNumber *self_ptr, *result_ptr, *rval_ptr;
417
415
  rb_scan_args( argc, argv, "01", &rval );
418
- if ( !NIL_P( rval ) ) {
419
- context_ptr->digits = NUM2INT( rb_funcall( rval, rb_intern("to_i"), 0 ) );
416
+ if ( NIL_P( rval ) ) {
417
+ rval = INT2FIX( 0 );
418
+ } else { // probably not necessary
419
+ if ( ! rb_obj_is_kind_of( rval, cDecNumber ) ) {
420
+ rval = rb_funcall( rval, rb_intern("to_i"), 0 );
421
+ }
420
422
  }
421
423
 
422
- decNumberToIntegralValue( result_ptr, self_ptr, context_ptr);
424
+ dec_num_setup_rval( result, self, rval, result_ptr, self_ptr, rval_ptr, context_ptr );
425
+
426
+ decNumberMinus( rval_ptr, rval_ptr, context_ptr);
427
+ decNumberRescale( result_ptr, self_ptr, rval_ptr, context_ptr);
423
428
  return result;
424
429
  }
425
430
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dec_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -82,7 +82,6 @@ files:
82
82
  - ext/dec_number/decNumber/decSingle.h
83
83
  - ext/dec_number/decNumber/decCommon.c
84
84
  - ext/dec_number/decNumber/decimal128.c
85
- - dec_number-0.0.0.gem
86
85
  - dec_number.gemspec
87
86
  - README
88
87
  homepage: http://github.com/rubypanther/dec_number
data/dec_number-0.0.0.gem DELETED
Binary file