]> www.ginac.de Git - cln.git/blob - include/cln/real_io.h
Finalize CLN 1.3.7 release.
[cln.git] / include / cln / real_io.h
1 // I/O of real numbers.
2
3 #ifndef _CL_REAL_IO_H
4 #define _CL_REAL_IO_H
5
6 #include "cln/number_io.h"
7 #include "cln/real.h"
8
9 namespace cln {
10
11 // Input functions
12
13 // The following does strictly the same as the general read_complex.
14 // It is here only so that you don't need the complex number reader
15 // in order to read an rational number. ("Treeshaking")
16 extern const cl_R read_real (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse);
17 extern const cl_R read_real (std::istream& stream, const cl_read_flags& flags);
18
19 inline std::istream& operator>> (std::istream& stream, cl_R& result)
20 {
21         extern cl_read_flags cl_R_read_flags;
22         result = read_real(stream,cl_R_read_flags);
23         return stream;
24 }
25
26
27 // Output functions
28
29 // Gibt eine Zahl aus.
30 // print_real(stream,flags,z);
31 // > z: Zahl
32 // > stream: Stream
33 // > flags: Ausgabe-Parameter
34 extern void print_real (std::ostream& stream, const cl_print_flags& flags, const cl_R& z);
35 extern void print_real (std::ostream& stream, const cl_print_number_flags& flags, const cl_R& z);
36 extern void print_real (std::ostream& stream, const cl_print_real_flags& flags, const cl_R& z);
37
38 // The following does strictly the same as the general `fprint' for numbers.
39 // It is here only so that you don't need the complex number printer
40 // in order to print an integer. ("Treeshaking")
41
42 inline void fprint (std::ostream& stream, const cl_R& x)
43 {
44         extern cl_print_flags default_print_flags;
45         print_real(stream,default_print_flags,x);
46 }
47
48 CL_DEFINE_PRINT_OPERATOR(cl_R)
49
50 }  // namespace cln
51
52 #endif /* _CL_REAL_IO_H */