aboutsummaryrefslogtreecommitdiff
path: root/src/comfy.odin
diff options
context:
space:
mode:
Diffstat (limited to 'src/comfy.odin')
-rw-r--r--src/comfy.odin17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/comfy.odin b/src/comfy.odin
new file mode 100644
index 0000000..e7ef23c
--- /dev/null
+++ b/src/comfy.odin
@@ -0,0 +1,17 @@
+package main
+
+import "core:strings"
+import "core:strconv"
+
+f64_to_cstring :: proc(f: f64) -> cstring {
+ buf: [20]byte
+ result := strconv.ftoa(buf[:], f, 'f', 2, 64)
+
+ if f > 0 {
+ result = string(buf[1:])
+ }
+
+ output : cstring = strings.clone_to_cstring(string(result))
+
+ return output
+} \ No newline at end of file