]>
Dogcows Code - chaz/yoink/blob - src/stlplus/strings/string_float.hpp
1 #ifndef STLPLUS_STRING_FLOAT
2 #define STLPLUS_STRING_FLOAT
3 ////////////////////////////////////////////////////////////////////////////////
5 // Author: Andy Rushton
6 // Copyright: (c) Southampton University 1999-2004
7 // (c) Andy Rushton 2004-2009
8 // License: BSD License, see ../docs/license.html
10 // Convert a float/double to/from string
12 ////////////////////////////////////////////////////////////////////////////////
13 #include "strings_fixes.hpp"
14 #include "format_types.hpp"
21 ////////////////////////////////////////////////////////////////////////////////
22 // convert a real type to string
23 ////////////////////////////////////////////////////////////////////////////////
25 // Only decimal radix is supported
27 // The way in which the number is displayed is defined in radix_types.hpp
28 // Using any other value for the display type causes std::invalid_argument to be thrown
30 std::string
float_to_string(float f
,
31 real_display_t display
= display_mixed
,
33 unsigned precision
= 6)
34 throw(std::invalid_argument
);
36 std::string
double_to_string(double f
,
37 real_display_t display
= display_mixed
,
39 unsigned precision
= 6)
40 throw(std::invalid_argument
);
42 ////////////////////////////////////////////////////////////////////////////////
43 // Convert a string to a floating-point type
45 float string_to_float(const std::string
& value
)
46 throw(std::invalid_argument
);
48 double string_to_double(const std::string
& value
)
49 throw(std::invalid_argument
);
51 ////////////////////////////////////////////////////////////////////////////////
53 } // end namespace stlplus
This page took 0.036875 seconds and 4 git commands to generate.