summaryrefslogtreecommitdiff
path: root/ext/bigdecimal
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bigdecimal')
-rw-r--r--ext/bigdecimal/bigdecimal.c4
1 files changed, 3 insertions, 1 deletions
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 != '#') {