【发布时间】:2010-08-29 17:41:15
【问题描述】:
可能重复:
Prevent scientific notation in ostream when using << with double
计算后我得到 1e-1 作为结果,如何将结果从指数转换为点表示法,即 0.1 ?为什么会自动转换成指数符号!!
【问题讨论】:
标签: c++ oracle floating-point
可能重复:
Prevent scientific notation in ostream when using << with double
计算后我得到 1e-1 作为结果,如何将结果从指数转换为点表示法,即 0.1 ?为什么会自动转换成指数符号!!
【问题讨论】:
标签: c++ oracle floating-point
您可以使用fixed I/O 操纵器强制以定点表示法打印数字:
double d = 42.0;
std::cout << std::fixed << d;
(std::scientific 则相反:它强制以科学计数法打印数字)
【讨论】:
Oracle(通常)不处理二进制数(some support was added in 10g)。 数字以内部格式保存,除非您使用隐式或显式 TO_CHAR,否则由“客户”来显示它们(或任何想要的“美化”)。
select to_number('1e-1') num,
to_char(to_number('1e-1'),'9.9EEEE') sci_num,
to_char(to_number('1e-1')) std_num
from dual;
NUM SCI_NUM ST
--------------- --------- --
.10 1.0E-01 .1
【讨论】: