diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2012-11-03 10:36:15 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2012-11-03 10:36:15 +0000 |
commit | dcb9f48f51cec5e864565862a700c27df2a1a7e6 (patch) | |
tree | b453b51b7406d3b1cf7191729637446a23ffc92c /cparser/Cprint.ml | |
parent | bd93aa7ef9c19a4def8aa64c32faeb04ab2607e9 (diff) | |
download | compcert-kvx-dcb9f48f51cec5e864565862a700c27df2a1a7e6.tar.gz compcert-kvx-dcb9f48f51cec5e864565862a700c27df2a1a7e6.zip |
Flocq-based parsing of floating-point literals (Jacques-Henri Jourdan)
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2065 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cparser/Cprint.ml')
-rw-r--r-- | cparser/Cprint.ml | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/cparser/Cprint.ml b/cparser/Cprint.ml index 2924c3d4..2548f3b9 100644 --- a/cparser/Cprint.ml +++ b/cparser/Cprint.ml @@ -45,16 +45,16 @@ let const pp = function | IUInt -> fprintf pp "U" | _ -> () end - | CFloat(v, fk, s) -> - if s <> "" then - fprintf pp "%s" s - else begin - fprintf pp "%.18g" v; - match fk with - | FFloat -> fprintf pp "F" - | FLongDouble -> fprintf pp "L" - | _ -> () - end + | CFloat(v, fk) -> + if v.hex then + fprintf pp "0x%s.%sP%s" v.intPart v.fracPart v.exp + else + fprintf pp "%s.%sE%s" v.intPart v.fracPart v.exp; + begin match fk with + | FFloat -> fprintf pp "F" + | FLongDouble -> fprintf pp "L" + | FDouble -> () + end | CStr s -> fprintf pp "\""; for i = 0 to String.length s - 1 do |