Gene Sullivan > Number-FormatEng-0.01 > convert_eng

Download:
Number-FormatEng-0.01.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

convert_eng - Convert numbers to and from engineering notation

SYNOPSIS ^

convert_eng [options] number number ...

    Options:
    +help   verbose help
    +pref   format a number using SI prefixes
    +ez     explicitly display 'e0'
    +unf    unformat: convert a string back to a number

DESCRIPTION ^

Format a number (or a list of numbers) using engineering notation. Formatted/converted values will be printed to STDOUT, one per line.

OPTIONS ^

Note that the options use +, instead of a conventional dash, so that negative numbers can be converted. All options can be abbreviated.

+pref

To format a floating-point numeric value using SI prefixes, use the +pref option.

    convert_eng +pref 1e-16
+unf

To convert a string formatted with an SI prefix back to a numeric value, use the +unf option.

    convert_eng +unf 77M
+ez

By default, if the exponent is zero, e0 is not displayed. To explicitly display e0, use the +ez option. This option has no effect if +pref is used.

    convert_eng +ez 22.2
+help

Show verbose usage information.

EXAMPLES ^

Convert 50000 to 50e3:

    convert_eng 50000

Convert 5000 to 5k and 0.037 to -37m:

    convert_eng +p 5000 -0.037

Convert 1.23k to 1234:

    convert_eng +u 1.23k

Displays 7.89 as 7.89e0:

    convert_eng +ez 7.89

DEPENDENCIES ^

Number::FormatEng

AUTHOR ^

Gene Sullivan (gsullivan@cpan.org)

syntax highlighting: