scientific

Prev Next

Function Names

scientific

Description

This function converts a numeric value to a string where scientific notation is used all time. It is particularly useful to write them into tables without losing accuracy, particularly for very small and very large magnitudes. 16 decimal digits are foreseen to ensure preserving the full accuracy. The last 1-2 significan digits may deviate from the true value due to limited number of mantissa bit in the floating point numbers.

To read values in scientific notation format from tables, please refer to table configure() where reading scientific notation format must be enabled.

Vectorization: This function supports vectorization in the 1st function parameter. Instead of providing a single value, you can provide a set or even a nested set which contain multiple values. The function will then process every value and its return value contains a corresponding set containing all results.

Call as: function

Restrictions

Indirect parameter passing is disabled
Vectorization is allowed in the 1st function parameter

Parameter count

1

Parameters

No.TypeDescription
1
input
numeral Numeric value

This vaule will be converted to a string using scientific notation.

Return value

TypeDescription
string Result

Value using scientific notation format.

Examples

       echo( scientific(0) );
       echo( scientific(1000000) );
       echo( scientific(num("1E+6")) );
       echo( scientific(1/432432334));

Output

0.0000000000000000e+00
1.0000000000000000e+06
1.0000000000000000e+06
2.3125005263829324e-09
Try it yourself: Open LIB_Function_scientific.b4p in B4P_Examples.zip. Decompress before use.