#include <format_float.h>
The base-10 logarithm of the smallest and largest numbers to be represented without a string of the form
$\times 10^{\mathrm{x}}$
Note that this function does not warn the user if the number of significant figures requested is larger than the machine precision.
The format for a normal number is
prefix (sign-string) number suffix
sci-prefix (sci-sign-string) number times-string exp-prefix (exp-sign-string) exponent exp-suffix sci-suffix
Definition at line 78 of file format_float.h.
Public Member Functions | |
int | html_mode () |
Set HTML mode. | |
int | latex_mode () |
Set Latex mode. | |
std::string | convert (double x) |
Convert a floating point number to a string. | |
Set text settings | |
int | set_prefix (std::string prefix) |
set prefix | |
int | set_suffix (std::string suffix) |
Set suffix. | |
int | set_sci_prefix (std::string sci_prefix) |
Set prefix for scientific notation. | |
int | set_sci_suffix (std::string sci_suffix) |
Set suffix for scientific notation. | |
int | set_exp_prefix (std::string exp_prefix) |
Set prefix for exponent. | |
int | set_exp_suffix (std::string exp_suffix) |
Set suffix for exponent. | |
int | set_sign (std::string sign) |
Set sign. | |
int | set_exp_sign (std::string exp_sign) |
Set sign for exponent. | |
int | set_sci_sign (std::string sci_sign) |
Set sign for scientific notation. | |
int | set_times (std::string times) |
Set times. | |
int | set_zero (std::string zero) |
Set zero. | |
int | set_not_finite (std::string not_finite) |
Set string for numbers which are not finite. | |
Set other settings | |
int | set_exp_limits (int min, int max) |
Set the exponent limits. | |
int | set_sig_figs (size_t sig_figs) |
Set the number of significant figures. | |
Get text settings | |
std::string | get_prefix () |
Get prefix. | |
std::string | get_suffix () |
Get suffix. | |
std::string | get_sci_prefix () |
Get prefix for scientific notation. | |
std::string | get_sci_suffix () |
Get suffix for scientific notation. | |
std::string | get_exp_prefix () |
Get prefix for exponent. | |
std::string | get_exp_suffix () |
Get suffix for exponent. | |
std::string | get_sign () |
Get sign. | |
std::string | get_exp_sign () |
Get sign for exponent. | |
std::string | get_sci_sign () |
Get sign for scientific notation. | |
std::string | get_times () |
Get times. | |
std::string | get_zero () |
Get zero. | |
std::string | get_not_finite () |
Get string for numbers which are not finite. | |
Get other settings | |
int | get_exp_min () |
Get minimum exponent. | |
int | get_exp_max () |
Get maximum exponent. | |
size_t | get_sig_figs () |
Get sig_figs. | |
Protected Attributes | |
Base text settings | |
std::string | prefx |
Prefix (default ""). | |
std::string | suffx |
Suffix (default ""). | |
std::string | sgn |
Sign string (default "-"). | |
std::string | sci_sgn |
Sign string in scientific mode (default "-"). | |
std::string | exp_sgn |
Sign string for exponent in scientific mode (default "-"). | |
std::string | sci_prefx |
Prefix in scientific mode (default ""). | |
std::string | sci_suffx |
Suffix in scientific mode (default ""). | |
std::string | exp_prefx |
Exponent prefix (default ""). | |
std::string | exp_suffx |
Exponent suffix (default ""). | |
std::string | tmes |
Times symbol for scientific mode (default " x "). | |
std::string | not_finte |
String for numbers which are not finite (default "Nan"). | |
std::string | zeros |
String for zeros (default "0"). | |
Other settings | |
size_t | sig_fgs |
Number of significant figures (default 5). | |
int | ex_mn |
Lower limit for automatic mode (default -2). | |
int | ex_mx |
Upper limit for automatic mode (default -2). | |
bool | pad_zeros |
If true, pad with zeros (default false). |
int html_mode | ( | ) | [inline] |
This function is equivalent to the settings:
format_float::set_prefix(""); format_float::set_sign("-"); format_float::set_suffix(""); format_float::set_sci_prefix(""); format_float::set_times(" × "); format_float::set_exp_prefix("10<sup>"); format_float::set_exp_sign("-"); format_float::set_sci_sign("-"); format_float::set_exp_suffix("</sup>"); format_float::set_sci_suffix(""); format_float::set_not_finite("Nan"); format_float::set_zero("0");
Definition at line 161 of file format_float.h.
int latex_mode | ( | ) | [inline] |
This function is equivalent to the settings:
format_float::set_prefix(""); format_float::set_sign("$-$"); format_float::set_suffix(""); format_float::set_sci_prefix(""); format_float::set_times(" $\\times "); format_float::set_exp_prefix("10^{"); format_float::set_exp_sign("-"); format_float::set_sci_sign("$-$"); format_float::set_exp_suffix("}"); format_float::set_sci_suffix(""); format_float::set_not_finite("Nan"); format_float::set_zero("0");
Definition at line 195 of file format_float.h.
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page