-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstd.ox
39 lines (31 loc) · 983 Bytes
/
std.ox
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
let LOOK_LEN = 12
fn to_string(x: Number)
let out = ""
for (i in 0..LOOK_LEN)
let i = LOOK_LEN - 1 - i
let pos_value = 1
for (j in 0..i)
mut pos_value = pos_value * 10
#for
let shifted = x / pos_value
if (shifted >= 1)
let num = shifted % 10
let d_from_floor = num % 1
let floored = num - d_from_floor
if (floored == 0) mut out += "0" #if
if (floored == 1) mut out += "1" #if
if (floored == 2) mut out += "2" #if
if (floored == 3) mut out += "3" #if
if (floored == 4) mut out += "4" #if
if (floored == 5) mut out += "5" #if
if (floored == 6) mut out += "6" #if
if (floored == 7) mut out += "7" #if
if (floored == 8) mut out += "8" #if
if (floored == 9) mut out += "9" #if
#if
#for
out
#fn
fn print(x: String)
$builtin.print(x)
#fn