Skip to content

Commit 2d94117

Browse files
committed
CHANGE: allow to-decimal "1e"
related to: Oldes/Rebol-issues#956
1 parent 356292c commit 2d94117

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/core/l-types.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,9 @@ bad_hex: Trap0(RE_INVALID_CHARS);
303303
if (!dig) return 0;
304304
if (*cp == 'E' || *cp == 'e') {
305305
*ep++ = *cp++;
306-
dig = 0;
306+
dig = 1;
307307
if (*cp == '-' || *cp == '+') *ep++ = *cp++;
308-
while (IS_LEX_NUMBER(*cp)) *ep++ = *cp++, dig=1;
309-
if (!dig) return 0;
308+
while (IS_LEX_NUMBER(*cp)) *ep++ = *cp++;
310309
}
311310
if (*cp == '%') {
312311
if (dec_only) return 0;

src/tests/units/make-test.r3

+5
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ Rebol [
110110
--assert 0.0 = make 0.0 false
111111
--assert error? try [to decimal! true]
112112
--assert error? try [to decimal! false]
113+
--test-- "make decimal from string"
114+
;@@ https://github.com/Oldes/Rebol-issues/issues/956
115+
ch: copy ""
116+
repeat x 255 [unless error? try [to-decimal join "1" to-char x] [append ch to-char x]]
117+
--assert ch = "^- ',.0123456789Ee"
113118

114119
===end-group===
115120

0 commit comments

Comments
 (0)