🐐 NVLLVUS fix
This commit is contained in:
@@ -133,8 +133,11 @@ def int_to_num(n, m, s=False) -> str:
|
||||
for i in thousands_chars
|
||||
])
|
||||
|
||||
return thousands + int_to_num(n % 1000, m, s)
|
||||
remainder = n % 1000
|
||||
return thousands + (int_to_num(remainder, m, s) if remainder else "")
|
||||
else:
|
||||
if n == 0:
|
||||
return "NVLLVS"
|
||||
nums = []
|
||||
while n > 0:
|
||||
for num, i in list(NUMERALS.items())[::-1]:
|
||||
@@ -779,8 +782,14 @@ class BinOp(Node):
|
||||
raise CentvrionError("Cannot compare strings or arrays with PLVS")
|
||||
return vtable, ValBool((lv or 0) > (rv or 0))
|
||||
case "KEYWORD_EST":
|
||||
if ((isinstance(left, ValInt) and lv == 0 and isinstance(right, ValNul)) or
|
||||
(isinstance(left, ValNul) and isinstance(right, ValInt) and rv == 0)):
|
||||
return vtable, ValBool(True)
|
||||
return vtable, ValBool(lv == rv)
|
||||
case "KEYWORD_DISPAR":
|
||||
if ((isinstance(left, ValInt) and lv == 0 and isinstance(right, ValNul)) or
|
||||
(isinstance(left, ValNul) and isinstance(right, ValInt) and rv == 0)):
|
||||
return vtable, ValBool(False)
|
||||
return vtable, ValBool(lv != rv)
|
||||
case "KEYWORD_ET":
|
||||
return vtable, ValBool(bool(left) and bool(right))
|
||||
|
||||
@@ -177,8 +177,12 @@ static void transform_thousands(const char *src, char *dst, size_t dstsz) {
|
||||
}
|
||||
|
||||
void cent_int_to_roman(long n, char *buf, size_t bufsz) {
|
||||
if (n <= 0 || (n > 3999 && !cent_magnvm))
|
||||
cent_runtime_error("number out of range for Roman numerals (1-3999)");
|
||||
if (n == 0) {
|
||||
if (bufsz > 6) { memcpy(buf, "NVLLVS", 6); buf[6] = '\0'; }
|
||||
return;
|
||||
}
|
||||
if (n < 0 || (n > 3999 && !cent_magnvm))
|
||||
cent_runtime_error("number out of range for Roman numerals");
|
||||
size_t pos = 0;
|
||||
if (n > 3999) {
|
||||
char base[64];
|
||||
@@ -480,6 +484,9 @@ CentValue cent_mod_frac(CentValue a, CentValue b) {
|
||||
}
|
||||
|
||||
CentValue cent_eq(CentValue a, CentValue b) {
|
||||
if ((a.type == CENT_INT && a.ival == 0 && b.type == CENT_NULL) ||
|
||||
(a.type == CENT_NULL && b.type == CENT_INT && b.ival == 0))
|
||||
return cent_bool(1);
|
||||
if ((a.type == CENT_INT || a.type == CENT_FRAC) &&
|
||||
(b.type == CENT_INT || b.type == CENT_FRAC)) {
|
||||
long an, ad, bn, bd;
|
||||
|
||||
Reference in New Issue
Block a user