# ANN: Human-friendly numeric output (NumericIO)

**URL:** <https://discourse.julialang.org/t/ann-human-friendly-numeric-output-numericio/5159>\
**Category:** General Usage\
**Created:** [August 1, 2017, 12:30am UTC](https://discourse.julialang.org/t/ann-human-friendly-numeric-output-numericio/5159 "2017-08-01T00:30:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MA\_Laforge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ma_laforge/32/385_2.png) [@MA\_Laforge](https://discourse.julialang.org/u/MA_Laforge)\
**Post date:** [August 1, 2017, 12:30am UTC](https://discourse.julialang.org/t/ann-human-friendly-numeric-output-numericio/5159/1 "2017-08-01T00:30:57Z")

</div>

NumericIO provides fine control over numeric output: Scientific/Engineering/SI-notation +UTF8:

- Includes facilities to display values using SI prefixes (`Y`, `Z`, `E`, `P`, `T`, `G`, `M`, `k`, `m`, `μ`, `n`, `p`, `f`, `a`, `z`, `y`)
- Makes it easy to control the number of significant digits to output - as opposed to number of decimal places (similar, but not the same).
- Link: [GitHub - ma-laforge/NumericIO.jl: Fine control over numeric output: Scientific/Engineering/SI-notation +UTF8](https://github.com/ma-laforge/NumericIO.jl)

### Basic Usage

Create a convenience formatting function:

```julia-auto
using NumericIO
SI(x) = formatted(x, :SI, ndigits=4)

```

Then use said function:

```julia-auto
SI(3.14159e-9) # => "3.142n"
SI(2.71828e12) # => "2.718T"

```

For a more traditional scientific output, use the following:

```julia-auto
formatted(3.14159e-8, :SCI, ndigits=3) # => "3.14×10⁻⁸"

```

Or instead restrict the output to engineering notation (limiting to powers divisible by 3):

```julia-auto
formatted(3.14159e-8, :ENG, ndigits=3) # => "31.4×10⁻⁹"

```

**NOTE:** \* I personally find numeric output easier to read in engineering notation as opposed to scientific notation.

### More Advanced Usage

Fix the output to a certain floating point position:

```julia-auto
fmt = NumericIO.IOFormattingReal(:SI, NumericIO.Charset{:UTF8}, ndigits=4, decpos=-12, decfloating=false)
SI(x) = formatted(x, fmt)

#Sample output:
SI(3.14159e-11) # => "31.42p"
SI(2.71828e-7) # => "271800p"

```

For more examples of advanced usage, consult the README.md page: [GitHub - ma-laforge/NumericIO.jl: Fine control over numeric output: Scientific/Engineering/SI-notation +UTF8](https://github.com/ma-laforge/NumericIO.jl).

Note that the low level functions operate on `IO` streams, and make use of Julia’s built-in GRISU algorithms.
