JuliaPlots / JuliaPlots/NumericIO.jl

Incorrect display of engineering format

Open
#10 2 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
Julia
Stars
17
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm trying to use Julia, and NumericIO in particular, to refactor some Fortran.

Julia's output is
```
10000.00 1 -500.00000E0 0.0000000E0 1.0000000E0 -510.00000E0
10000.00 2 -400.00000E0 0.0000000E0 1.0000000E0 -410.00000E0
10000.00 3 -300.00000E0 0.0000000E0 1.0000000E0 -310.00000E0
10000.00 4 -200.00000E0 0.0000000E0 1.0000000E0 -210.00000E0
10000.00 5 -100.00000E0 0.0000000E0 1.0000000E0 -110.00000E0
10000.00 6 0.0000000E0 0.0000000E0 1.0000000E0 -10.000000E0
10000.00 7 100.00000E0 0.0000000E0 1.0000000E0 90.000000E0
10000.00 8 200.00000E0 0.0000000E0 1.0000000E0 190.00000E0
10000.00 9 300.00000E0 0.0000000E0 1.0000000E0 290.00000E0
10000.00 10 400.00000E0 0.0000000E0 1.0000000E0 390.00000E0
10000.00 11 500.00000E0 0.0000000E0 1.0000000E0 490.00000E0
```
from the code fragment
```
oline = @sprintf(" %12.2f %4d", line, tndx)
s = formatted(txdp.l.e, :ENG, ndigits=8, charset=:ASCII); oline *= lpad(s, 15, ' ')
s = formatted(txdp.l.n, :ENG, ndigits=8, charset=:ASCII); oline *= lpad(s, 15, ' ')
s = formatted(txdp.l.z, :ENG, ndigits=8, charset=:ASCII); oline *= lpad(s, 15, ' ')
s = formatted(rxdp[jr].l.e, :ENG, ndigits=8, charset=:ASCII); oline *= lpad(s, 15, ' ')
s = formatted(rxdp[jr].l.n, :ENG, ndigits=8, charset=:ASCII); oline *= lpad(s, 15, ' ')
s = formatted(rxdp[jr].l.z, :ENG, ndigits=8, charset=:ASCII); oline *= lpad(s, 15, ' ')
```

I believe that if engineering format is working correctly, the output should be
```
10000.00 1 -500.00000E+00 0.0000000E+00 1.0000000E+00 -510.00000E+00
10000.00 2 -400.00000E+00 0.0000000E+00 1.0000000E+00 -410.00000E+00
10000.00 3 -300.00000E+00 0.0000000E+00 1.0000000E+00 -310.00000E+00
10000.00 4 -200.00000E+00 0.0000000E+00 1.0000000E+00 -210.00000E+00
10000.00 5 -100.00000E+00 0.0000000E+00 1.0000000E+00 -110.00000E+00
10000.00 6 0.00000E+00 0.0000000E+00 1.0000000E+00 -10.00000E+00
10000.00 7 100.00000E+00 0.0000000E+00 1.0000000E+00 90.00000E+00
10000.00 8 200.00000E+00 0.0000000E+00 1.0000000E+00 190.00000E+00
10000.00 9 300.00000E+00 0.0000000E+00 1.0000000E+00 290.00000E+00
10000.00 10 400.00000E+00 0.0000000E+00 1.0000000E+00 390.00000E+00
10000.00 11 500.00000E+00 0.0000000E+00 1.0000000E+00 490.00000E+00
```
ie. decimal points should align down the columns as they do in Fortran.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.