From b6dab385dbf9a626970f3673d345d0e8e6a62e1e Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Thu, 5 Oct 2023 21:53:07 +0200 Subject: Rudimentary display of actual results --- src/comfy.odin | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/comfy.odin (limited to 'src/comfy.odin') 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 -- cgit v1.2.1