Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 28055e17 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

lurette 0.88 Wed, 18 Sep 2002 17:14:51 +0200 by jahier

Parent-Version:      0.87
Version-Log:

Turn around the bug in sim2chro where it can not read floats such like 4.
(pb cause there is not digits...).

Project-Description: Lurette
parent 426e2bb8
;; -*- Prcs -*-
(Created-By-Prcs-Version 1 3 3)
(Project-Description "Lurette")
(Project-Version lurette 0 87)
(Parent-Version lurette 0 86)
(Project-Version lurette 0 88)
(Parent-Version lurette 0 87)
(Version-Log "
Save and restore sessions without messing up directory names
(namely, avoid name clashes in the /tmp dir).
Turn around the bug in sim2chro where it can not read floats such like 4.
(pb cause there is not digits...).
")
(New-Version-Log ""
)
(Checkin-Time "Wed, 18 Sep 2002 16:50:33 +0200")
(Checkin-Time "Wed, 18 Sep 2002 17:14:51 +0200")
(Checkin-Login jahier)
(Populate-Ignore ())
(Project-Keywords)
......@@ -41,7 +41,7 @@ Save and restore sessions without messing up directory names
(source/env.mli (lurette/15_env.mli 1.15 644))
(source/env.ml (lurette/16_env.ml 1.29 644))
(source/util.ml (lurette/35_util.ml 1.24 644))
(source/util.ml (lurette/35_util.ml 1.25 644))
(source/solver.mli (lurette/38_solver.mli 1.13 644))
(source/solver.ml (lurette/39_solver.ml 1.26 644))
......@@ -50,13 +50,13 @@ Save and restore sessions without messing up directory names
(source/rnumsolver.ml (lurette/b/27_rnumsolver 1.7 644))
(source/parse_env.mli (lurette/40_parse_env. 1.9 644))
(source/parse_env.ml (lurette/41_parse_env. 1.23 644))
(source/parse_env.ml (lurette/41_parse_env. 1.24 644))
(source/show_env.mli (lurette/42_show_env.m 1.7 644))
(source/show_env.ml (lurette/43_show_env.m 1.12 644))
(source/formula.mli (lurette/44_formula.ml 1.14 644))
(source/formula.ml (lurette/45_formula.ml 1.17 644))
(source/formula.ml (lurette/45_formula.ml 1.18 644))
(source/print.mli (lurette/46_print.mli 1.10 644))
(source/print.ml (lurette/47_print.ml 1.18 644))
......@@ -130,7 +130,7 @@ Save and restore sessions without messing up directory names
(test/heater_int.rif.exp (lurette/b/28_heater_int 1.6 644))
(test/ControleurPorte.rif.exp (lurette/b/29_Controleur 1.8 644))
(test/heater_float.rif.exp (lurette/b/30_heater_flo 1.6 644))
(test/heater_float.rif.exp (lurette/b/30_heater_flo 1.7 644))
(test/heater_int.lus (lurette/b/43_heater_int 1.1 644))
(test/heater_float.lus (lurette/b/44_heater_flo 1.1 644))
(test/test_gen_stubs.h (lurette/b/45_test_gen_s 1.1 644))
......
......@@ -105,7 +105,7 @@ let (num_value_to_string : num_value -> string) =
fun n ->
match n with
I(i) -> string_of_int i
| F(f) -> string_of_float f
| F(f) -> Util.my_string_of_float f
let (n_expr_to_string : n_expr -> string) =
fun ne ->
......@@ -159,7 +159,7 @@ and
| Ivar(str) -> str
| Fvar(str) -> str
| Ival(i) -> string_of_int i
| Fval(f) -> string_of_float f
| Fval(f) -> Util.my_string_of_float f
| Ite(f,e1,e2) -> ("(if " ^ (formula_to_string f) ^ " then " ^
(expr_to_string e1) ^ " else " ^
(expr_to_string e2) ^ ")")
......@@ -221,7 +221,7 @@ let (var_type_to_string2 : var_type -> string) =
let print_var_value oc e =
match e with
N(I(i)) -> output_string oc ((string_of_int i) ^ " ")
| N(F(f)) -> output_string oc ((string_of_float f) ^ " ")
| N(F(f)) -> output_string oc ((Util.my_string_of_float f) ^ " ")
| B(true) -> output_string oc "t "
| B(false) -> output_string oc "f "
......
......@@ -42,7 +42,7 @@ let print_genlex_token =
Genlex.Kwd(str) -> print_string (str ^ " \t(Kwd)")
| Genlex.Ident(str) -> print_string (str ^ " \t(Ident)")
| Genlex.Int(i) -> print_int i; print_string " \t(Int)"
| Genlex.Float(f) -> print_float f; print_string " \t(Float)"
| Genlex.Float(f) -> Util.my_print_float f; print_string " \t(Float)"
| Genlex.String(str) -> print_string (str ^ " \t(String)")
| Genlex.Char(c) -> print_char c ; print_string " \t(Char)"
in
......
......@@ -349,6 +349,34 @@ end
(****************************************************************************)
(*
I define my own version of print_float to turn around a bug (or is
it a bug in ocaml?) of sim2chro where it does not understand floats
without digit (e.g., 4. instead of 4.0)
*)
external string_length : string -> int = "%string_length"
external format_float: string -> float -> string = "format_float"
let my_string_of_float f =
let s = format_float "%.12g" f in
let l = string_length s in
let rec loop i =
if i >= l then s ^ ".0" else
(* ^^^ I have added a "0" there... *)
if s.[i] = '.' || s.[i] = 'e' then s
else loop (i+1)
in
loop 0
let my_print_float f = output_string stdout (my_string_of_float f)
(****************************************************************************)
(* XXX How can I dynamically choose among one of those ? *)
(* type sol_nb = Big_int.big_int *)
......
......@@ -7,9 +7,9 @@ U:real
Dudt:real
@#
#step 1
t #outs 17. 0.
t #outs 17.0 0.0
#step 2
t #outs 17. 1.11864266198
t #outs 17.0 1.11864266198
#step 3
t #outs 18.118642662 0.268765468415
#step 4
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment