Commit graph

563 commits

Author SHA1 Message Date
Peter Zhu
64ab04da6a [ruby/bigdecimal] Clarify that JSON methods come from the JSON gem
581725d4e5
2023-12-06 16:14:54 +00:00
BurdetteLamar
dab5a4b61a [ruby/bigdecimal] [DOC] Add section Methods for Working with JSON
2edd8d0a23
2023-12-06 14:59:23 +00:00
Tim Kretschmer
e584a619e1 [ruby/bigdecimal] fixed docs for .scale
the scale of `1` is actually 0

9a8bc9c417
2023-11-07 05:35:18 +00:00
Koichi ITO
f0abe610a3 [ruby/bigdecimal] Update doc for bigdecimal/util
Follow up https://github.com/ruby/bigdecimal/issues/89.

`BigDecimal.new` has already been removed. This PR replaces `BigDecimal.new` with
`Kernel.BigDecimal` in the documentation, following the message below:

> BigDecimal.new is deprecated; use Kernel.BigDecimal method instead.

26d84ba766

dd52adf3b2
2023-11-07 05:32:49 +00:00
Nobuyoshi Nakada
e501613efa [ruby/bigdecimal] Bump up to 3.1.5
c47802e813
2023-10-04 02:50:15 +00:00
cryptogopher
5f07f78e86 [ruby/bigdecimal] Update to_s doc examples
8a94a29cf1
2023-07-05 20:15:53 +00:00
cryptogopher
10f59dcbcd [ruby/bigdecimal] Add .to_s('F') digit grouping for integer part
f63544d465
2023-07-05 20:15:52 +00:00
HoNooD
671cfc2000 [ruby/bigdecimal] fix: typo in document comments of f_BigDecimal function
13abe1fd78
2023-04-08 18:54:01 +00:00
Nobuyoshi Nakada
8ec95c6074 [ruby/bigdecimal] Remove set but unused variable
This `prec` has not been used since 1f5c46dbdd.

08a0ad563d
2023-04-08 18:53:28 +00:00
Matt Valentine-House
5e4b80177e Update the depend files 2023-02-28 09:09:00 -08:00
Matt Valentine-House
f38c6552f9 Remove intern/gc.h from Make deps 2023-02-27 10:11:56 -08:00
Nobuyoshi Nakada
0cde887eb9 [ruby/bigdecimal] Bump up to 3.1.4
ruby/bigdecimal#187 has changed a behavior and ruby/spec also needed a
follow up at 0d8ef62fc2.
However, because bigdecimal is a separate gem and can be updated in
older versions of ruby, `RUBY_VERSION` is not appropriate for this
guard.  That means it needs bumped up `BigDecimal::VERSION`.

3a2a7a9353
2023-02-21 15:35:40 +00:00
Benoit Daloze
7b768e4335 [ruby/bigdecimal] Move RB_GC_GUARD() at the end, like in BigMath_s_exp()
b66ef9fbb5
2023-02-21 14:24:13 +00:00
Benoit Daloze
5077cc2be6 [ruby/bigdecimal] Avoid RB_GC_GUARD(a) = b in bigdecimal
* This is not supported on TruffleRuby, which requires the value to be
  set before RB_GC_GUARD() is called.
* See https://github.com/oracle/truffleruby/pull/2879

7b2957922f
2023-02-21 14:24:12 +00:00
Nobuyoshi Nakada
d13879f862 [ruby/bigdecimal] Read version from bigdecimal.c
The dependency of extconf.h on bigdecimal.gemspec does not make sense
as far as no rule is defined for it.  Also, the relationship between
extension library and gemspec file is various in default gems, and
does not work well.

7f99b28552
2023-02-21 09:50:02 +00:00
Nobuyoshi Nakada
ba1b9d3104 [ruby/bigdecimal] Fix the license name [ci skip]
```
$ gem build bigdecimal.gemspec
WARNING:  license value 'BSD-2-clause' is invalid.  Use a license identifier from
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
Did you mean 'BSD-2-Clause'?
WARNING:  See https://guides.rubygems.org/specification-reference/ for help
```

36b77a2d2f
2023-02-19 09:58:31 +00:00
Charles Oliver Nutter
becec0001c [ruby/bigdecimal] Stub out extension build on JRuby
JRuby currently ships its own internal bigdecimal extension as
part of the core libraries. In order for users to be able to add
bigdecimal to their Gemfile or gem dependencies, we need to stub
out the C extension and just load the extension shipped with
JRuby.

In the future we will try to move our BigDecimal implementation
into the gem, but for now this is the simplest way to make it
installable on JRuby.

See #169

829956c643
2023-02-17 17:52:48 +00:00
Maciej Rzasa
36e3d46d35 [ruby/bigdecimal] Handle correctly #remainder with infinity. Fixes
https://github.com/ruby/bigdecimal/pull/187

4b8572d452
2023-02-17 17:46:27 +00:00
Nobuyoshi Nakada
899ea35035
Extract include/ruby/internal/attr/packed_struct.h
Split `PACKED_STRUCT` and `PACKED_STRUCT_UNALIGNED` macros into the
macros bellow:
* `RBIMPL_ATTR_PACKED_STRUCT_BEGIN`
* `RBIMPL_ATTR_PACKED_STRUCT_END`
* `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN`
* `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END`
2023-02-08 12:34:13 +09:00
Peter Zhu
aa222b56fa [ruby/bigdecimal] Make BigDecimal WB protected
BigDecimal has no references, so it is WB protected.

29c61c90e8
2023-02-01 15:59:11 +00:00
Nobuyoshi Nakada
69a2687a27 [ruby/bigdecimal] Fix format specifiers for size_t
99db3c9754
2023-01-07 03:15:27 +00:00
Hiroshi SHIBATA
fa865f5752 [ruby/bigdecimal] Bump version to 3.1.3
25a75c2033
2022-12-05 10:44:30 +00:00
Kenta Murata
c75de1e330 [ruby/bigdecimal] Add fallback definition of MAYBE_UNUSED
b2123faa52
2022-11-15 06:59:11 +00:00
Kenta Murata
3c60e030b5 [ruby/bigdecimal] Replace sprintf by snprintf
d6f5bb40c7
2022-11-15 04:02:01 +00:00
Kenta Murata
3147a3900f [ruby/bigdecimal] Mark some functions MAYBE_UNUSED
d70a4d53e5
2022-11-15 00:34:23 +00:00
Kenta Murata
8d82f4ba1c [ruby/bigdecimal] Add specific value allocators
* Add NewZero* and NewOne* function families
* Use them instead of VpAlloc for allocating 0 and 1

9276a94ac7
2022-11-13 12:33:29 +00:00
Kenta Murata
802dce4acd [ruby/bigdecimal] Add and use specific value allocators
* Add rbd_allocate_struct_zero for making 0.0
* Add rbd_allocate_struct_one for making 1.0
* Use them to replace VpAlloc calls
* Renmae VpPt5 to VpConstPt5

40c826f5e6
2022-11-13 06:01:27 +00:00
Kenta Murata
019f53de5c [ruby/bigdecimal] Make VPrint function always available
5391f7e92c
2022-11-13 06:01:27 +00:00
Kenta Murata
d1f55dea86 [ruby/bigdecimal] Tweak VpAlloc
* Stop reusing mx and mf
* Check szVal == NULL first
* Treat special values before checking the leading `#`

14f3d965f8
2022-11-13 04:29:19 +00:00
Kenta Murata
bbb9f72353 [ruby/bigdecimal] Rewrite allocation functions
* Rename them
* Make allocation count operations atomic

a5ab34a115
2022-11-13 03:47:40 +00:00
Kenta Murata
2703410289 [ruby/bigdecimal] Twak GetPrecisionInt and rename it to check_int_precision
69d0588a3b
2022-11-13 02:46:42 +00:00
Kenta Murata
ef1c6109b1 [ruby/bigdecimal] Tweak check_rounding_mode_option
e1c6c9be25
2022-11-13 02:02:02 +00:00
Kenta Murata
74c6e6e565 [ruby/bigdecimal] Rewrite check_rounding_mode function
Use table-lookup algorithm instead of consecutive if-statements.

23eaff3ae5
2022-11-13 02:02:01 +00:00
Kenta Murata
b89769b978 [ruby/bigdecimal] [Doc] Fix the document of n_significant_digits
91b72a9341
2022-11-13 02:02:00 +00:00
Kenta Murata
977aac057f [ruby/bigdecimal] Make GetVpValue inline
1b642e2e59
2022-11-13 02:02:00 +00:00
Kenta Murata
0d5248673d [ruby/bigdecimal] Make BigDecimal_double_fig inline
4ecf04da7a
2022-11-13 02:01:59 +00:00
Nobuyoshi Nakada
7ed10abdd9 [ruby/bigdecimal] Suppress macro redefinition warnings
`HAVE_` macros by autoconf are defined as 1.

cd35868aa6
2022-10-30 14:21:31 +00:00
Maciej Rzasa
b8e804e410 [ruby/bigdecimal] Document precision=0 and ndigits=0 for converting from Float
4f0894c6c0
2022-09-28 09:29:49 +09:00
Samuel Williams
a95b741a97 [ruby/bigdecimal] Remove trailing whitespace.
223d193f01
2022-09-25 19:34:27 +09:00
Maciek Rząsa
8e2c425183 [ruby/bigdecimal] Improve documentation of BigDecimal#sign
Fixes https://github.com/ruby/bigdecimal/issues/78 by describing behaviour for positive and negative zero in the docs.

5415b120ab
2022-09-25 16:51:17 +09:00
Peter Zhu
12889fad41 [ruby/bigdecimal] Remove symbol defs in missing.h for old Rubies
Commit 2885514 added these to support Ruby 2.1. The rb_sym2str function
is defined since Ruby 2.2.

be366c9cf2
2022-09-19 23:40:49 +09:00
Peter Zhu
a44f48cadc [ruby/bigdecimal] Remove array defs in missing.h for old Rubies
Commit 02b6053 added these to support Ruby 2.0.0. The rb_array_const_ptr
function is defined since Ruby 2.3.

678699ca1b
2022-09-19 23:40:48 +09:00
Thomas Winsnes
8a1be433e8 [ruby/bigdecimal] Updated to use the correct spec for muilti license
13165b29b8
2022-08-03 11:04:31 +09:00
Thomas Winsnes
f33b2ae918
Updated to use multiple licenses
Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
2022-08-03 11:04:20 +09:00
Nobuyoshi Nakada
673759328c [ruby/bigdecimal] Remove checks for struct RRational and struct RComplex
These are used to see only if `RRATIONAL` and `RCOMPLEX` are
available, however, these two are macros and can be checked with
`#ifdef` directly.

175bbacd43
2022-07-14 21:02:02 +09:00
BurdetteLamar
06f4ca503d [ruby/bigdecimal] Correct indentation in Kernel#BigDecimal
3ede8860a6
2022-07-02 07:58:20 +09:00
Peter Zhu
c69bdcf80c [ruby/bigdecimal] Fix docs
rdoc parses f[i] as a link, which results in a broken link.

a18522e9ca
2022-04-18 10:29:25 +09:00
Nobuyoshi Nakada
92361ad9c6 [ruby/bigdecimal] Adjust a local variable type to exponent
70146fb6ad
2022-04-18 10:29:23 +09:00
Peter Zhu
2d5ecd60a5 [Feature #18249] Update dependencies 2022-02-22 09:55:21 -05:00
Kenta Murata
328e6bf3b3
[ruby/bigdecimal] Version 3.1.2
57e2194135
2022-01-24 10:56:37 +09:00