Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 101 lines (86 sloc) 3.62 kb
877a272 Portage de libnum pour Caml Special Light
xleroy authored
1 (***********************************************************************)
2 (* *)
6cd742a renaming of Objective Caml to OCaml and cleanup of copyright headers
doligez authored
3 (* OCaml *)
877a272 Portage de libnum pour Caml Special Light
xleroy authored
4 (* *)
5 (* Valerie Menissier-Morain, projet Cristal, INRIA Rocquencourt *)
6 (* *)
11d8fff Renommage en Objective Caml
xleroy authored
7 (* Copyright 1996 Institut National de Recherche en Informatique et *)
06a1e11 Changement de la licence
xleroy authored
8 (* en Automatique. All rights reserved. This file is distributed *)
0357d04 MAJ en-tetes pour mentionner la 'special exception' sur la LGPL
xleroy authored
9 (* under the terms of the GNU Library General Public License, with *)
10 (* the special exception on linking described in file ../../LICENSE. *)
877a272 Portage de libnum pour Caml Special Light
xleroy authored
11 (* *)
12 (***********************************************************************)
13
14 (* $Id$ *)
15
16 open Arith_flags;;
17
18 let get_error_when_null_denominator () =
e7d6b93 clean up spaces and tabs
doligez authored
19 !error_when_null_denominator_flag
877a272 Portage de libnum pour Caml Special Light
xleroy authored
20 and set_error_when_null_denominator choice =
21 error_when_null_denominator_flag := choice;;
22
e7d6b93 clean up spaces and tabs
doligez authored
23 let get_normalize_ratio () = !normalize_ratio_flag
24 and set_normalize_ratio choice = normalize_ratio_flag := choice;;
877a272 Portage de libnum pour Caml Special Light
xleroy authored
25
e7d6b93 clean up spaces and tabs
doligez authored
26 let get_normalize_ratio_when_printing () =
877a272 Portage de libnum pour Caml Special Light
xleroy authored
27 !normalize_ratio_when_printing_flag
e7d6b93 clean up spaces and tabs
doligez authored
28 and set_normalize_ratio_when_printing choice =
29 normalize_ratio_when_printing_flag := choice;;
877a272 Portage de libnum pour Caml Special Light
xleroy authored
30
31 let get_floating_precision () = !floating_precision
32 and set_floating_precision i = floating_precision := i;;
33
34 let get_approx_printing () = !approx_printing_flag
35 and set_approx_printing b = approx_printing_flag := b;;
36
37 let arith_print_string s = print_string s; print_string " --> ";;
38
39 let arith_print_bool = function
40 true -> print_string "ON"
41 | _ -> print_string "OFF"
42 ;;
43
44 let arith_status () =
45 print_newline ();
46
47 arith_print_string
48 "Normalization during computation";
49 arith_print_bool (get_normalize_ratio ());
50 print_newline ();
51 print_string " (returned by get_normalize_ratio ())";
52 print_newline ();
53 print_string " (modifiable with set_normalize_ratio <your choice>)";
54 print_newline ();
55 print_newline ();
56
57 arith_print_string
58 "Normalization when printing";
59 arith_print_bool (get_normalize_ratio_when_printing ());
60 print_newline ();
61 print_string
62 " (returned by get_normalize_ratio_when_printing ())";
63 print_newline ();
64 print_string
65 " (modifiable with set_normalize_ratio_when_printing <your choice>)";
66 print_newline ();
67 print_newline ();
68
69 arith_print_string
70 "Floating point approximation when printing rational numbers";
71 arith_print_bool (get_approx_printing ());
72 print_newline ();
73 print_string
74 " (returned by get_approx_printing ())";
75 print_newline ();
76 print_string
77 " (modifiable with set_approx_printing <your choice>)";
78 print_newline ();
79 (if (get_approx_printing ())
80 then (print_string " Default precision = ";
81 print_int (get_floating_precision ());
82 print_newline ();
83 print_string " (returned by get_floating_precision ())";
84 print_newline ();
85 print_string
86 " (modifiable with set_floating_precision <your choice>)";
87 print_newline ();
88 print_newline ())
89 else print_newline());
90
91 arith_print_string
92 "Error when a rational denominator is null";
93 arith_print_bool (get_error_when_null_denominator ());
94 print_newline ();
95 print_string " (returned by get_error_when_null_denominator ())";
96 print_newline ();
97 print_string
98 " (modifiable with set_error_when_null_denominator <your choice>)";
99 print_newline ()
100 ;;
Something went wrong with that request. Please try again.