summaryrefslogtreecommitdiff
path: root/caux.sml
diff options
context:
space:
mode:
authorVladimir Azarov <avm@intermediate-node.net>2025-05-31 19:30:21 +0200
committerVladimir Azarov <avm@intermediate-node.net>2025-05-31 19:30:38 +0200
commit546a5861526192a908f2aa2bfc3cfe4f3f3baf43 (patch)
treeacfe627e088bdba54a42e786d3b6b7053ec56fca /caux.sml
parent868e6313e3824d68b3121c5c95c7f29bc088c0e9 (diff)
Proper constant parsing
Diffstat (limited to 'caux.sml')
-rw-r--r--caux.sml16
1 files changed, 16 insertions, 0 deletions
diff --git a/caux.sml b/caux.sml
new file mode 100644
index 0000000..9c5b1c9
--- /dev/null
+++ b/caux.sml
@@ -0,0 +1,16 @@
+local
+ fun parse parse_fp repr =
+ let
+ val status = ref 0
+ val result = parse_fp (repr ^ str #"\000", status)
+ in
+ (!status, result)
+ end
+
+ val parse_float = _import "parse_float": string * int ref -> Real32.real;
+ val parse_double =
+ _import "parse_float": string * int ref -> Real64.real;
+in
+ val parseFloat = parse parse_float
+ val parseDouble = parse parse_double
+end