diff options
Diffstat (limited to 'std')
| -rw-r--r-- | std/extern.sloth | 1 | ||||
| -rw-r--r-- | std/stdlib.c | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/std/extern.sloth b/std/extern.sloth index e99a6cc..89676c7 100644 --- a/std/extern.sloth +++ b/std/extern.sloth @@ -12,6 +12,7 @@ foreign fn slen(str: String) Int; foreign fn parse_int(str: String) Int; foreign fn termpos(x: Int, y: Int); foreign fn as_int(x: Float) Int; +foreign fn as_float(x: Int) Float; foreign fn istr(x: Int) String; foreign fn system(cmd: String) Int; foreign fn sequals(a: String, b: String) Bool; diff --git a/std/stdlib.c b/std/stdlib.c index ed848c3..8636f11 100644 --- a/std/stdlib.c +++ b/std/stdlib.c @@ -41,6 +41,9 @@ int as_int(float x) { return (int) x; } +float as_float(int x) { + return (float) x; +} bool sequals(char* a, char* b) { if (strlen(a) != strlen(b)) { return false; |
