Scientific notation is advantageous, but has some drawbacks. Imagine your data contains chapter and section numbers like "2D-1", "2E-1" (chapter 2, sections D and E, subsction 1) and confusion happens. For this reason, scientific notation can only be specified indirectly:
Following rules apply to scientific notation:
a[] = 1000;
a[text 1] = 1E03;
a[text 2] = '1e+03'; // Put into quotation marks to avoid adding 3 to '1e'
a[num 1] = num(1E03);
a[num 2] = num('1E+03'); // Quotation marks required because of plus symbol (confuses with addition)
a[milli ] = num('1e-3');
a[wrong ] = num('1E 03'); // Space inside. Only 1st digit will be recgnized
see(a[]);
echo("Outputing scientific notation: ", scientific(0.001/7) );
a[] 1000 "1000" (numeral,full access)
milli 0.001 (plain numeral,full access)
num 1 1000 (plain numeral,full access)
num 2 1000 (plain numeral,full access)
text 1 1E03 (softquoted string,full access)
text 2 1e+03 (softquoted string,full access)
wrong 1 (plain numeral,full access)
Outputing scientific notation: 1.4285714285714287e-04
By default, scientific notation in tables will be recognized as text. However, the function table configure() allows you to activate recognition of scientific notation.
table create( table );
with table( table, 0, 0 ) // Partial table specification, [.] is row 0 / column 0
{
[.] = '1.24E-05';
echo( [.], '&tab12;Type: ', subtype([.]), '&tab40;Note: Read in as text into a string' );
table configure( table, scientific notation, yes );
echo( [.], '&tab24;', subtype([.]), '&tab40;Original text representation is still preserved' );
echo( [.]+0, '&tab24;', subtype([.]+0), '&tab40;Text representation destroyed by calculation, but same value' );
echo( [.]+0, '&tab24;', subtype([.]+0), '&tab40;See above' );
echo( scientific([.]+0), '&tab24;', subtype(scientific([.]+0)), '&tab40;Forced use of scientific notation' );
// Note: Explanatory text uses tabulation using dedicated character entities.
}
1.24E-05 Type: quoted string Note: Read in as text into a string
1.24E-05 numeral Original text representation is still preserved
0.0000124 plain numeral Text representation destroyed by calculation, but same value
0.0000124 plain numeral See above
1.2400000000000000e-05 quoted string Forced use of scientific notation