summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/bigdecimal/bigdecimal.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a08a2a4..53fc83d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Nov 21 21:40:00 2013 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (VpAlloc): Fix the expr to adjust the size
+ of the digit array.
+
Thu Nov 21 21:36:00 2013 Kenta Murata <mrkn@mrkn.jp>
* ext/bigdecimal/bigdecimal.c (BigDecimal_sqrt): Fix the precision of
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 53efafd..5333332 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -3816,7 +3816,9 @@ VpAlloc(size_t mx, const char *szVal)
size_t mf = VpGetPrecLimit();
VALUE buf;
- mx = (mx + BASE_FIG - 1) / BASE_FIG + 1; /* Determine allocation unit. */
+ mx = (mx + BASE_FIG - 1) / BASE_FIG; /* Determine allocation unit. */
+ if (mx == 0) ++mx;
+
if (szVal) {
while (ISSPACE(*szVal)) szVal++;
if (*szVal != '#') {