]> www.ginac.de Git - cln.git/blob - include/cl_float_io.h
- autoconf/aclocal.m4 (CL_CANONICAL_HOST): Added missing changequote
[cln.git] / include / cl_float_io.h
1 // I/O of floats.
2
3 #ifndef _CL_FLOAT_IO_H
4 #define _CL_FLOAT_IO_H
5
6 #include "cl_number_io.h"
7 #include "cl_float.h"
8
9
10 // Undocumented input functions
11
12 // Wandelt eine Zeichenkette mit Float-Syntax in ein Float um.
13 // read_float(base,sign,string,index1,index4,index2,index3)
14 // > base: Lesebasis (=10)
15 // > sign: Vorzeichen (/=0 falls negativ)
16 // > string: Simple-String (enthält Ziffern und evtl. Punkt und Exponentmarker)
17 // > index1: Index vom Mantissenanfang (excl. Vorzeichen)
18 // > index4: Index nach dem Mantissenende
19 // > index2: Index beim Ende der Characters
20 // > index3: Index nach dem Dezimalpunkt (=index4 falls keiner da)
21 //   (also Mantisse mit index4-index1 Characters: Ziffern und max. 1 '.')
22 //   (also index4-index3 Nachkommaziffern)
23 //   (also bei index4<index2: index4 = Index des Exponent-Markers,
24 //    index4+1 = Index des Exponenten-Vorzeichens oder der ersten
25 //    Exponenten-Ziffer)
26 // < ergebnis: Float
27 extern const cl_F read_float (unsigned int base, cl_float_format_t prec,
28                   cl_signean sign, const char * string, uintL index1, uintL index4, uintL index2, uintL index3);
29
30 // The following does strictly the same as the general read_complex.
31 // It is here only so that you don't need the complex and rational number
32 // readers in order to read a float number. ("Treeshaking")
33 extern const cl_F read_float (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse);
34 extern const cl_F read_float (cl_istream stream, const cl_read_flags& flags);
35
36 // Documented input functions
37
38 inline cl_istream operator>> (cl_istream stream, cl_F& result)
39 {
40         extern cl_read_flags cl_F_read_flags;
41         result = read_float(stream,cl_F_read_flags);
42         return stream;
43 }
44
45
46 // Undocumented output functions
47
48
49 // Documented output functions
50
51 // Gibt ein Float aus.
52 // print_float(stream,z);
53 // > z: Float
54 // > stream: Stream
55 extern void print_float (cl_ostream stream, const cl_print_flags& flags, const cl_F& z);
56 extern void print_float (cl_ostream stream, const cl_print_number_flags& flags, const cl_F& z);
57 extern void print_float (cl_ostream stream, const cl_print_real_flags& flags, const cl_F& z);
58 extern void print_float (cl_ostream stream, const cl_print_float_flags& flags, const cl_F& z);
59
60 // Gibt ein Float binär (sehr primitiv) aus.
61 // print_float_binary(stream,z);
62 // > z: Float
63 // > stream: Stream
64 extern void print_float_binary (cl_ostream stream, const cl_F& z);
65
66 // The following does strictly the same as the general `fprint' for numbers.
67 // It is here only so that you don't need the complex printer
68 // in order to print a float. ("Treeshaking")
69
70 inline void fprint (cl_ostream stream, const cl_F& x)
71 {
72         extern cl_print_flags cl_default_print_flags;
73         print_float(stream,cl_default_print_flags,x);
74 }
75
76 CL_DEFINE_PRINT_OPERATOR(cl_F)
77
78
79 #endif /* _CL_FLOAT_IO_H */