Skip to content
Snippets Groups Projects
Commit 15c82148 authored by Loïc Correnson's avatar Loïc Correnson
Browse files

[wp] extends force-float literals

parent 32e31b63
No related branches found
No related tags found
No related merge requests found
......@@ -196,12 +196,14 @@ let printers = [
Printf.sprintf "%.64g" ;
]
let re_int = Str.regexp "[0-9]+"
let re_int_float = Str.regexp "\\(-?[0-9]+\\)\\(e[+-]?[0-9]+\\)?$"
let force_float r =
if Str.string_match re_int r 0 &&
Str.match_end () = String.length r
then (r ^ ".0") else r
if Str.string_match re_int_float r 0
then
let group n r = try Str.matched_group n r with Not_found -> ""
in group 1 r ^ ".0" ^ group 2 r
else r
let float_lit ulp (q : Q.t) =
let v = match ulp with
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment