From 546a5861526192a908f2aa2bfc3cfe4f3f3baf43 Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Sat, 31 May 2025 19:30:21 +0200 Subject: Proper constant parsing --- caux.sml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 caux.sml (limited to 'caux.sml') 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 -- cgit v1.2.3