Initial commit
Test (in pplus-core) / in-core (push) Failing after 28m44s

This commit is contained in:
alexm committed 2026-11-12 22:23:48 -05:00
commit 568474d52f
1591 files changed
+528213

No files matched your search

@@ -0,0 +1,25 @@
// Number bases: a STRING of digits read left to right, and the reverse with DIV and MOD.
// EXPECT: 13
// EXPECT: 1101
FUNCTION FROM_BINARY(S : STRING) RETURNS INTEGER
DECLARE V : INTEGER
V <- 0
FOR EACH C IN S
V <- V * 2 + TO_INTEGER(C)
NEXT C
RETURN V
ENDFUNCTION
FUNCTION TO_BINARY(N : INTEGER) RETURNS STRING
REQUIRE N >= 1
DECLARE S : STRING
DECLARE M : INTEGER
S <- ""
M <- N
WHILE M > 0
S <- TO_STRING(M MOD 2) & S
M <- M DIV 2
ENDWHILE
RETURN S
ENDFUNCTION
OUTPUT FROM_BINARY("1101")
OUTPUT TO_BINARY(13)