Project

General

Profile

« Previous | Next » 

Revision 9a3c3d8f

Added by Pierre-Loïc Garoche over 7 years ago

on joue avec l'affiche des floats

View differences:

src/plugins/salsa/machine_salsa_opt.ml
1

  
2 1
(* We try to avoid opening modules here *)
3 2
module ST = Salsa.SalsaTypes
4 3
module SDT = SalsaDatatypes
......
92 91
    | LT.LocalVar v
93 92
    | LT.StateVar v -> 
94 93
      if not (Vars.mem v printed_vars) && 
95
	(* TODO xAvier: comment recuperer le type de l'expression? Parfois e.value_type vaut 'd *)
96 94
	(Types.is_real_type e.LT.value_type ||  Types.is_real_type v.LT.var_type) 
97 95
      then
98 96
	opt_num_expr ranges formalEnv e 
src/plugins/salsa/salsaDatatypes.ml
111 111
  let pp fmt (f,r) = 
112 112
    match f, r with
113 113
    | ST.I(a,b), ST.J(c,d) ->
114
      Format.fprintf fmt "[%f, %f] + [%e, %e]" a b c d
114
      Format.fprintf fmt "[%.50f, %.50f] + [%.50e, %.50e]" a b c d
115 115
    | ST.I(a,b), ST.JInfty ->  Format.fprintf fmt "[%f, %f] + oo" a b 
116 116
    | ST.Empty, _ -> Format.fprintf fmt "???"
117 117

  
......
251 251
env
252 252

  
253 253
let rec salsa_expr2value_t vars_env cst_env e  = 
254
  let e =   Float.evalPartExpr e [] [] in
254 255
  let salsa_expr2value_t = salsa_expr2value_t vars_env cst_env in
255 256
  let binop op e1 e2 t = 
256 257
    let x = salsa_expr2value_t e1 in
......
273 274
	let s = 
274 275
	  if new_float = 0. then "0." else
275 276
	    (* We have to convert it into our format: int * int * real *)
277
	    (* string_of_float new_float *) 
276 278
	    let _ = Format.flush_str_formatter () in
277
	    Format.fprintf Format.str_formatter "%.50f" new_float;
278
	    Format.flush_str_formatter () 
279
	    Format.fprintf Format.str_formatter "%.11f" new_float;
280
	    Format.flush_str_formatter ()  
279 281
	in
280 282
	Parser_lustre.signed_const Lexer_lustre.token (Lexing.from_string s) 
281 283
      in
......
310 312
  | _      -> raise (Salsa.Prelude.Error "Entschuldigung, salsaExpr2value_t case not yet implemented")
311 313

  
312 314

  
315

  
313 316
let rec get_salsa_free_vars vars_env constEnv absenv e =
314 317
  let f = get_salsa_free_vars vars_env constEnv absenv in
315 318
  match e with

Also available in: Unified diff