Skip to content

Commit 700bd55

Browse files
Fix minor stdlib bugs.
1 parent a25c86e commit 700bd55

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/numbers.pre

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ MAP: rev = INV(digits) # reverse mapping of digits
7575

7676
FUNC VALUE(STR: num, INT: base):INT{
7777
IF(GT(base, 1000000)){
78-
THROW("Base ", STR(base), " not supported. Max base is 1,000,000")
78+
THROW("Base ", STR(base), " not supported. Max base is 0b1000000")
7979
}
8080
INT: value = 0
8181
# Support optional leading '-' for negative values. Detect the minus
@@ -97,7 +97,9 @@ FUNC VALUE(STR: num, INT: base):INT{
9797
ADD(@value, MUL(digits<digit>, POW(base, idx)))
9898
# compute internal binary value as digit*base^(position from right)
9999
}
100-
DEL(digit)
100+
IF(GT(SLEN(s), 0)){
101+
DEL(digit)
102+
}
101103
IF(EQ(neg, 1)){
102104
MUL(@value, -1)
103105
}
@@ -217,4 +219,4 @@ INT: decimal = 1010
217219
INT: hexadecimal = 10000
218220
INT: duotrigesimal = 100000
219221
INT: base32 = duotrigesimal
220-
INT: base64 = 1000000
222+
INT: base64 = 1000000

lib/prng.pre

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ FUNC RANGE_MIN_MAX(INT: min, INT: max):INT{
3535
ASSERT( GT(range, 0) )
3636
INT: offset = RANGE(range)
3737
RETURN( ADD(offset, min) )
38-
}
38+
}

0 commit comments

Comments
 (0)