2

Possible Duplicate:
Prevent scientific notation in ostream when using << with double

I get 1e-1 as result after a computation how can I convert the result from exponent to dot notation i.e., 0.1 ? Why is it automatically converted to exponential notation!!

Community
  • 1
  • 1
yesraaj
  • 46,370
  • 69
  • 194
  • 251

2 Answers2

5

You can use the fixed I/O manipulator to force the number to be printed in fixed-point notation:

double d = 42.0;
std::cout << std::fixed << d;

(std::scientific does the opposite: it forces the number to be printed in scientific notation)

James McNellis
  • 348,265
  • 75
  • 913
  • 977
0

Oracle (generally) doesn't do binary numbers (some support was added in 10g). Numbers are held in an internal format and, unless you use an implicit or explicit TO_CHAR, it is up to the "client" to display them (or any desired "prettifying").

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
Gary Myers
  • 34,963
  • 3
  • 49
  • 74