## page was renamed from csci423Wiki/Assignments/ScientificNotation #acl All:read,_Students:read,write <> {{{#!wiki important For most of these examples, you must specify a '''precision''' for the format as well in order to meet typical project requirements for the course! }}} Students may add to this page if they feel so inclined. = C = {{{#!highlight c printf( "%e\n", 0.003 ); }}} '''Beware''' `%g` formatting, its precision field specifies the ''maximum'' number of digits to use. It will print $\frac{1}{2}$ as just `0.5`. = C++ = {{{#!highlight c++ std::cout << std::scientific << 0.003 << std::endl; }}} = Java = {{{#!highlight java System.println( "%e" % 0.003 ); }}} Other methods exist with `DecimalFormat`. = Python = {{{#!highlight python "%e" % 0.003 "{:e}".format( 0.003 ) format(0.003,'.4e') }}} = Racket = {{{#!highlight scheme (~r 0.003 #:notation 'exponential #:precision '(= 4)) }}}