Skip to content

Ignore ndigits passed to BigDecimal(string, ndigits)#385

Merged
tompng merged 1 commit intoruby:masterfrom
tompng:bigdecimal_str_ignore_dig
Jul 27, 2025
Merged

Ignore ndigits passed to BigDecimal(string, ndigits)#385
tompng merged 1 commit intoruby:masterfrom
tompng:bigdecimal_str_ignore_dig

Conversation

@tompng
Copy link
Member

@tompng tompng commented Jul 27, 2025

Fixes #355
Don't allocate huge memory when huge ndigits is passed.

Document:

/*
 *      # String does not require ndigits; ignored if given.
 *      BigDecimal('2')     # => 0.2e1
 *      BigDecimal('2.0')   # => 0.2e1
 *      BigDecimal('0.2e1') # => 0.2e1
 *      BigDecimal(' 2.0 ') # => 0.2e1
 */

Don't allocate huge memory when huge ndigits is passed
@tompng tompng merged commit 5d85778 into ruby:master Jul 27, 2025
79 checks passed
@tompng tompng deleted the bigdecimal_str_ignore_dig branch July 27, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BigDecimal(string, prec) can allocate huge memory

1 participant