aboutsummaryrefslogtreecommitdiff
path: root/src/gleam_stdlib.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/gleam_stdlib.js')
-rw-r--r--src/gleam_stdlib.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gleam_stdlib.js b/src/gleam_stdlib.js
index a60b361..95fb526 100644
--- a/src/gleam_stdlib.js
+++ b/src/gleam_stdlib.js
@@ -36,8 +36,17 @@ export function parse_float(value) {
}
}
-export function to_string(int) {
- return int.toString();
+export function to_string(term) {
+ return term.toString();
+}
+
+export function float_to_string(float) {
+ let string = float.toString();
+ if (string.indexOf(".") >= 0) {
+ return string;
+ } else {
+ return string + ".0";
+ }
}
export function int_to_base_string(int, base) {