The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



EEngStr


Unit:SDL_math1
Class:None
Declaration: function EEngStr (innum: double; precision: integer): string;

The function EEngStr converts the floating point value innum into a string using a unit prefix notation as it is commonly used in electrical engineering. The parameter precision determines the minimum number of significant digits (not decimal places!) used for formating the numeric string. It may be set to values between -9 and +9, zero values will be interpreted as +1. Negative values of the precision parameter force the unit prefix to be inserted instead of the decimal point, positive values will result in appending the prefix at the end of the string ('8k2' vs. '8.2k'). Following is the list of available prefixes.

Prefix Denomination Multiplication Factor
a atto 10-18
f femto 10-15
p pico 10-12
n nano 10-9
u micro 10-6
m milli 10-3
k kilo 103
M mega 106
G giga 109
T tera 1012

Example: Assuming that the variable 'anum' contains the value 0.07231 the call to EEngStr(anum, 3) will result in '72.3m', a call to EEngStr(anum,-3) will yield '72m3'.



Last Update: 2012-Oct-20