Project

General

Profile

« Previous | Next » 

Revision 096f48d5

Added by Pierre-Loïc Garoche almost 3 years ago

Printing trailing zeros in real constants

View differences:

src/printers.ml
75 75
and pp_const fmt c = 
76 76
  match c with
77 77
    | Const_int i -> pp_print_int fmt i
78
    | Const_real (c, e, s) -> pp_print_string fmt s (*if e = 0 then pp_print_int fmt c else if e < 0 then Format.fprintf fmt "%ie%i" c (-e) else Format.fprintf fmt "%ie-%i" c e *)
78
    | Const_real (c, e, s) -> fprintf fmt "%s%s"
79
                                s
80
                                (if String.get s (-1 + String.length s) = '.' then "0" else "")
81
    (*if e = 0 then pp_print_int fmt c else if e < 0 then Format.fprintf fmt "%ie%i" c (-e) else Format.fprintf fmt "%ie-%i" c e *)
79 82
    (* | Const_float r -> pp_print_float fmt r *)
80 83
    | Const_tag  t -> pp_print_string fmt t
81 84
    | Const_array ca -> fprintf fmt "[%a]" (Utils.fprintf_list ~sep:"," pp_const) ca
......
360 363
let pp_spec_as_comment fmt (inl, outl, spec) =
361 364
  match spec with
362 365
  | Contract c -> (* should have been processed by now *)
363
     fprintf fmt "@[<hov 2>(*@@ ";
366
     fprintf fmt "@[<hov 2>(*@@ contract@ ";
364 367
     pp_spec fmt c;
365 368
     fprintf fmt "@]*)@ "
366 369
     

Also available in: Unified diff